From 20d7496593cb03dcec5c73797c12f39d1474fcfe Mon Sep 17 00:00:00 2001 From: brongniart Date: Tue, 12 Nov 2024 08:53:26 +0100 Subject: [PATCH] recupe quote --- .htaccess | 4 +- .idea/dataSources.local.xml | 36 +- .idea/dataSources.xml | 22 +- .../351a7e7c-c4d1-4e89-bf03-667b32764270.xml | 9994 ++++++++--------- .../schema/public.abK9xQ.meta | 4 +- .idea/material_theme_project_new.xml | 18 +- .idea/php.xml | 64 +- .idea/vcs.xml | 10 +- .idea/workspace.xml | 260 +- README.md | 4 +- cache/3c/3ceeff3fb7d2c301f9137b5178bfde0d.php | 334 +- cache/44/4448d384ce5c0b36e3d5c422f47fbacf.php | 230 +- cache/4c/4c09a23641745f18c4a77cbf74811c72.php | 180 +- cache/57/572879f536ab89f645ae886cddb0ed04.php | 156 +- cache/b8/b8bf2b0d7583c567fbc28aec381ed411.php | 300 +- cache/f9/f92f69760ebb764380af0f11a2633512.php | 204 +- citation.txt | 742 +- composer.json | 30 +- composer.lock | 924 +- config/config.php | 69 +- drone.yml | 124 +- images/coeur.svg | 6 +- images/dark.svg | 4 +- images/light.svg | 20 +- images/quizz.svg | 6 +- index.php | 60 +- public/images/coeur.svg | 6 +- public/images/dark.svg | 4 +- public/images/light.svg | 20 +- public/images/quizz.svg | 6 +- public/script/auth-check.js | 78 +- public/script/changeData.js | 338 +- public/script/theme-toggle.js | 102 +- public/script/truncateQuotes.js | 22 +- public/styles/style.css | 290 +- public/styles/styleAccueil.css | 270 +- public/styles/styleLogin.css | 260 +- public/styles/styleProfil.css | 452 +- public/styles/styleQuiz.css | 306 +- public/styles/styleQuote.css | 218 +- public/styles/styleSearch.css | 11 + public/styles/styleSignin.css | 238 +- src/Controleur/FrontControler.php | 215 +- src/Controleur/QuizControler.php | 286 +- src/Controleur/UserControler.php | 20 +- src/Controleur/VisitorControler.php | 68 +- src/Entity/FavoriteEntity.php | 106 +- src/Entity/ImageEntity.php | 106 +- src/Entity/QuizQuestionEntity.php | 108 +- src/Entity/ResultsEntity.php | 138 +- src/Entity/characterEntity.php | 154 +- src/Entity/commentaryEntity.php | 144 +- src/Entity/questionEntity.php | 296 +- src/Entity/quizEntity.php | 112 +- src/Entity/quoteEntity.php | 336 +- src/Entity/sourceEntity.php | 154 +- src/Entity/userEntity.php | 350 +- src/Gateway/CharacterGateway.php | 148 +- src/Gateway/Connection.php | 70 +- src/Gateway/FavoriteGateway.php | 152 +- src/Gateway/ImageGateway.php | 172 +- src/Gateway/QuestionGateway.php | 214 +- src/Gateway/QuizGateway.php | 98 +- src/Gateway/QuizQuestionGateway.php | 144 +- src/Gateway/ResultsGateway.php | 260 +- src/Gateway/commentaryGateway.php | 110 +- src/Gateway/quoteGateway.php | 270 +- src/Gateway/sourceGateway.php | 216 +- src/Gateway/userGateway.php | 210 +- src/Model/CharacterModel.php | 146 +- src/Model/FavoriteModel.php | 140 +- src/Model/ImageModel.php | 158 +- src/Model/QuestionModel.php | 174 +- src/Model/QuizModel.php | 108 +- src/Model/QuizQuestionModel.php | 158 +- src/Model/ResultsModel.php | 190 +- src/Model/commentaryModel.php | 100 +- src/Model/quoteModel.php | 40 +- src/Model/searchModel.php | 0 src/Model/sourceModel.php | 170 +- src/Model/userModel.php | 154 +- vendor/altorouter/altorouter/AltoRouter.php | 604 +- vendor/altorouter/altorouter/LICENSE.md | 16 +- vendor/altorouter/altorouter/README.md | 112 +- vendor/altorouter/altorouter/composer.json | 72 +- vendor/altorouter/altorouter/phpcs.xml | 20 +- vendor/autoload.php | 50 +- vendor/composer/ClassLoader.php | 1158 +- vendor/composer/InstalledVersions.php | 718 +- vendor/composer/LICENSE | 42 +- vendor/composer/autoload_classmap.php | 26 +- vendor/composer/autoload_files.php | 34 +- vendor/composer/autoload_namespaces.php | 18 +- vendor/composer/autoload_psr4.php | 34 +- vendor/composer/autoload_real.php | 100 +- vendor/composer/autoload_static.php | 200 +- vendor/composer/installed.json | 930 +- vendor/composer/installed.php | 154 +- vendor/composer/platform_check.php | 52 +- .../deprecation-contracts/CHANGELOG.md | 10 +- vendor/symfony/deprecation-contracts/LICENSE | 38 +- .../symfony/deprecation-contracts/README.md | 52 +- .../deprecation-contracts/composer.json | 70 +- .../deprecation-contracts/function.php | 54 +- vendor/symfony/polyfill-ctype/Ctype.php | 464 +- vendor/symfony/polyfill-ctype/LICENSE | 38 +- vendor/symfony/polyfill-ctype/README.md | 24 +- vendor/symfony/polyfill-ctype/bootstrap.php | 100 +- vendor/symfony/polyfill-ctype/bootstrap80.php | 92 +- vendor/symfony/polyfill-ctype/composer.json | 76 +- vendor/symfony/polyfill-mbstring/LICENSE | 38 +- vendor/symfony/polyfill-mbstring/Mbstring.php | 2090 ++-- vendor/symfony/polyfill-mbstring/README.md | 26 +- .../Resources/unidata/caseFolding.php | 238 +- .../Resources/unidata/lowerCase.php | 2794 ++--- .../Resources/unidata/titleCaseRegexp.php | 10 +- .../Resources/unidata/upperCase.php | 2978 ++--- .../symfony/polyfill-mbstring/bootstrap.php | 344 +- .../symfony/polyfill-mbstring/bootstrap80.php | 334 +- .../symfony/polyfill-mbstring/composer.json | 76 +- vendor/symfony/polyfill-php81/LICENSE | 38 +- vendor/symfony/polyfill-php81/Php81.php | 74 +- vendor/symfony/polyfill-php81/README.md | 36 +- .../Resources/stubs/CURLStringFile.php | 102 +- .../Resources/stubs/ReturnTypeWillChange.php | 40 +- vendor/symfony/polyfill-php81/bootstrap.php | 56 +- vendor/symfony/polyfill-php81/composer.json | 66 +- vendor/twig/twig/CHANGELOG | 650 +- vendor/twig/twig/LICENSE | 54 +- vendor/twig/twig/README.rst | 46 +- vendor/twig/twig/composer.json | 106 +- vendor/twig/twig/src/AbstractTwigCallable.php | 272 +- .../Attribute/FirstClassTwigCallableReady.php | 40 +- vendor/twig/twig/src/Attribute/YieldReady.php | 40 +- vendor/twig/twig/src/Cache/CacheInterface.php | 92 +- vendor/twig/twig/src/Cache/ChainCache.php | 158 +- .../twig/twig/src/Cache/FilesystemCache.php | 174 +- vendor/twig/twig/src/Cache/NullCache.php | 76 +- .../src/Cache/ReadOnlyFilesystemCache.php | 50 +- vendor/twig/twig/src/Compiler.php | 514 +- vendor/twig/twig/src/Environment.php | 1762 +-- vendor/twig/twig/src/Error/Error.php | 454 +- vendor/twig/twig/src/Error/LoaderError.php | 42 +- vendor/twig/twig/src/Error/RuntimeError.php | 44 +- vendor/twig/twig/src/Error/SyntaxError.php | 92 +- vendor/twig/twig/src/ExpressionParser.php | 1706 +-- .../twig/src/Extension/AbstractExtension.php | 90 +- .../twig/twig/src/Extension/CoreExtension.php | 3940 +++---- .../twig/src/Extension/DebugExtension.php | 124 +- .../twig/src/Extension/EscaperExtension.php | 400 +- .../twig/src/Extension/ExtensionInterface.php | 150 +- .../twig/src/Extension/GlobalsInterface.php | 50 +- .../twig/src/Extension/OptimizerExtension.php | 54 +- .../twig/src/Extension/ProfilerExtension.php | 104 +- .../Extension/RuntimeExtensionInterface.php | 38 +- .../twig/src/Extension/SandboxExtension.php | 270 +- .../twig/src/Extension/StagingExtension.php | 200 +- .../src/Extension/StringLoaderExtension.php | 80 +- .../src/Extension/YieldNotReadyExtension.php | 60 +- vendor/twig/twig/src/ExtensionSet.php | 976 +- .../src/FileExtensionEscapingStrategy.php | 120 +- vendor/twig/twig/src/Lexer.php | 1168 +- vendor/twig/twig/src/Loader/ArrayLoader.php | 150 +- vendor/twig/twig/src/Loader/ChainLoader.php | 264 +- .../twig/twig/src/Loader/FilesystemLoader.php | 566 +- .../twig/twig/src/Loader/LoaderInterface.php | 98 +- vendor/twig/twig/src/Markup.php | 104 +- vendor/twig/twig/src/Node/AutoEscapeNode.php | 80 +- vendor/twig/twig/src/Node/BlockNode.php | 100 +- .../twig/twig/src/Node/BlockReferenceNode.php | 76 +- vendor/twig/twig/src/Node/BodyNode.php | 48 +- vendor/twig/twig/src/Node/CaptureNode.php | 114 +- .../twig/src/Node/CheckSecurityCallNode.php | 60 +- .../twig/twig/src/Node/CheckSecurityNode.php | 170 +- .../twig/twig/src/Node/CheckToStringNode.php | 94 +- vendor/twig/twig/src/Node/DeprecatedNode.php | 146 +- vendor/twig/twig/src/Node/DoNode.php | 80 +- vendor/twig/twig/src/Node/EmbedNode.php | 100 +- .../Node/Expression/AbstractExpression.php | 56 +- .../src/Node/Expression/ArrayExpression.php | 270 +- .../Expression/ArrowFunctionExpression.php | 128 +- .../Node/Expression/AssignNameExpression.php | 54 +- .../Node/Expression/Binary/AbstractBinary.php | 84 +- .../src/Node/Expression/Binary/AddBinary.php | 46 +- .../src/Node/Expression/Binary/AndBinary.php | 46 +- .../Expression/Binary/BitwiseAndBinary.php | 46 +- .../Expression/Binary/BitwiseOrBinary.php | 46 +- .../Expression/Binary/BitwiseXorBinary.php | 46 +- .../Node/Expression/Binary/ConcatBinary.php | 46 +- .../src/Node/Expression/Binary/DivBinary.php | 46 +- .../Node/Expression/Binary/EndsWithBinary.php | 70 +- .../Node/Expression/Binary/EqualBinary.php | 78 +- .../Node/Expression/Binary/FloorDivBinary.php | 58 +- .../Node/Expression/Binary/GreaterBinary.php | 78 +- .../Expression/Binary/GreaterEqualBinary.php | 78 +- .../Node/Expression/Binary/HasEveryBinary.php | 66 +- .../Node/Expression/Binary/HasSomeBinary.php | 66 +- .../src/Node/Expression/Binary/InBinary.php | 66 +- .../src/Node/Expression/Binary/LessBinary.php | 78 +- .../Expression/Binary/LessEqualBinary.php | 78 +- .../Node/Expression/Binary/MatchesBinary.php | 66 +- .../src/Node/Expression/Binary/ModBinary.php | 46 +- .../src/Node/Expression/Binary/MulBinary.php | 46 +- .../Node/Expression/Binary/NotEqualBinary.php | 78 +- .../Node/Expression/Binary/NotInBinary.php | 66 +- .../src/Node/Expression/Binary/OrBinary.php | 46 +- .../Node/Expression/Binary/PowerBinary.php | 44 +- .../Node/Expression/Binary/RangeBinary.php | 66 +- .../Expression/Binary/SpaceshipBinary.php | 44 +- .../Expression/Binary/StartsWithBinary.php | 70 +- .../src/Node/Expression/Binary/SubBinary.php | 46 +- .../Expression/BlockReferenceExpression.php | 174 +- .../src/Node/Expression/CallExpression.php | 724 +- .../Node/Expression/ConditionalExpression.php | 90 +- .../Node/Expression/ConstantExpression.php | 62 +- .../Node/Expression/Filter/DefaultFilter.php | 126 +- .../src/Node/Expression/Filter/RawFilter.php | 72 +- .../src/Node/Expression/FilterExpression.php | 146 +- .../Node/Expression/FunctionExpression.php | 136 +- .../FunctionNode/EnumCasesFunction.php | 82 +- .../src/Node/Expression/GetAttrExpression.php | 174 +- .../twig/src/Node/Expression/InlinePrint.php | 68 +- .../Node/Expression/MethodCallExpression.php | 128 +- .../src/Node/Expression/NameExpression.php | 214 +- .../Expression/NullCoalesceExpression.php | 122 +- .../src/Node/Expression/ParentExpression.php | 92 +- .../Node/Expression/TempNameExpression.php | 62 +- .../src/Node/Expression/Test/ConstantTest.php | 98 +- .../src/Node/Expression/Test/DefinedTest.php | 162 +- .../Node/Expression/Test/DivisiblebyTest.php | 72 +- .../src/Node/Expression/Test/EvenTest.php | 70 +- .../src/Node/Expression/Test/NullTest.php | 68 +- .../twig/src/Node/Expression/Test/OddTest.php | 70 +- .../src/Node/Expression/Test/SameasTest.php | 68 +- .../src/Node/Expression/TestExpression.php | 132 +- .../Node/Expression/Unary/AbstractUnary.php | 68 +- .../src/Node/Expression/Unary/NegUnary.php | 46 +- .../src/Node/Expression/Unary/NotUnary.php | 46 +- .../src/Node/Expression/Unary/PosUnary.php | 46 +- .../Node/Expression/VariadicExpression.php | 48 +- vendor/twig/twig/src/Node/FlushNode.php | 80 +- vendor/twig/twig/src/Node/ForLoopNode.php | 102 +- vendor/twig/twig/src/Node/ForNode.php | 232 +- vendor/twig/twig/src/Node/IfNode.php | 150 +- vendor/twig/twig/src/Node/ImportNode.php | 150 +- vendor/twig/twig/src/Node/IncludeNode.php | 220 +- vendor/twig/twig/src/Node/MacroNode.php | 212 +- vendor/twig/twig/src/Node/ModuleNode.php | 978 +- vendor/twig/twig/src/Node/NameDeprecation.php | 92 +- vendor/twig/twig/src/Node/Node.php | 562 +- .../twig/src/Node/NodeCaptureInterface.php | 42 +- .../twig/src/Node/NodeOutputInterface.php | 42 +- vendor/twig/twig/src/Node/PrintNode.php | 88 +- vendor/twig/twig/src/Node/SandboxNode.php | 108 +- vendor/twig/twig/src/Node/SetNode.php | 192 +- vendor/twig/twig/src/Node/TextNode.php | 82 +- vendor/twig/twig/src/Node/TypesNode.php | 56 +- vendor/twig/twig/src/Node/WithNode.php | 144 +- vendor/twig/twig/src/NodeTraverser.php | 152 +- .../src/NodeVisitor/AbstractNodeVisitor.php | 98 +- .../src/NodeVisitor/EscaperNodeVisitor.php | 418 +- .../MacroAutoImportNodeVisitor.php | 148 +- .../src/NodeVisitor/NodeVisitorInterface.php | 92 +- .../src/NodeVisitor/OptimizerNodeVisitor.php | 426 +- .../NodeVisitor/SafeAnalysisNodeVisitor.php | 340 +- .../src/NodeVisitor/SandboxNodeVisitor.php | 278 +- .../NodeVisitor/YieldNotReadyNodeVisitor.php | 118 +- vendor/twig/twig/src/Parser.php | 766 +- .../twig/src/Profiler/Dumper/BaseDumper.php | 126 +- .../src/Profiler/Dumper/BlackfireDumper.php | 144 +- .../twig/src/Profiler/Dumper/HtmlDumper.php | 94 +- .../twig/src/Profiler/Dumper/TextDumper.php | 70 +- .../src/Profiler/Node/EnterProfileNode.php | 88 +- .../src/Profiler/Node/LeaveProfileNode.php | 76 +- .../NodeVisitor/ProfilerNodeVisitor.php | 138 +- vendor/twig/twig/src/Profiler/Profile.php | 356 +- vendor/twig/twig/src/Resources/core.php | 1082 +- vendor/twig/twig/src/Resources/debug.php | 50 +- vendor/twig/twig/src/Resources/escaper.php | 102 +- .../twig/twig/src/Resources/string_loader.php | 52 +- .../twig/twig/src/Runtime/EscaperRuntime.php | 654 +- .../RuntimeLoader/ContainerRuntimeLoader.php | 70 +- .../RuntimeLoader/FactoryRuntimeLoader.php | 78 +- .../RuntimeLoader/RuntimeLoaderInterface.php | 54 +- .../twig/twig/src/Sandbox/SecurityError.php | 46 +- .../Sandbox/SecurityNotAllowedFilterError.php | 66 +- .../SecurityNotAllowedFunctionError.php | 66 +- .../Sandbox/SecurityNotAllowedMethodError.php | 80 +- .../SecurityNotAllowedPropertyError.php | 80 +- .../Sandbox/SecurityNotAllowedTagError.php | 66 +- .../twig/twig/src/Sandbox/SecurityPolicy.php | 260 +- .../src/Sandbox/SecurityPolicyInterface.php | 90 +- .../src/Sandbox/SourcePolicyInterface.php | 48 +- vendor/twig/twig/src/Source.php | 94 +- vendor/twig/twig/src/Template.php | 994 +- vendor/twig/twig/src/TemplateWrapper.php | 180 +- .../twig/src/Test/IntegrationTestCase.php | 576 +- vendor/twig/twig/src/Test/NodeTestCase.php | 250 +- vendor/twig/twig/src/Token.php | 360 +- .../src/TokenParser/AbstractTokenParser.php | 64 +- .../twig/src/TokenParser/ApplyTokenParser.php | 120 +- .../src/TokenParser/AutoEscapeTokenParser.php | 116 +- .../twig/src/TokenParser/BlockTokenParser.php | 150 +- .../src/TokenParser/DeprecatedTokenParser.php | 132 +- .../twig/src/TokenParser/DoTokenParser.php | 76 +- .../twig/src/TokenParser/EmbedTokenParser.php | 146 +- .../src/TokenParser/ExtendsTokenParser.php | 98 +- .../twig/src/TokenParser/FlushTokenParser.php | 76 +- .../twig/src/TokenParser/ForTokenParser.php | 156 +- .../twig/src/TokenParser/FromTokenParser.php | 132 +- .../twig/src/TokenParser/IfTokenParser.php | 178 +- .../src/TokenParser/ImportTokenParser.php | 88 +- .../src/TokenParser/IncludeTokenParser.php | 138 +- .../twig/src/TokenParser/MacroTokenParser.php | 132 +- .../src/TokenParser/SandboxTokenParser.php | 132 +- .../twig/src/TokenParser/SetTokenParser.php | 146 +- .../src/TokenParser/TokenParserInterface.php | 92 +- .../twig/src/TokenParser/TypesTokenParser.php | 172 +- .../twig/src/TokenParser/UseTokenParser.php | 146 +- .../twig/src/TokenParser/WithTokenParser.php | 112 +- vendor/twig/twig/src/TokenStream.php | 258 +- .../twig/twig/src/TwigCallableInterface.php | 106 +- vendor/twig/twig/src/TwigFilter.php | 148 +- vendor/twig/twig/src/TwigFunction.php | 126 +- vendor/twig/twig/src/TwigTest.php | 134 +- .../src/Util/CallableArgumentsExtractor.php | 408 +- .../twig/src/Util/DeprecationCollector.php | 154 +- .../twig/twig/src/Util/ReflectionCallable.php | 184 +- .../twig/src/Util/TemplateDirIterator.php | 72 +- vue/CitationView.php | 126 +- vue/accueil.php | 174 +- vue/erreur.php | 8 +- vue/favorite.html | 60 +- vue/login.php | 22 +- vue/profil.php | 34 +- vue/quiz.html | 122 +- vue/quizz.html | 422 +- vue/quote.php | 40 +- vue/search.php | 79 +- vue/signin.php | 22 +- vue/submitAnswer.php | 12 +- vue/templates/bandeau.html.twig | 26 +- vue/templates/filtre.html.twig | 44 + vue/templates/head.html.twig | 20 +- vue/templates/login.html | 72 +- vue/templates/profil.html | 114 +- vue/templates/quiz.html.twig | 132 +- vue/templates/quote.html | 44 +- vue/templates/signin.html | 98 +- 349 files changed, 39108 insertions(+), 39092 deletions(-) create mode 100644 public/styles/styleSearch.css create mode 100644 src/Model/searchModel.php create mode 100644 vue/templates/filtre.html.twig diff --git a/.htaccess b/.htaccess index 7ded04e..fd9c500 100644 --- a/.htaccess +++ b/.htaccess @@ -1,3 +1,3 @@ -RewriteEngine on -RewriteCond %{REQUEST_FILENAME} !-f +RewriteEngine on +RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L] \ No newline at end of file diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml index 84d5b20..aed4879 100644 --- a/.idea/dataSources.local.xml +++ b/.idea/dataSources.local.xml @@ -1,19 +1,19 @@ - - - - - - " - - - master_key - - - - - - - - - + + + + + + " + + + master_key + + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index 1e5c461..654c23d 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -1,12 +1,12 @@ - - - - - postgresql - true - org.postgresql.Driver - jdbc:postgresql://localhost:5432/dbwikifantasy - $ProjectFileDir$ - - + + + + + postgresql + true + org.postgresql.Driver + jdbc:postgresql://localhost:5432/dbwikifantasy + $ProjectFileDir$ + + \ No newline at end of file diff --git a/.idea/dataSources/351a7e7c-c4d1-4e89-bf03-667b32764270.xml b/.idea/dataSources/351a7e7c-c4d1-4e89-bf03-667b32764270.xml index d3d97d5..7eb414e 100644 --- a/.idea/dataSources/351a7e7c-c4d1-4e89-bf03-667b32764270.xml +++ b/.idea/dataSources/351a7e7c-c4d1-4e89-bf03-667b32764270.xml @@ -1,4998 +1,4998 @@ - - - - - mdy - 1||-9223372036854775808|c|G -1||10|c|G -1||10|C|G -1||10|T|G -14087||-9223372036854775808|c|G -14087||10|c|G -14087||10|C|G -14087||10|T|G - 676242 - 14.13 - 1728898708 - true ACDT -true ACSST -false ACST -false ACT -false ACWST -true ADT -true AEDT -true AESST -false AEST -false AFT -true AKDT -false AKST -true ALMST -false ALMT -false AMST -false AMT -false ANAST -false ANAT -false ARST -false ART -false AST -true AWSST -false AWST -true AZOST -false AZOT -false AZST -false AZT -false Africa/Abidjan -false Africa/Accra -false Africa/Addis_Ababa -false Africa/Algiers -false Africa/Asmara -false Africa/Asmera -false Africa/Bamako -false Africa/Bangui -false Africa/Banjul -false Africa/Bissau -false Africa/Blantyre -false Africa/Brazzaville -false Africa/Bujumbura -false Africa/Cairo -false Africa/Casablanca -false Africa/Ceuta -false Africa/Conakry -false Africa/Dakar -false Africa/Dar_es_Salaam -false Africa/Djibouti -false Africa/Douala -false Africa/El_Aaiun -false Africa/Freetown -false Africa/Gaborone -false Africa/Harare -false Africa/Johannesburg -false Africa/Juba -false Africa/Kampala -false Africa/Khartoum -false Africa/Kigali -false Africa/Kinshasa -false Africa/Lagos -false Africa/Libreville -false Africa/Lome -false Africa/Luanda -false Africa/Lubumbashi -false Africa/Lusaka -false Africa/Malabo -false Africa/Maputo -false Africa/Maseru -false Africa/Mbabane -false Africa/Mogadishu -false Africa/Monrovia -false Africa/Nairobi -false Africa/Ndjamena -false Africa/Niamey -false Africa/Nouakchott -false Africa/Ouagadougou -false Africa/Porto-Novo -false Africa/Sao_Tome -false Africa/Timbuktu -false Africa/Tripoli -false Africa/Tunis -false Africa/Windhoek -false America/Adak -false America/Anchorage -false America/Anguilla -false America/Antigua -false America/Araguaina -false America/Argentina/Buenos_Aires -false America/Argentina/Catamarca -false America/Argentina/ComodRivadavia -false America/Argentina/Cordoba -false America/Argentina/Jujuy -false America/Argentina/La_Rioja -false America/Argentina/Mendoza -false America/Argentina/Rio_Gallegos -false America/Argentina/Salta -false America/Argentina/San_Juan -false America/Argentina/San_Luis -false America/Argentina/Tucuman -false America/Argentina/Ushuaia -false America/Aruba -true America/Asuncion -false America/Atikokan -false America/Atka -false America/Bahia -false America/Bahia_Banderas -false America/Barbados -false America/Belem -false America/Belize -false America/Blanc-Sablon -false America/Boa_Vista -false America/Bogota -false America/Boise -false America/Buenos_Aires -false America/Cambridge_Bay -false America/Campo_Grande -false America/Cancun -false America/Caracas -false America/Catamarca -false America/Cayenne -false America/Cayman -false America/Chicago -false America/Chihuahua -false America/Ciudad_Juarez -false America/Coral_Harbour -false America/Cordoba -false America/Costa_Rica -false America/Creston -false America/Cuiaba -false America/Curacao -false America/Danmarkshavn -false America/Dawson -false America/Dawson_Creek -false America/Denver -false America/Detroit -false America/Dominica -false America/Edmonton -false America/Eirunepe -false America/El_Salvador -false America/Ensenada -false America/Fort_Nelson -false America/Fort_Wayne -false America/Fortaleza -false America/Glace_Bay -false America/Godthab -false America/Goose_Bay -false America/Grand_Turk -false America/Grenada -false America/Guadeloupe -false America/Guatemala -false America/Guayaquil -false America/Guyana -false America/Halifax -false America/Havana -false America/Hermosillo -false America/Indiana/Indianapolis -false America/Indiana/Knox -false America/Indiana/Marengo -false America/Indiana/Petersburg -false America/Indiana/Tell_City -false America/Indiana/Vevay -false America/Indiana/Vincennes -false America/Indiana/Winamac -false America/Indianapolis -false America/Inuvik -false America/Iqaluit -false America/Jamaica -false America/Jujuy -false America/Juneau -false America/Kentucky/Louisville -false America/Kentucky/Monticello -false America/Knox_IN -false America/Kralendijk -false America/La_Paz -false America/Lima -false America/Los_Angeles -false America/Louisville -false America/Lower_Princes -false America/Maceio -false America/Managua -false America/Manaus -false America/Marigot -false America/Martinique -false America/Matamoros -false America/Mazatlan -false America/Mendoza -false America/Menominee -false America/Merida -false America/Metlakatla -false America/Mexico_City -false America/Miquelon -false America/Moncton -false America/Monterrey -false America/Montevideo -false America/Montreal -false America/Montserrat -false America/Nassau -false America/New_York -false America/Nipigon -false America/Nome -false America/Noronha -false America/North_Dakota/Beulah -false America/North_Dakota/Center -false America/North_Dakota/New_Salem -false America/Nuuk -false America/Ojinaga -false America/Panama -false America/Pangnirtung -false America/Paramaribo -false America/Phoenix -false America/Port-au-Prince -false America/Port_of_Spain -false America/Porto_Acre -false America/Porto_Velho -false America/Puerto_Rico -false America/Punta_Arenas -false America/Rainy_River -false America/Rankin_Inlet -false America/Recife -false America/Regina -false America/Resolute -false America/Rio_Branco -false America/Rosario -false America/Santa_Isabel -false America/Santarem -true America/Santiago -false America/Santo_Domingo -false America/Sao_Paulo -false America/Scoresbysund -false America/Shiprock -false America/Sitka -false America/St_Barthelemy -false America/St_Johns -false America/St_Kitts -false America/St_Lucia -false America/St_Thomas -false America/St_Vincent -false America/Swift_Current -false America/Tegucigalpa -false America/Thule -false America/Thunder_Bay -false America/Tijuana -false America/Toronto -false America/Tortola -false America/Vancouver -false America/Virgin -false America/Whitehorse -false America/Winnipeg -false America/Yakutat -false America/Yellowknife -false Antarctica/Casey -false Antarctica/Davis -false Antarctica/DumontDUrville -true Antarctica/Macquarie -false Antarctica/Mawson -true Antarctica/McMurdo -false Antarctica/Palmer -false Antarctica/Rothera -true Antarctica/South_Pole -false Antarctica/Syowa -false Antarctica/Troll -false Antarctica/Vostok -false Arctic/Longyearbyen -false Asia/Aden -false Asia/Almaty -false Asia/Amman -false Asia/Anadyr -false Asia/Aqtau -false Asia/Aqtobe -false Asia/Ashgabat -false Asia/Ashkhabad -false Asia/Atyrau -false Asia/Baghdad -false Asia/Bahrain -false Asia/Baku -false Asia/Bangkok -false Asia/Barnaul -false Asia/Beirut -false Asia/Bishkek -false Asia/Brunei -false Asia/Calcutta -false Asia/Chita -false Asia/Choibalsan -false Asia/Chongqing -false Asia/Chungking -false Asia/Colombo -false Asia/Dacca -false Asia/Damascus -false Asia/Dhaka -false Asia/Dili -false Asia/Dubai -false Asia/Dushanbe -false Asia/Famagusta -false Asia/Gaza -false Asia/Harbin -false Asia/Hebron -false Asia/Ho_Chi_Minh -false Asia/Hong_Kong -false Asia/Hovd -false Asia/Irkutsk -false Asia/Istanbul -false Asia/Jakarta -false Asia/Jayapura -false Asia/Jerusalem -false Asia/Kabul -false Asia/Kamchatka -false Asia/Karachi -false Asia/Kashgar -false Asia/Kathmandu -false Asia/Katmandu -false Asia/Khandyga -false Asia/Kolkata -false Asia/Krasnoyarsk -false Asia/Kuala_Lumpur -false Asia/Kuching -false Asia/Kuwait -false Asia/Macao -false Asia/Macau -false Asia/Magadan -false Asia/Makassar -false Asia/Manila -false Asia/Muscat -false Asia/Nicosia -false Asia/Novokuznetsk -false Asia/Novosibirsk -false Asia/Omsk -false Asia/Oral -false Asia/Phnom_Penh -false Asia/Pontianak -false Asia/Pyongyang -false Asia/Qatar -false Asia/Qostanay -false Asia/Qyzylorda -false Asia/Rangoon -false Asia/Riyadh -false Asia/Saigon -false Asia/Sakhalin -false Asia/Samarkand -false Asia/Seoul -false Asia/Shanghai -false Asia/Singapore -false Asia/Srednekolymsk -false Asia/Taipei -false Asia/Tashkent -false Asia/Tbilisi -false Asia/Tehran -false Asia/Tel_Aviv -false Asia/Thimbu -false Asia/Thimphu -false Asia/Tokyo -false Asia/Tomsk -false Asia/Ujung_Pandang -false Asia/Ulaanbaatar -false Asia/Ulan_Bator -false Asia/Urumqi -false Asia/Ust-Nera -false Asia/Vientiane -false Asia/Vladivostok -false Asia/Yakutsk -false Asia/Yangon -false Asia/Yekaterinburg -false Asia/Yerevan -false Atlantic/Azores -false Atlantic/Bermuda -false Atlantic/Canary -false Atlantic/Cape_Verde -false Atlantic/Faeroe -false Atlantic/Faroe -false Atlantic/Jan_Mayen -false Atlantic/Madeira -false Atlantic/Reykjavik -false Atlantic/South_Georgia -false Atlantic/St_Helena -false Atlantic/Stanley -true Australia/ACT -true Australia/Adelaide -false Australia/Brisbane -true Australia/Broken_Hill -true Australia/Canberra -true Australia/Currie -false Australia/Darwin -false Australia/Eucla -true Australia/Hobart -true Australia/LHI -false Australia/Lindeman -true Australia/Lord_Howe -true Australia/Melbourne -true Australia/NSW -false Australia/North -false Australia/Perth -false Australia/Queensland -true Australia/South -true Australia/Sydney -true Australia/Tasmania -true Australia/Victoria -false Australia/West -true Australia/Yancowinna -true BDST -false BDT -false BNT -false BORT -false BOT -false BRA -true BRST -false BRT -true BST -false BTT -false Brazil/Acre -false Brazil/DeNoronha -false Brazil/East -false Brazil/West -true CADT -false CAST -false CCT -true CDT -true CEST -false CET -true CETDST -true CHADT -false CHAST -false CHUT -false CKT -true CLST -true CLT -false COT -false CST -false CST6CDT -false CXT -false Canada/Atlantic -false Canada/Central -false Canada/Eastern -false Canada/Mountain -false Canada/Newfoundland -false Canada/Pacific -false Canada/Saskatchewan -false Canada/Yukon -true Chile/Continental -true Chile/EasterIsland -false Cuba -false DAVT -false DDUT -true EASST -true EAST -false EAT -true EDT -true EEST -false EET -true EETDST -true EGST -false EGT -false EST -false EST5EDT -false Egypt -true Eire -false Etc/GMT -false Etc/GMT+0 -false Etc/GMT+1 -false Etc/GMT+10 -false Etc/GMT+11 -false Etc/GMT+12 -false Etc/GMT+2 -false Etc/GMT+3 -false Etc/GMT+4 -false Etc/GMT+5 -false Etc/GMT+6 -false Etc/GMT+7 -false Etc/GMT+8 -false Etc/GMT+9 -false Etc/GMT-0 -false Etc/GMT-1 -false Etc/GMT-10 -false Etc/GMT-11 -false Etc/GMT-12 -false Etc/GMT-13 -false Etc/GMT-14 -false Etc/GMT-2 -false Etc/GMT-3 -false Etc/GMT-4 -false Etc/GMT-5 -false Etc/GMT-6 -false Etc/GMT-7 -false Etc/GMT-8 -false Etc/GMT-9 -false Etc/GMT0 -false Etc/Greenwich -false Etc/UCT -false Etc/UTC -false Etc/Universal -false Etc/Zulu -false Europe/Amsterdam -false Europe/Andorra -false Europe/Astrakhan -false Europe/Athens -false Europe/Belfast -false Europe/Belgrade -false Europe/Berlin -false Europe/Bratislava -false Europe/Brussels -false Europe/Bucharest -false Europe/Budapest -false Europe/Busingen -false Europe/Chisinau -false Europe/Copenhagen -true Europe/Dublin -false Europe/Gibraltar -false Europe/Guernsey -false Europe/Helsinki -false Europe/Isle_of_Man -false Europe/Istanbul -false Europe/Jersey -false Europe/Kaliningrad -false Europe/Kiev -false Europe/Kirov -false Europe/Kyiv -false Europe/Lisbon -false Europe/Ljubljana -false Europe/London -false Europe/Luxembourg -false Europe/Madrid -false Europe/Malta -false Europe/Mariehamn -false Europe/Minsk -false Europe/Monaco -false Europe/Moscow -false Europe/Nicosia -false Europe/Oslo -false Europe/Paris -false Europe/Podgorica -false Europe/Prague -false Europe/Riga -false Europe/Rome -false Europe/Samara -false Europe/San_Marino -false Europe/Sarajevo -false Europe/Saratov -false Europe/Simferopol -false Europe/Skopje -false Europe/Sofia -false Europe/Stockholm -false Europe/Tallinn -false Europe/Tirane -false Europe/Tiraspol -false Europe/Ulyanovsk -false Europe/Uzhgorod -false Europe/Vaduz -false Europe/Vatican -false Europe/Vienna -false Europe/Vilnius -false Europe/Volgograd -false Europe/Warsaw -false Europe/Zagreb -false Europe/Zaporozhye -false Europe/Zurich -false FET -true FJST -false FJT -false FKST -false FKT -true FNST -false FNT -false Factory -false GALT -false GAMT -false GB -false GB-Eire -false GEST -false GET -false GFT -false GILT -false GMT -false GMT+0 -false GMT-0 -false GMT0 -false GYT -false Greenwich -false HKT -false HST -false Hongkong -false ICT -true IDT -false IOT -false IRKST -false IRKT -false IRT -false IST -false Iceland -false Indian/Antananarivo -false Indian/Chagos -false Indian/Christmas -false Indian/Cocos -false Indian/Comoro -false Indian/Kerguelen -false Indian/Mahe -false Indian/Maldives -false Indian/Mauritius -false Indian/Mayotte -false Indian/Reunion -false Iran -false Israel -false JAYT -false JST -false Jamaica -false Japan -true KDT -true KGST -false KGT -false KOST -false KRAST -false KRAT -false KST -false Kwajalein -true LHDT -false LHST -false LIGT -false LINT -false LKT -false Libya -false MAGST -false MAGT -false MART -false MAWT -true MDT -true MEST -true MESZ -false MET -true METDST -false MEZ -false MHT -false MMT -false MPT -true MSD -false MSK -false MST -false MST7MDT -true MUST -false MUT -false MVT -false MYT -false Mexico/BajaNorte -false Mexico/BajaSur -false Mexico/General -true NDT -false NFT -false NOVST -false NOVT -false NPT -false NST -false NUT -true NZ -true NZ-CHAT -true NZDT -false NZST -false NZT -false Navajo -false OMSST -false OMST -true PDT -false PET -false PETST -false PETT -false PGT -false PHT -true PKST -false PKT -true PMDT -false PMST -false PONT -false PRC -false PST -false PST8PDT -false PWT -true PYST -true PYT -false Pacific/Apia -true Pacific/Auckland -false Pacific/Bougainville -true Pacific/Chatham -false Pacific/Chuuk -true Pacific/Easter -false Pacific/Efate -false Pacific/Enderbury -false Pacific/Fakaofo -false Pacific/Fiji -false Pacific/Funafuti -false Pacific/Galapagos -false Pacific/Gambier -false Pacific/Guadalcanal -false Pacific/Guam -false Pacific/Honolulu -false Pacific/Johnston -false Pacific/Kanton -false Pacific/Kiritimati -false Pacific/Kosrae -false Pacific/Kwajalein -false Pacific/Majuro -false Pacific/Marquesas -false Pacific/Midway -false Pacific/Nauru -false Pacific/Niue -true Pacific/Norfolk -false Pacific/Noumea -false Pacific/Pago_Pago -false Pacific/Palau -false Pacific/Pitcairn -false Pacific/Pohnpei -false Pacific/Ponape -false Pacific/Port_Moresby -false Pacific/Rarotonga -false Pacific/Saipan -false Pacific/Samoa -false Pacific/Tahiti -false Pacific/Tarawa -false Pacific/Tongatapu -false Pacific/Truk -false Pacific/Wake -false Pacific/Wallis -false Pacific/Yap -false Poland -false Portugal -false RET -false ROC -false ROK -true SADT -false SAST -false SCT -false SGT -false Singapore -false TAHT -false TFT -false TJT -false TKT -false TMT -false TOT -false TRUT -false TVT -false Turkey -false UCT -true ULAST -false ULAT -false US/Alaska -false US/Aleutian -false US/Arizona -false US/Central -false US/East-Indiana -false US/Eastern -false US/Hawaii -false US/Indiana-Starke -false US/Michigan -false US/Mountain -false US/Pacific -false US/Samoa -false UT -false UTC -true UYST -false UYT -true UZST -false UZT -false Universal -false VET -false VLAST -false VLAT -false VOLT -false VUT -false W-SU -true WADT -false WAKT -false WAST -false WAT -true WDT -false WET -true WETDST -false WFT -true WGST -false WGT -false XJT -false YAKST -false YAKT -false YAPT -true YEKST -false YEKT -false Z -false Zulu - - - - 16384 - kiem - - - 1 - 11||10|C|G -11||-9223372036854775808|U|G -11||10|U|G -2200||-9223372036854775808|C|G -2200||10|C|G -2200||-9223372036854775808|U|G -2200||10|U|G -13722||10|C|G -13722||-9223372036854775808|U|G -13722||10|U|G - 676242 - 16457 - kiem - - - default administrative connection database - 14088 - kiem - - - 1 - 1 - 1 - 1 - 10 - 1 - 1 - - - 6171 - - - 4571 - - - 3373 - 3374 -3375 -3377 - - - 6181 - - - 3374 - - - 3375 - - - 4569 - - - 4200 - - - 3377 - - - 6182 - - - 4570 - - - 1663 - 1 - kiem - - - 1664 - 1 - kiem - - - block range index (BRIN) access method - 3580 - 1 - index - 335 - brinhandler - pg_catalog - - - b-tree index access method - 403 - 1 - index - 330 - bthandler - pg_catalog - - - GIN index access method - 2742 - 1 - index - 333 - ginhandler - pg_catalog - - - GiST index access method - 783 - 1 - index - 332 - gisthandler - pg_catalog - - - hash index access method - 405 - 1 - index - 331 - hashhandler - pg_catalog - - - heap table access method - 2 - 1 - table - 3 - heap_tableam_handler - pg_catalog - - - SP-GiST index access method - 4000 - 1 - index - 334 - spghandler - pg_catalog - - - assignment - function - 10202 - 1 - 2971 - text - pg_catalog - 16 - bool - pg_catalog - 1042 - bpchar - pg_catalog - - - explicit - function - 10035 - 1 - 2558 - int4 - pg_catalog - 16 - bool - pg_catalog - 23 - int4 - pg_catalog - - - assignment - function - 10197 - 1 - 2971 - text - pg_catalog - 16 - bool - pg_catalog - 1043 - varchar - pg_catalog - - - assignment - function - 10192 - 1 - 2971 - text - pg_catalog - 16 - bool - pg_catalog - 25 - text - pg_catalog - - - assignment - function - 10133 - 1 - 946 - text - pg_catalog - 18 - char - pg_catalog - 1043 - varchar - pg_catalog - - - explicit - function - 10143 - 1 - 77 - int4 - pg_catalog - 18 - char - pg_catalog - 23 - int4 - pg_catalog - - - assignment - function - 10132 - 1 - 860 - bpchar - pg_catalog - 18 - char - pg_catalog - 1042 - bpchar - pg_catalog - - - implicit - function - 10131 - 1 - 946 - text - pg_catalog - 18 - char - pg_catalog - 25 - text - pg_catalog - - - assignment - function - 10135 - 1 - 408 - bpchar - pg_catalog - 19 - name - pg_catalog - 1042 - bpchar - pg_catalog - - - assignment - function - 10136 - 1 - 1401 - varchar - pg_catalog - 19 - name - pg_catalog - 1043 - varchar - pg_catalog - - - implicit - function - 10134 - 1 - 406 - text - pg_catalog - 19 - name - pg_catalog - 25 - text - pg_catalog - - - implicit - function - 10097 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 3734 - regconfig - pg_catalog - - - implicit - function - 10083 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 4191 - regcollation - pg_catalog - - - implicit - function - 10090 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 2206 - regtype - pg_catalog - - - assignment - function - 10033 - 1 - 3812 - money - pg_catalog - 20 - int8 - pg_catalog - 790 - money - pg_catalog - - - implicit - function - 10002 - 1 - 652 - float4 - pg_catalog - 20 - int8 - pg_catalog - 700 - float4 - pg_catalog - - - implicit - function - 10076 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 2205 - regclass - pg_catalog - - - implicit - function - 10113 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 4096 - regrole - pg_catalog - - - implicit - function - 10069 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 2204 - regoperator - pg_catalog - - - implicit - function - 10060 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 2203 - regoper - pg_catalog - - - implicit - function - 10120 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 4089 - regnamespace - pg_catalog - - - assignment - function - 10000 - 1 - 714 - int2 - pg_catalog - 20 - int8 - pg_catalog - 21 - int2 - pg_catalog - - - implicit - function - 10053 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 2202 - regprocedure - pg_catalog - - - explicit - function - 10186 - 1 - 2075 - bit - pg_catalog - 20 - int8 - pg_catalog - 1560 - bit - pg_catalog - - - implicit - function - 10044 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 24 - regproc - pg_catalog - - - assignment - function - 10001 - 1 - 480 - int4 - pg_catalog - 20 - int8 - pg_catalog - 23 - int4 - pg_catalog - - - implicit - function - 10004 - 1 - 1781 - numeric - pg_catalog - 20 - int8 - pg_catalog - 1700 - numeric - pg_catalog - - - implicit - function - 10104 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 3769 - regdictionary - pg_catalog - - - implicit - function - 10037 - 1 - 1287 - oid - pg_catalog - 20 - int8 - pg_catalog - 26 - oid - pg_catalog - - - implicit - function - 10003 - 1 - 482 - float8 - pg_catalog - 20 - int8 - pg_catalog - 701 - float8 - pg_catalog - - - implicit - function - 10038 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 26 - oid - pg_catalog - - - implicit - function - 10114 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 4096 - regrole - pg_catalog - - - implicit - function - 10121 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 4089 - regnamespace - pg_catalog - - - implicit - function - 10105 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 3769 - regdictionary - pg_catalog - - - implicit - function - 10098 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 3734 - regconfig - pg_catalog - - - implicit - function - 10091 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 2206 - regtype - pg_catalog - - - implicit - function - 10077 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 2205 - regclass - pg_catalog - - - implicit - function - 10070 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 2204 - regoperator - pg_catalog - - - implicit - function - 10005 - 1 - 754 - int8 - pg_catalog - 21 - int2 - pg_catalog - 20 - int8 - pg_catalog - - - implicit - function - 10061 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 2203 - regoper - pg_catalog - - - implicit - function - 10054 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 2202 - regprocedure - pg_catalog - - - implicit - function - 10006 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 23 - int4 - pg_catalog - - - implicit - function - 10009 - 1 - 1782 - numeric - pg_catalog - 21 - int2 - pg_catalog - 1700 - numeric - pg_catalog - - - implicit - function - 10084 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 4191 - regcollation - pg_catalog - - - implicit - function - 10045 - 1 - 313 - int4 - pg_catalog - 21 - int2 - pg_catalog - 24 - regproc - pg_catalog - - - implicit - function - 10008 - 1 - 235 - float8 - pg_catalog - 21 - int2 - pg_catalog - 701 - float8 - pg_catalog - - - implicit - function - 10007 - 1 - 236 - float4 - pg_catalog - 21 - int2 - pg_catalog - 700 - float4 - pg_catalog - - - assignment - function - 10011 - 1 - 314 - int2 - pg_catalog - 23 - int4 - pg_catalog - 21 - int2 - pg_catalog - - - implicit - binary - 10062 - 1 - 23 - int4 - pg_catalog - 2203 - regoper - pg_catalog - - - implicit - binary - 10071 - 1 - 23 - int4 - pg_catalog - 2204 - regoperator - pg_catalog - - - implicit - binary - 10078 - 1 - 23 - int4 - pg_catalog - 2205 - regclass - pg_catalog - - - implicit - binary - 10092 - 1 - 23 - int4 - pg_catalog - 2206 - regtype - pg_catalog - - - implicit - function - 10010 - 1 - 481 - int8 - pg_catalog - 23 - int4 - pg_catalog - 20 - int8 - pg_catalog - - - explicit - function - 10034 - 1 - 2557 - bool - pg_catalog - 23 - int4 - pg_catalog - 16 - bool - pg_catalog - - - assignment - function - 10032 - 1 - 3811 - money - pg_catalog - 23 - int4 - pg_catalog - 790 - money - pg_catalog - - - implicit - binary - 10099 - 1 - 23 - int4 - pg_catalog - 3734 - regconfig - pg_catalog - - - implicit - binary - 10106 - 1 - 23 - int4 - pg_catalog - 3769 - regdictionary - pg_catalog - - - implicit - function - 10013 - 1 - 316 - float8 - pg_catalog - 23 - int4 - pg_catalog - 701 - float8 - pg_catalog - - - implicit - function - 10012 - 1 - 318 - float4 - pg_catalog - 23 - int4 - pg_catalog - 700 - float4 - pg_catalog - - - implicit - binary - 10046 - 1 - 23 - int4 - pg_catalog - 24 - regproc - pg_catalog - - - implicit - binary - 10085 - 1 - 23 - int4 - pg_catalog - 4191 - regcollation - pg_catalog - - - implicit - binary - 10122 - 1 - 23 - int4 - pg_catalog - 4089 - regnamespace - pg_catalog - - - implicit - binary - 10039 - 1 - 23 - int4 - pg_catalog - 26 - oid - pg_catalog - - - implicit - binary - 10115 - 1 - 23 - int4 - pg_catalog - 4096 - regrole - pg_catalog - - - implicit - function - 10014 - 1 - 1740 - numeric - pg_catalog - 23 - int4 - pg_catalog - 1700 - numeric - pg_catalog - - - implicit - binary - 10055 - 1 - 23 - int4 - pg_catalog - 2202 - regprocedure - pg_catalog - - - explicit - function - 10144 - 1 - 78 - char - pg_catalog - 23 - int4 - pg_catalog - 18 - char - pg_catalog - - - explicit - function - 10187 - 1 - 1683 - bit - pg_catalog - 23 - int4 - pg_catalog - 1560 - bit - pg_catalog - - - implicit - binary - 10043 - 1 - 24 - regproc - pg_catalog - 26 - oid - pg_catalog - - - assignment - function - 10047 - 1 - 1288 - int8 - pg_catalog - 24 - regproc - pg_catalog - 20 - int8 - pg_catalog - - - assignment - binary - 10048 - 1 - 24 - regproc - pg_catalog - 23 - int4 - pg_catalog - - - implicit - binary - 10049 - 1 - 24 - regproc - pg_catalog - 2202 - regprocedure - pg_catalog - - - implicit - binary - 10125 - 1 - 25 - text - pg_catalog - 1042 - bpchar - pg_catalog - - - assignment - function - 10137 - 1 - 944 - char - pg_catalog - 25 - text - pg_catalog - 18 - char - pg_catalog - - - implicit - function - 10140 - 1 - 407 - name - pg_catalog - 25 - text - pg_catalog - 19 - name - pg_catalog - - - explicit - function - 10194 - 1 - 2896 - xml - pg_catalog - 25 - text - pg_catalog - 142 - xml - pg_catalog - - - implicit - function - 10109 - 1 - 1079 - regclass - pg_catalog - 25 - text - pg_catalog - 2205 - regclass - pg_catalog - - - implicit - binary - 10126 - 1 - 25 - text - pg_catalog - 1043 - varchar - pg_catalog - - - implicit - binary - 10095 - 1 - 26 - oid - pg_catalog - 3734 - regconfig - pg_catalog - - - implicit - binary - 10088 - 1 - 26 - oid - pg_catalog - 2206 - regtype - pg_catalog - - - implicit - binary - 10074 - 1 - 26 - oid - pg_catalog - 2205 - regclass - pg_catalog - - - implicit - binary - 10067 - 1 - 26 - oid - pg_catalog - 2204 - regoperator - pg_catalog - - - implicit - binary - 10058 - 1 - 26 - oid - pg_catalog - 2203 - regoper - pg_catalog - - - implicit - binary - 10051 - 1 - 26 - oid - pg_catalog - 2202 - regprocedure - pg_catalog - - - assignment - binary - 10041 - 1 - 26 - oid - pg_catalog - 23 - int4 - pg_catalog - - - implicit - binary - 10042 - 1 - 26 - oid - pg_catalog - 24 - regproc - pg_catalog - - - implicit - binary - 10081 - 1 - 26 - oid - pg_catalog - 4191 - regcollation - pg_catalog - - - implicit - binary - 10111 - 1 - 26 - oid - pg_catalog - 4096 - regrole - pg_catalog - - - implicit - binary - 10118 - 1 - 26 - oid - pg_catalog - 4089 - regnamespace - pg_catalog - - - implicit - binary - 10102 - 1 - 26 - oid - pg_catalog - 3769 - regdictionary - pg_catalog - - - assignment - function - 10040 - 1 - 1288 - int8 - pg_catalog - 26 - oid - pg_catalog - 20 - int8 - pg_catalog - - - assignment - io - 10215 - 1 - 114 - json - pg_catalog - 3802 - jsonb - pg_catalog - - - assignment - binary - 10198 - 1 - 142 - xml - pg_catalog - 1043 - varchar - pg_catalog - - - assignment - binary - 10193 - 1 - 142 - xml - pg_catalog - 25 - text - pg_catalog - - - assignment - binary - 10203 - 1 - 142 - xml - pg_catalog - 1042 - bpchar - pg_catalog - - - implicit - binary - 10145 - 1 - 194 - pg_node_tree - pg_catalog - 25 - text - pg_catalog - - - assignment - function - 10165 - 1 - 4091 - box - pg_catalog - 600 - point - pg_catalog - 603 - box - pg_catalog - - - explicit - function - 10166 - 1 - 1532 - point - pg_catalog - 601 - lseg - pg_catalog - 600 - point - pg_catalog - - - assignment - function - 10168 - 1 - 1449 - polygon - pg_catalog - 602 - path - pg_catalog - 604 - polygon - pg_catalog - - - explicit - function - 10167 - 1 - 1533 - point - pg_catalog - 602 - path - pg_catalog - 600 - point - pg_catalog - - - explicit - function - 10170 - 1 - 1541 - lseg - pg_catalog - 603 - box - pg_catalog - 601 - lseg - pg_catalog - - - explicit - function - 10169 - 1 - 1534 - point - pg_catalog - 603 - box - pg_catalog - 600 - point - pg_catalog - - - explicit - function - 10172 - 1 - 1479 - circle - pg_catalog - 603 - box - pg_catalog - 718 - circle - pg_catalog - - - assignment - function - 10171 - 1 - 1448 - polygon - pg_catalog - 603 - box - pg_catalog - 604 - polygon - pg_catalog - - - explicit - function - 10173 - 1 - 1540 - point - pg_catalog - 604 - polygon - pg_catalog - 600 - point - pg_catalog - - - assignment - function - 10174 - 1 - 1447 - path - pg_catalog - 604 - polygon - pg_catalog - 602 - path - pg_catalog - - - explicit - function - 10176 - 1 - 1474 - circle - pg_catalog - 604 - polygon - pg_catalog - 718 - circle - pg_catalog - - - explicit - function - 10175 - 1 - 1446 - box - pg_catalog - 604 - polygon - pg_catalog - 603 - box - pg_catalog - - - implicit - binary - 10182 - 1 - 650 - cidr - pg_catalog - 869 - inet - pg_catalog - - - assignment - function - 10190 - 1 - 730 - text - pg_catalog - 650 - cidr - pg_catalog - 25 - text - pg_catalog - - - assignment - function - 10195 - 1 - 730 - text - pg_catalog - 650 - cidr - pg_catalog - 1043 - varchar - pg_catalog - - - assignment - function - 10200 - 1 - 730 - text - pg_catalog - 650 - cidr - pg_catalog - 1042 - bpchar - pg_catalog - - - implicit - function - 10018 - 1 - 311 - float8 - pg_catalog - 700 - float4 - pg_catalog - 701 - float8 - pg_catalog - - - assignment - function - 10016 - 1 - 238 - int2 - pg_catalog - 700 - float4 - pg_catalog - 21 - int2 - pg_catalog - - - assignment - function - 10015 - 1 - 653 - int8 - pg_catalog - 700 - float4 - pg_catalog - 20 - int8 - pg_catalog - - - assignment - function - 10019 - 1 - 1742 - numeric - pg_catalog - 700 - float4 - pg_catalog - 1700 - numeric - pg_catalog - - - assignment - function - 10017 - 1 - 319 - int4 - pg_catalog - 700 - float4 - pg_catalog - 23 - int4 - pg_catalog - - - assignment - function - 10023 - 1 - 312 - float4 - pg_catalog - 701 - float8 - pg_catalog - 700 - float4 - pg_catalog - - - assignment - function - 10020 - 1 - 483 - int8 - pg_catalog - 701 - float8 - pg_catalog - 20 - int8 - pg_catalog - - - assignment - function - 10024 - 1 - 1743 - numeric - pg_catalog - 701 - float8 - pg_catalog - 1700 - numeric - pg_catalog - - - assignment - function - 10022 - 1 - 317 - int4 - pg_catalog - 701 - float8 - pg_catalog - 23 - int4 - pg_catalog - - - assignment - function - 10021 - 1 - 237 - int2 - pg_catalog - 701 - float8 - pg_catalog - 21 - int2 - pg_catalog - - - explicit - function - 10177 - 1 - 1416 - point - pg_catalog - 718 - circle - pg_catalog - 600 - point - pg_catalog - - - explicit - function - 10179 - 1 - 1544 - polygon - pg_catalog - 718 - circle - pg_catalog - 604 - polygon - pg_catalog - - - explicit - function - 10178 - 1 - 1480 - box - pg_catalog - 718 - circle - pg_catalog - 603 - box - pg_catalog - - - implicit - function - 10181 - 1 - 4124 - macaddr - pg_catalog - 774 - macaddr8 - pg_catalog - 829 - macaddr - pg_catalog - - - assignment - function - 10030 - 1 - 3823 - numeric - pg_catalog - 790 - money - pg_catalog - 1700 - numeric - pg_catalog - - - implicit - function - 10180 - 1 - 4123 - macaddr8 - pg_catalog - 829 - macaddr - pg_catalog - 774 - macaddr8 - pg_catalog - - - assignment - function - 10191 - 1 - 730 - text - pg_catalog - 869 - inet - pg_catalog - 25 - text - pg_catalog - - - assignment - function - 10183 - 1 - 1715 - cidr - pg_catalog - 869 - inet - pg_catalog - 650 - cidr - pg_catalog - - - assignment - function - 10201 - 1 - 730 - text - pg_catalog - 869 - inet - pg_catalog - 1042 - bpchar - pg_catalog - - - assignment - function - 10196 - 1 - 730 - text - pg_catalog - 869 - inet - pg_catalog - 1043 - varchar - pg_catalog - - - implicit - function - 10205 - 1 - 668 - bpchar - pg_catalog - 1042 - bpchar - pg_catalog - 1042 - bpchar - pg_catalog - - - assignment - function - 10138 - 1 - 944 - char - pg_catalog - 1042 - bpchar - pg_catalog - 18 - char - pg_catalog - - - implicit - function - 10127 - 1 - 401 - text - pg_catalog - 1042 - bpchar - pg_catalog - 25 - text - pg_catalog - - - explicit - function - 10204 - 1 - 2896 - xml - pg_catalog - 1042 - bpchar - pg_catalog - 142 - xml - pg_catalog - - - implicit - function - 10141 - 1 - 409 - name - pg_catalog - 1042 - bpchar - pg_catalog - 19 - name - pg_catalog - - - implicit - function - 10128 - 1 - 401 - text - pg_catalog - 1042 - bpchar - pg_catalog - 1043 - varchar - pg_catalog - - - implicit - function - 10206 - 1 - 669 - varchar - pg_catalog - 1043 - varchar - pg_catalog - 1043 - varchar - pg_catalog - - - implicit - binary - 10130 - 1 - 1043 - varchar - pg_catalog - 1042 - bpchar - pg_catalog - - - implicit - function - 10110 - 1 - 1079 - regclass - pg_catalog - 1043 - varchar - pg_catalog - 2205 - regclass - pg_catalog - - - implicit - binary - 10129 - 1 - 1043 - varchar - pg_catalog - 25 - text - pg_catalog - - - implicit - function - 10142 - 1 - 1400 - name - pg_catalog - 1043 - varchar - pg_catalog - 19 - name - pg_catalog - - - explicit - function - 10199 - 1 - 2896 - xml - pg_catalog - 1043 - varchar - pg_catalog - 142 - xml - pg_catalog - - - assignment - function - 10139 - 1 - 944 - char - pg_catalog - 1043 - varchar - pg_catalog - 18 - char - pg_catalog - - - implicit - function - 10152 - 1 - 2024 - timestamp - pg_catalog - 1082 - date - pg_catalog - 1114 - timestamp - pg_catalog - - - implicit - function - 10153 - 1 - 1174 - timestamptz - pg_catalog - 1082 - date - pg_catalog - 1184 - timestamptz - pg_catalog - - - implicit - function - 10207 - 1 - 1968 - time - pg_catalog - 1083 - time - pg_catalog - 1083 - time - pg_catalog - - - implicit - function - 10155 - 1 - 2047 - timetz - pg_catalog - 1083 - time - pg_catalog - 1266 - timetz - pg_catalog - - - implicit - function - 10154 - 1 - 1370 - interval - pg_catalog - 1083 - time - pg_catalog - 1186 - interval - pg_catalog - - - implicit - function - 10208 - 1 - 1961 - timestamp - pg_catalog - 1114 - timestamp - pg_catalog - 1114 - timestamp - pg_catalog - - - assignment - function - 10156 - 1 - 2029 - date - pg_catalog - 1114 - timestamp - pg_catalog - 1082 - date - pg_catalog - - - assignment - function - 10157 - 1 - 1316 - time - pg_catalog - 1114 - timestamp - pg_catalog - 1083 - time - pg_catalog - - - implicit - function - 10158 - 1 - 2028 - timestamptz - pg_catalog - 1114 - timestamp - pg_catalog - 1184 - timestamptz - pg_catalog - - - assignment - function - 10162 - 1 - 1388 - timetz - pg_catalog - 1184 - timestamptz - pg_catalog - 1266 - timetz - pg_catalog - - - assignment - function - 10159 - 1 - 1178 - date - pg_catalog - 1184 - timestamptz - pg_catalog - 1082 - date - pg_catalog - - - assignment - function - 10160 - 1 - 2019 - time - pg_catalog - 1184 - timestamptz - pg_catalog - 1083 - time - pg_catalog - - - assignment - function - 10161 - 1 - 2027 - timestamp - pg_catalog - 1184 - timestamptz - pg_catalog - 1114 - timestamp - pg_catalog - - - implicit - function - 10209 - 1 - 1967 - timestamptz - pg_catalog - 1184 - timestamptz - pg_catalog - 1184 - timestamptz - pg_catalog - - - implicit - function - 10210 - 1 - 1200 - interval - pg_catalog - 1186 - interval - pg_catalog - 1186 - interval - pg_catalog - - - assignment - function - 10163 - 1 - 1419 - time - pg_catalog - 1186 - interval - pg_catalog - 1083 - time - pg_catalog - - - assignment - function - 10164 - 1 - 2046 - time - pg_catalog - 1266 - timetz - pg_catalog - 1083 - time - pg_catalog - - - implicit - function - 10211 - 1 - 1969 - timetz - pg_catalog - 1266 - timetz - pg_catalog - 1266 - timetz - pg_catalog - - - implicit - binary - 10184 - 1 - 1560 - bit - pg_catalog - 1562 - varbit - pg_catalog - - - explicit - function - 10188 - 1 - 2076 - int8 - pg_catalog - 1560 - bit - pg_catalog - 20 - int8 - pg_catalog - - - explicit - function - 10189 - 1 - 1684 - int4 - pg_catalog - 1560 - bit - pg_catalog - 23 - int4 - pg_catalog - - - implicit - function - 10212 - 1 - 1685 - bit - pg_catalog - 1560 - bit - pg_catalog - 1560 - bit - pg_catalog - - - implicit - binary - 10185 - 1 - 1562 - varbit - pg_catalog - 1560 - bit - pg_catalog - - - implicit - function - 10213 - 1 - 1687 - varbit - pg_catalog - 1562 - varbit - pg_catalog - 1562 - varbit - pg_catalog - - - assignment - function - 10031 - 1 - 3824 - money - pg_catalog - 1700 - numeric - pg_catalog - 790 - money - pg_catalog - - - assignment - function - 10026 - 1 - 1783 - int2 - pg_catalog - 1700 - numeric - pg_catalog - 21 - int2 - pg_catalog - - - implicit - function - 10028 - 1 - 1745 - float4 - pg_catalog - 1700 - numeric - pg_catalog - 700 - float4 - pg_catalog - - - implicit - function - 10029 - 1 - 1746 - float8 - pg_catalog - 1700 - numeric - pg_catalog - 701 - float8 - pg_catalog - - - assignment - function - 10027 - 1 - 1744 - int4 - pg_catalog - 1700 - numeric - pg_catalog - 23 - int4 - pg_catalog - - - assignment - function - 10025 - 1 - 1779 - int8 - pg_catalog - 1700 - numeric - pg_catalog - 20 - int8 - pg_catalog - - - implicit - function - 10214 - 1 - 1703 - numeric - pg_catalog - 1700 - numeric - pg_catalog - 1700 - numeric - pg_catalog - - - assignment - function - 10056 - 1 - 1288 - int8 - pg_catalog - 2202 - regprocedure - pg_catalog - 20 - int8 - pg_catalog - - - assignment - binary - 10057 - 1 - 2202 - regprocedure - pg_catalog - 23 - int4 - pg_catalog - - - implicit - binary - 10050 - 1 - 2202 - regprocedure - pg_catalog - 24 - regproc - pg_catalog - - - implicit - binary - 10052 - 1 - 2202 - regprocedure - pg_catalog - 26 - oid - pg_catalog - - - assignment - function - 10063 - 1 - 1288 - int8 - pg_catalog - 2203 - regoper - pg_catalog - 20 - int8 - pg_catalog - - - implicit - binary - 10059 - 1 - 2203 - regoper - pg_catalog - 26 - oid - pg_catalog - - - implicit - binary - 10065 - 1 - 2203 - regoper - pg_catalog - 2204 - regoperator - pg_catalog - - - assignment - binary - 10064 - 1 - 2203 - regoper - pg_catalog - 23 - int4 - pg_catalog - - - implicit - binary - 10068 - 1 - 2204 - regoperator - pg_catalog - 26 - oid - pg_catalog - - - assignment - function - 10072 - 1 - 1288 - int8 - pg_catalog - 2204 - regoperator - pg_catalog - 20 - int8 - pg_catalog - - - assignment - binary - 10073 - 1 - 2204 - regoperator - pg_catalog - 23 - int4 - pg_catalog - - - implicit - binary - 10066 - 1 - 2204 - regoperator - pg_catalog - 2203 - regoper - pg_catalog - - - assignment - binary - 10080 - 1 - 2205 - regclass - pg_catalog - 23 - int4 - pg_catalog - - - implicit - binary - 10075 - 1 - 2205 - regclass - pg_catalog - 26 - oid - pg_catalog - - - assignment - function - 10079 - 1 - 1288 - int8 - pg_catalog - 2205 - regclass - pg_catalog - 20 - int8 - pg_catalog - - - assignment - function - 10093 - 1 - 1288 - int8 - pg_catalog - 2206 - regtype - pg_catalog - 20 - int8 - pg_catalog - - - assignment - binary - 10094 - 1 - 2206 - regtype - pg_catalog - 23 - int4 - pg_catalog - - - implicit - binary - 10089 - 1 - 2206 - regtype - pg_catalog - 26 - oid - pg_catalog - - - implicit - io - 10147 - 1 - 3361 - pg_ndistinct - pg_catalog - 25 - text - pg_catalog - - - implicit - binary - 10146 - 1 - 3361 - pg_ndistinct - pg_catalog - 17 - bytea - pg_catalog - - - implicit - io - 10149 - 1 - 3402 - pg_dependencies - pg_catalog - 25 - text - pg_catalog - - - implicit - binary - 10148 - 1 - 3402 - pg_dependencies - pg_catalog - 17 - bytea - pg_catalog - - - assignment - function - 10100 - 1 - 1288 - int8 - pg_catalog - 3734 - regconfig - pg_catalog - 20 - int8 - pg_catalog - - - assignment - binary - 10101 - 1 - 3734 - regconfig - pg_catalog - 23 - int4 - pg_catalog - - - implicit - binary - 10096 - 1 - 3734 - regconfig - pg_catalog - 26 - oid - pg_catalog - - - implicit - binary - 10103 - 1 - 3769 - regdictionary - pg_catalog - 26 - oid - pg_catalog - - - assignment - function - 10107 - 1 - 1288 - int8 - pg_catalog - 3769 - regdictionary - pg_catalog - 20 - int8 - pg_catalog - - - assignment - binary - 10108 - 1 - 3769 - regdictionary - pg_catalog - 23 - int4 - pg_catalog - - - explicit - function - 10218 - 1 - 3449 - numeric - pg_catalog - 3802 - jsonb - pg_catalog - 1700 - numeric - pg_catalog - - - explicit - function - 10223 - 1 - 2580 - float8 - pg_catalog - 3802 - jsonb - pg_catalog - 701 - float8 - pg_catalog - - - explicit - function - 10217 - 1 - 3556 - bool - pg_catalog - 3802 - jsonb - pg_catalog - 16 - bool - pg_catalog - - - explicit - function - 10222 - 1 - 3453 - float4 - pg_catalog - 3802 - jsonb - pg_catalog - 700 - float4 - pg_catalog - - - explicit - function - 10219 - 1 - 3450 - int2 - pg_catalog - 3802 - jsonb - pg_catalog - 21 - int2 - pg_catalog - - - explicit - function - 10220 - 1 - 3451 - int4 - pg_catalog - 3802 - jsonb - pg_catalog - 23 - int4 - pg_catalog - - - assignment - io - 10216 - 1 - 3802 - jsonb - pg_catalog - 114 - json - pg_catalog - - - explicit - function - 10221 - 1 - 3452 - int8 - pg_catalog - 3802 - jsonb - pg_catalog - 20 - int8 - pg_catalog - - - explicit - function - 10224 - 1 - 4281 - int4multirange - pg_catalog - 3904 - int4range - pg_catalog - 4451 - int4multirange - pg_catalog - - - explicit - function - 10226 - 1 - 4284 - nummultirange - pg_catalog - 3906 - numrange - pg_catalog - 4532 - nummultirange - pg_catalog - - - explicit - function - 10228 - 1 - 4287 - tsmultirange - pg_catalog - 3908 - tsrange - pg_catalog - 4533 - tsmultirange - pg_catalog - - - explicit - function - 10229 - 1 - 4290 - tstzmultirange - pg_catalog - 3910 - tstzrange - pg_catalog - 4534 - tstzmultirange - pg_catalog - - - explicit - function - 10227 - 1 - 4293 - datemultirange - pg_catalog - 3912 - daterange - pg_catalog - 4535 - datemultirange - pg_catalog - - - explicit - function - 10225 - 1 - 4296 - int8multirange - pg_catalog - 3926 - int8range - pg_catalog - 4536 - int8multirange - pg_catalog - - - assignment - binary - 10124 - 1 - 4089 - regnamespace - pg_catalog - 23 - int4 - pg_catalog - - - assignment - function - 10123 - 1 - 1288 - int8 - pg_catalog - 4089 - regnamespace - pg_catalog - 20 - int8 - pg_catalog - - - implicit - binary - 10119 - 1 - 4089 - regnamespace - pg_catalog - 26 - oid - pg_catalog - - - implicit - binary - 10112 - 1 - 4096 - regrole - pg_catalog - 26 - oid - pg_catalog - - - assignment - function - 10116 - 1 - 1288 - int8 - pg_catalog - 4096 - regrole - pg_catalog - 20 - int8 - pg_catalog - - - assignment - binary - 10117 - 1 - 4096 - regrole - pg_catalog - 23 - int4 - pg_catalog - - - implicit - binary - 10082 - 1 - 4191 - regcollation - pg_catalog - 26 - oid - pg_catalog - - - assignment - function - 10086 - 1 - 1288 - int8 - pg_catalog - 4191 - regcollation - pg_catalog - 20 - int8 - pg_catalog - - - assignment - binary - 10087 - 1 - 4191 - regcollation - pg_catalog - 23 - int4 - pg_catalog - - - implicit - binary - 10150 - 1 - 5017 - pg_mcv_list - pg_catalog - 17 - bytea - pg_catalog - - - implicit - io - 10151 - 1 - 5017 - pg_mcv_list - pg_catalog - 25 - text - pg_catalog - - - explicit - function - 10036 - 1 - 5071 - xid - pg_catalog - 5069 - xid8 - pg_catalog - 28 - xid - pg_catalog - - - PL/pgSQL procedural language - 14074 - 686 - 1.0 - 11 - pg_catalog - 14075 -14076 -14077 -14078 - - - dynamically-loaded C functions - 13 - 1 - fmgr_c_validator - pg_catalog - - - built-in functions - 12 - 1 - fmgr_internal_validator - pg_catalog - - - PL/pgSQL procedural language - plpgsql_call_handler - pg_catalog - plpgsql_inline_handler - pg_catalog - 14078 - 686 - 1 - plpgsql_validator - pg_catalog - - - SQL-language functions - 14 - 1 - 1 - fmgr_sql_validator - pg_catalog - - - 13722 - 532 - kiem - - - system catalog schema - 11 - 525 - kiem - - - standard public schema - 1 - 676242 - 2024-11-05.16:07:50 - 2200 - 526 - kiem - - - integer|0s - 22874 - 1 - 1 - 676202 - kiem - - - integer|0s - 22864 - 1 - 1 - 676201 - kiem - - - integer|0s - 22848 - 1 - 1 - 676200 - kiem - - - 22978 - 676209 - 2 - kiem -
- - 22898 - 676203 - 2 - kiem -
- - 22915 - 676204 - 2 - kiem -
- - 22841 - 676200 - 2 - kiem -
- - 22937 - 676207 - 2 - kiem -
- - 22930 - 676207 - 2 - kiem -
- - 22944 - 676207 - 2 - kiem -
- - 22875 - 676202 - 2 - kiem -
- - 22961 - 676208 - 2 - kiem -
- - 22865 - 676202 - 2 - kiem -
- - 22849 - 676200 - 2 - kiem -
- - numeric|0s - 1 - 1 - 676209 - 1700 - - - varchar(99)|0s - 1 - 2 - 676209 - 1043 - - - numeric|0s - 3 - 676209 - 1700 - - - img_char - 1 - 22985 - 676209 - 1 - 22841 - - - id_char - 1 - 22983 - 1 - 676209 - 1 - 403 - - - 1 - 22984 - 1 - 676209 - 22983 - - - numeric|0s - 1 - 1 - 676203 - 1700 - - - text|0s - 1 - 2 - 676203 - 25 - - - date|0s - 1 - 3 - 676203 - 1082 - - - integer|0s - 4 - 676203 - 23 - - - integer|0s - 5 - 676203 - 23 - - - user_c - 1 - 22905 - 676203 - 1 - 22849 - - - quote_c - 1 - 22910 - 676203 - 1 - 22875 - - - id_comment - 1 - 22903 - 1 - 676203 - 1 - 403 - - - 1 - 22904 - 1 - 676203 - 22903 - - - integer|0s - 1 - 1 - 676204 - 23 - - - integer|0s - 1 - 2 - 676204 - 23 - - - user_f - 1 - 22920 - 676204 - 1 - 22849 - - - quote_f - 1 - 22925 - 676204 - 1 - 22875 - - - user_f -quote_f - 22918 - 1 - 676204 - 1 - 403 - - - 22919 - 1 - 676204 - 22918 - - - numeric|0s - 1 - 1 - 676199 - 1700 - - - varchar(99)|0s - 1 - 2 - 676199 - 1043 - - - boolean|0s - 1 - 3 - 676199 - 16 - - - id_image - 1 - 22846 - 1 - 676199 - 1 - 403 - - - 1 - 22847 - 1 - 676199 - 22846 - - - numeric|0s - 1 - 1 - 676206 - 1700 - - - varchar(99)|0s - 1 - 2 - 676206 - 1043 - - - varchar(99)|0s - 1 - 3 - 676206 - 1043 - - - varchar(99)|0s - 1 - 4 - 676206 - 1043 - - - varchar(99)|0s - 1 - 5 - 676206 - 1043 - - - varchar(99)|0s - 1 - 6 - 676206 - 1043 - - - varchar(99)|0s - 1 - 7 - 676206 - 1043 - - - id_question - 1 - 22942 - 1 - 676206 - 1 - 403 - - - 1 - 22943 - 1 - 676206 - 22942 - - - numeric|0s - 1 - 1 - 676205 - 1700 - - - integer|0s - 1 - 2 - 676205 - 23 - - - id_quiz - 1 - 22935 - 1 - 676205 - 1 - 403 - - - 1 - 22936 - 1 - 676205 - 22935 - - - numeric|0s - 1 - 1 - 676207 - 1700 - - - numeric|0s - 1 - 2 - 676207 - 1700 - - - quiz_qq - 1 - 22951 - 676207 - 1 - 22930 - - - question_qq - 1 - 22956 - 676207 - 1 - 22937 - - - quiz_qq -question_qq - 22949 - 1 - 676207 - 1 - 403 - - - 22950 - 1 - 676207 - 22949 - - - is_valid -reason - 22881 - is_valid OR (reason IS NOT NULL) - 676202 - - - integer|0s - nextval('quote_id_quote_seq'::regclass) - 1 - 1 - 676202 - 22874 - 23 - - - text|0s - 1 - 2 - 676202 - 25 - - - varchar(50)|0s - 1 - 3 - 676202 - 1043 - - - numeric|0s - 0 - 1 - 4 - 676202 - 1700 - - - varchar(50)|0s - 1 - 5 - 676202 - 1043 - - - boolean|0s - true - 1 - 6 - 676202 - 16 - - - text|0s - 7 - 676202 - 25 - - - integer|0s - 8 - 676202 - 23 - - - integer|0s - 9 - 676202 - 23 - - - user_q - 1 - 22888 - 676202 - 1 - 22849 - - - source - 1 - 22893 - 676202 - 1 - 22865 - - - id_quote - 1 - 22884 - 1 - 676202 - 1 - 403 - - - content - 1 - 22886 - 676202 - 1 - 403 - default - 100 - pg_catalog - - - 1 - 22885 - 1 - 676202 - 22884 - - - 1 - 22887 - 676202 - 22886 - - - numeric|0s - 1 - 1 - 676208 - 1700 - - - numeric|0s - 1 - 2 - 676240 - 1700 - - - integer|0s - 1 - 3 - 676208 - 23 - - - integer|0s - 1 - 4 - 676208 - 23 - - - user_r - 1 - 22968 - 676208 - 1 - 22849 - - - quiz_r - 1 - 22973 - 676208 - 1 - 22930 - - - user_r -quiz_r - 22966 - 1 - 676208 - 1 - 403 - - - 22967 - 1 - 676208 - 22966 - - - type - 22869 - (type)::text = ANY ((ARRAY['movie'::character varying, 'video-game'::character varying, 'novel'::character varying, 'anime'::character varying, 'tv'::character varying])::text[]) - 676201 - - - integer|0s - nextval('source_id_source_seq'::regclass) - 1 - 1 - 676201 - 22864 - 23 - - - varchar(99)|0s - 1 - 2 - 676201 - 1043 - - - varchar(30)|0s - 1 - 3 - 676201 - 1043 - - - numeric|0s - 1 - 4 - 676201 - 1700 - - - id_source - 1 - 22872 - 1 - 676201 - 1 - 403 - - - 1 - 22873 - 1 - 676201 - 22872 - - - integer|0s - nextval('users_id_user_seq'::regclass) - 1 - 1 - 676200 - 22848 - 23 - - - varchar(50)|0s - 1 - 2 - 676200 - 1043 - - - varchar(50)|0s - 1 - 3 - 676200 - 1043 - - - varchar(99)|0s - 1 - 4 - 676200 - 1043 - - - date|0s - 1 - 5 - 676200 - 1082 - - - boolean|0s - 1 - 6 - 676200 - 16 - - - numeric|0s - 7 - 676200 - 1700 - - - img_prfl - 1 - 22859 - 676200 - 1 - 22841 - - - id_user - 1 - 22855 - 1 - 676200 - 1 - 403 - - - username -email - 22857 - 676200 - 1 - 403 - 100 -100 - default -default - pg_catalog -pg_catalog - - - 1 - 22856 - 1 - 676200 - 22855 - - - 22858 - 676200 - 22857 - -
+ + + + + mdy + 1||-9223372036854775808|c|G +1||10|c|G +1||10|C|G +1||10|T|G +14087||-9223372036854775808|c|G +14087||10|c|G +14087||10|C|G +14087||10|T|G + 676242 + 14.13 + 1728898708 + true ACDT +true ACSST +false ACST +false ACT +false ACWST +true ADT +true AEDT +true AESST +false AEST +false AFT +true AKDT +false AKST +true ALMST +false ALMT +false AMST +false AMT +false ANAST +false ANAT +false ARST +false ART +false AST +true AWSST +false AWST +true AZOST +false AZOT +false AZST +false AZT +false Africa/Abidjan +false Africa/Accra +false Africa/Addis_Ababa +false Africa/Algiers +false Africa/Asmara +false Africa/Asmera +false Africa/Bamako +false Africa/Bangui +false Africa/Banjul +false Africa/Bissau +false Africa/Blantyre +false Africa/Brazzaville +false Africa/Bujumbura +false Africa/Cairo +false Africa/Casablanca +false Africa/Ceuta +false Africa/Conakry +false Africa/Dakar +false Africa/Dar_es_Salaam +false Africa/Djibouti +false Africa/Douala +false Africa/El_Aaiun +false Africa/Freetown +false Africa/Gaborone +false Africa/Harare +false Africa/Johannesburg +false Africa/Juba +false Africa/Kampala +false Africa/Khartoum +false Africa/Kigali +false Africa/Kinshasa +false Africa/Lagos +false Africa/Libreville +false Africa/Lome +false Africa/Luanda +false Africa/Lubumbashi +false Africa/Lusaka +false Africa/Malabo +false Africa/Maputo +false Africa/Maseru +false Africa/Mbabane +false Africa/Mogadishu +false Africa/Monrovia +false Africa/Nairobi +false Africa/Ndjamena +false Africa/Niamey +false Africa/Nouakchott +false Africa/Ouagadougou +false Africa/Porto-Novo +false Africa/Sao_Tome +false Africa/Timbuktu +false Africa/Tripoli +false Africa/Tunis +false Africa/Windhoek +false America/Adak +false America/Anchorage +false America/Anguilla +false America/Antigua +false America/Araguaina +false America/Argentina/Buenos_Aires +false America/Argentina/Catamarca +false America/Argentina/ComodRivadavia +false America/Argentina/Cordoba +false America/Argentina/Jujuy +false America/Argentina/La_Rioja +false America/Argentina/Mendoza +false America/Argentina/Rio_Gallegos +false America/Argentina/Salta +false America/Argentina/San_Juan +false America/Argentina/San_Luis +false America/Argentina/Tucuman +false America/Argentina/Ushuaia +false America/Aruba +true America/Asuncion +false America/Atikokan +false America/Atka +false America/Bahia +false America/Bahia_Banderas +false America/Barbados +false America/Belem +false America/Belize +false America/Blanc-Sablon +false America/Boa_Vista +false America/Bogota +false America/Boise +false America/Buenos_Aires +false America/Cambridge_Bay +false America/Campo_Grande +false America/Cancun +false America/Caracas +false America/Catamarca +false America/Cayenne +false America/Cayman +false America/Chicago +false America/Chihuahua +false America/Ciudad_Juarez +false America/Coral_Harbour +false America/Cordoba +false America/Costa_Rica +false America/Creston +false America/Cuiaba +false America/Curacao +false America/Danmarkshavn +false America/Dawson +false America/Dawson_Creek +false America/Denver +false America/Detroit +false America/Dominica +false America/Edmonton +false America/Eirunepe +false America/El_Salvador +false America/Ensenada +false America/Fort_Nelson +false America/Fort_Wayne +false America/Fortaleza +false America/Glace_Bay +false America/Godthab +false America/Goose_Bay +false America/Grand_Turk +false America/Grenada +false America/Guadeloupe +false America/Guatemala +false America/Guayaquil +false America/Guyana +false America/Halifax +false America/Havana +false America/Hermosillo +false America/Indiana/Indianapolis +false America/Indiana/Knox +false America/Indiana/Marengo +false America/Indiana/Petersburg +false America/Indiana/Tell_City +false America/Indiana/Vevay +false America/Indiana/Vincennes +false America/Indiana/Winamac +false America/Indianapolis +false America/Inuvik +false America/Iqaluit +false America/Jamaica +false America/Jujuy +false America/Juneau +false America/Kentucky/Louisville +false America/Kentucky/Monticello +false America/Knox_IN +false America/Kralendijk +false America/La_Paz +false America/Lima +false America/Los_Angeles +false America/Louisville +false America/Lower_Princes +false America/Maceio +false America/Managua +false America/Manaus +false America/Marigot +false America/Martinique +false America/Matamoros +false America/Mazatlan +false America/Mendoza +false America/Menominee +false America/Merida +false America/Metlakatla +false America/Mexico_City +false America/Miquelon +false America/Moncton +false America/Monterrey +false America/Montevideo +false America/Montreal +false America/Montserrat +false America/Nassau +false America/New_York +false America/Nipigon +false America/Nome +false America/Noronha +false America/North_Dakota/Beulah +false America/North_Dakota/Center +false America/North_Dakota/New_Salem +false America/Nuuk +false America/Ojinaga +false America/Panama +false America/Pangnirtung +false America/Paramaribo +false America/Phoenix +false America/Port-au-Prince +false America/Port_of_Spain +false America/Porto_Acre +false America/Porto_Velho +false America/Puerto_Rico +false America/Punta_Arenas +false America/Rainy_River +false America/Rankin_Inlet +false America/Recife +false America/Regina +false America/Resolute +false America/Rio_Branco +false America/Rosario +false America/Santa_Isabel +false America/Santarem +true America/Santiago +false America/Santo_Domingo +false America/Sao_Paulo +false America/Scoresbysund +false America/Shiprock +false America/Sitka +false America/St_Barthelemy +false America/St_Johns +false America/St_Kitts +false America/St_Lucia +false America/St_Thomas +false America/St_Vincent +false America/Swift_Current +false America/Tegucigalpa +false America/Thule +false America/Thunder_Bay +false America/Tijuana +false America/Toronto +false America/Tortola +false America/Vancouver +false America/Virgin +false America/Whitehorse +false America/Winnipeg +false America/Yakutat +false America/Yellowknife +false Antarctica/Casey +false Antarctica/Davis +false Antarctica/DumontDUrville +true Antarctica/Macquarie +false Antarctica/Mawson +true Antarctica/McMurdo +false Antarctica/Palmer +false Antarctica/Rothera +true Antarctica/South_Pole +false Antarctica/Syowa +false Antarctica/Troll +false Antarctica/Vostok +false Arctic/Longyearbyen +false Asia/Aden +false Asia/Almaty +false Asia/Amman +false Asia/Anadyr +false Asia/Aqtau +false Asia/Aqtobe +false Asia/Ashgabat +false Asia/Ashkhabad +false Asia/Atyrau +false Asia/Baghdad +false Asia/Bahrain +false Asia/Baku +false Asia/Bangkok +false Asia/Barnaul +false Asia/Beirut +false Asia/Bishkek +false Asia/Brunei +false Asia/Calcutta +false Asia/Chita +false Asia/Choibalsan +false Asia/Chongqing +false Asia/Chungking +false Asia/Colombo +false Asia/Dacca +false Asia/Damascus +false Asia/Dhaka +false Asia/Dili +false Asia/Dubai +false Asia/Dushanbe +false Asia/Famagusta +false Asia/Gaza +false Asia/Harbin +false Asia/Hebron +false Asia/Ho_Chi_Minh +false Asia/Hong_Kong +false Asia/Hovd +false Asia/Irkutsk +false Asia/Istanbul +false Asia/Jakarta +false Asia/Jayapura +false Asia/Jerusalem +false Asia/Kabul +false Asia/Kamchatka +false Asia/Karachi +false Asia/Kashgar +false Asia/Kathmandu +false Asia/Katmandu +false Asia/Khandyga +false Asia/Kolkata +false Asia/Krasnoyarsk +false Asia/Kuala_Lumpur +false Asia/Kuching +false Asia/Kuwait +false Asia/Macao +false Asia/Macau +false Asia/Magadan +false Asia/Makassar +false Asia/Manila +false Asia/Muscat +false Asia/Nicosia +false Asia/Novokuznetsk +false Asia/Novosibirsk +false Asia/Omsk +false Asia/Oral +false Asia/Phnom_Penh +false Asia/Pontianak +false Asia/Pyongyang +false Asia/Qatar +false Asia/Qostanay +false Asia/Qyzylorda +false Asia/Rangoon +false Asia/Riyadh +false Asia/Saigon +false Asia/Sakhalin +false Asia/Samarkand +false Asia/Seoul +false Asia/Shanghai +false Asia/Singapore +false Asia/Srednekolymsk +false Asia/Taipei +false Asia/Tashkent +false Asia/Tbilisi +false Asia/Tehran +false Asia/Tel_Aviv +false Asia/Thimbu +false Asia/Thimphu +false Asia/Tokyo +false Asia/Tomsk +false Asia/Ujung_Pandang +false Asia/Ulaanbaatar +false Asia/Ulan_Bator +false Asia/Urumqi +false Asia/Ust-Nera +false Asia/Vientiane +false Asia/Vladivostok +false Asia/Yakutsk +false Asia/Yangon +false Asia/Yekaterinburg +false Asia/Yerevan +false Atlantic/Azores +false Atlantic/Bermuda +false Atlantic/Canary +false Atlantic/Cape_Verde +false Atlantic/Faeroe +false Atlantic/Faroe +false Atlantic/Jan_Mayen +false Atlantic/Madeira +false Atlantic/Reykjavik +false Atlantic/South_Georgia +false Atlantic/St_Helena +false Atlantic/Stanley +true Australia/ACT +true Australia/Adelaide +false Australia/Brisbane +true Australia/Broken_Hill +true Australia/Canberra +true Australia/Currie +false Australia/Darwin +false Australia/Eucla +true Australia/Hobart +true Australia/LHI +false Australia/Lindeman +true Australia/Lord_Howe +true Australia/Melbourne +true Australia/NSW +false Australia/North +false Australia/Perth +false Australia/Queensland +true Australia/South +true Australia/Sydney +true Australia/Tasmania +true Australia/Victoria +false Australia/West +true Australia/Yancowinna +true BDST +false BDT +false BNT +false BORT +false BOT +false BRA +true BRST +false BRT +true BST +false BTT +false Brazil/Acre +false Brazil/DeNoronha +false Brazil/East +false Brazil/West +true CADT +false CAST +false CCT +true CDT +true CEST +false CET +true CETDST +true CHADT +false CHAST +false CHUT +false CKT +true CLST +true CLT +false COT +false CST +false CST6CDT +false CXT +false Canada/Atlantic +false Canada/Central +false Canada/Eastern +false Canada/Mountain +false Canada/Newfoundland +false Canada/Pacific +false Canada/Saskatchewan +false Canada/Yukon +true Chile/Continental +true Chile/EasterIsland +false Cuba +false DAVT +false DDUT +true EASST +true EAST +false EAT +true EDT +true EEST +false EET +true EETDST +true EGST +false EGT +false EST +false EST5EDT +false Egypt +true Eire +false Etc/GMT +false Etc/GMT+0 +false Etc/GMT+1 +false Etc/GMT+10 +false Etc/GMT+11 +false Etc/GMT+12 +false Etc/GMT+2 +false Etc/GMT+3 +false Etc/GMT+4 +false Etc/GMT+5 +false Etc/GMT+6 +false Etc/GMT+7 +false Etc/GMT+8 +false Etc/GMT+9 +false Etc/GMT-0 +false Etc/GMT-1 +false Etc/GMT-10 +false Etc/GMT-11 +false Etc/GMT-12 +false Etc/GMT-13 +false Etc/GMT-14 +false Etc/GMT-2 +false Etc/GMT-3 +false Etc/GMT-4 +false Etc/GMT-5 +false Etc/GMT-6 +false Etc/GMT-7 +false Etc/GMT-8 +false Etc/GMT-9 +false Etc/GMT0 +false Etc/Greenwich +false Etc/UCT +false Etc/UTC +false Etc/Universal +false Etc/Zulu +false Europe/Amsterdam +false Europe/Andorra +false Europe/Astrakhan +false Europe/Athens +false Europe/Belfast +false Europe/Belgrade +false Europe/Berlin +false Europe/Bratislava +false Europe/Brussels +false Europe/Bucharest +false Europe/Budapest +false Europe/Busingen +false Europe/Chisinau +false Europe/Copenhagen +true Europe/Dublin +false Europe/Gibraltar +false Europe/Guernsey +false Europe/Helsinki +false Europe/Isle_of_Man +false Europe/Istanbul +false Europe/Jersey +false Europe/Kaliningrad +false Europe/Kiev +false Europe/Kirov +false Europe/Kyiv +false Europe/Lisbon +false Europe/Ljubljana +false Europe/London +false Europe/Luxembourg +false Europe/Madrid +false Europe/Malta +false Europe/Mariehamn +false Europe/Minsk +false Europe/Monaco +false Europe/Moscow +false Europe/Nicosia +false Europe/Oslo +false Europe/Paris +false Europe/Podgorica +false Europe/Prague +false Europe/Riga +false Europe/Rome +false Europe/Samara +false Europe/San_Marino +false Europe/Sarajevo +false Europe/Saratov +false Europe/Simferopol +false Europe/Skopje +false Europe/Sofia +false Europe/Stockholm +false Europe/Tallinn +false Europe/Tirane +false Europe/Tiraspol +false Europe/Ulyanovsk +false Europe/Uzhgorod +false Europe/Vaduz +false Europe/Vatican +false Europe/Vienna +false Europe/Vilnius +false Europe/Volgograd +false Europe/Warsaw +false Europe/Zagreb +false Europe/Zaporozhye +false Europe/Zurich +false FET +true FJST +false FJT +false FKST +false FKT +true FNST +false FNT +false Factory +false GALT +false GAMT +false GB +false GB-Eire +false GEST +false GET +false GFT +false GILT +false GMT +false GMT+0 +false GMT-0 +false GMT0 +false GYT +false Greenwich +false HKT +false HST +false Hongkong +false ICT +true IDT +false IOT +false IRKST +false IRKT +false IRT +false IST +false Iceland +false Indian/Antananarivo +false Indian/Chagos +false Indian/Christmas +false Indian/Cocos +false Indian/Comoro +false Indian/Kerguelen +false Indian/Mahe +false Indian/Maldives +false Indian/Mauritius +false Indian/Mayotte +false Indian/Reunion +false Iran +false Israel +false JAYT +false JST +false Jamaica +false Japan +true KDT +true KGST +false KGT +false KOST +false KRAST +false KRAT +false KST +false Kwajalein +true LHDT +false LHST +false LIGT +false LINT +false LKT +false Libya +false MAGST +false MAGT +false MART +false MAWT +true MDT +true MEST +true MESZ +false MET +true METDST +false MEZ +false MHT +false MMT +false MPT +true MSD +false MSK +false MST +false MST7MDT +true MUST +false MUT +false MVT +false MYT +false Mexico/BajaNorte +false Mexico/BajaSur +false Mexico/General +true NDT +false NFT +false NOVST +false NOVT +false NPT +false NST +false NUT +true NZ +true NZ-CHAT +true NZDT +false NZST +false NZT +false Navajo +false OMSST +false OMST +true PDT +false PET +false PETST +false PETT +false PGT +false PHT +true PKST +false PKT +true PMDT +false PMST +false PONT +false PRC +false PST +false PST8PDT +false PWT +true PYST +true PYT +false Pacific/Apia +true Pacific/Auckland +false Pacific/Bougainville +true Pacific/Chatham +false Pacific/Chuuk +true Pacific/Easter +false Pacific/Efate +false Pacific/Enderbury +false Pacific/Fakaofo +false Pacific/Fiji +false Pacific/Funafuti +false Pacific/Galapagos +false Pacific/Gambier +false Pacific/Guadalcanal +false Pacific/Guam +false Pacific/Honolulu +false Pacific/Johnston +false Pacific/Kanton +false Pacific/Kiritimati +false Pacific/Kosrae +false Pacific/Kwajalein +false Pacific/Majuro +false Pacific/Marquesas +false Pacific/Midway +false Pacific/Nauru +false Pacific/Niue +true Pacific/Norfolk +false Pacific/Noumea +false Pacific/Pago_Pago +false Pacific/Palau +false Pacific/Pitcairn +false Pacific/Pohnpei +false Pacific/Ponape +false Pacific/Port_Moresby +false Pacific/Rarotonga +false Pacific/Saipan +false Pacific/Samoa +false Pacific/Tahiti +false Pacific/Tarawa +false Pacific/Tongatapu +false Pacific/Truk +false Pacific/Wake +false Pacific/Wallis +false Pacific/Yap +false Poland +false Portugal +false RET +false ROC +false ROK +true SADT +false SAST +false SCT +false SGT +false Singapore +false TAHT +false TFT +false TJT +false TKT +false TMT +false TOT +false TRUT +false TVT +false Turkey +false UCT +true ULAST +false ULAT +false US/Alaska +false US/Aleutian +false US/Arizona +false US/Central +false US/East-Indiana +false US/Eastern +false US/Hawaii +false US/Indiana-Starke +false US/Michigan +false US/Mountain +false US/Pacific +false US/Samoa +false UT +false UTC +true UYST +false UYT +true UZST +false UZT +false Universal +false VET +false VLAST +false VLAT +false VOLT +false VUT +false W-SU +true WADT +false WAKT +false WAST +false WAT +true WDT +false WET +true WETDST +false WFT +true WGST +false WGT +false XJT +false YAKST +false YAKT +false YAPT +true YEKST +false YEKT +false Z +false Zulu + + + + 16384 + kiem + + + 1 + 11||10|C|G +11||-9223372036854775808|U|G +11||10|U|G +2200||-9223372036854775808|C|G +2200||10|C|G +2200||-9223372036854775808|U|G +2200||10|U|G +13722||10|C|G +13722||-9223372036854775808|U|G +13722||10|U|G + 676242 + 16457 + kiem + + + default administrative connection database + 14088 + kiem + + + 1 + 1 + 1 + 1 + 10 + 1 + 1 + + + 6171 + + + 4571 + + + 3373 + 3374 +3375 +3377 + + + 6181 + + + 3374 + + + 3375 + + + 4569 + + + 4200 + + + 3377 + + + 6182 + + + 4570 + + + 1663 + 1 + kiem + + + 1664 + 1 + kiem + + + block range index (BRIN) access method + 3580 + 1 + index + 335 + brinhandler + pg_catalog + + + b-tree index access method + 403 + 1 + index + 330 + bthandler + pg_catalog + + + GIN index access method + 2742 + 1 + index + 333 + ginhandler + pg_catalog + + + GiST index access method + 783 + 1 + index + 332 + gisthandler + pg_catalog + + + hash index access method + 405 + 1 + index + 331 + hashhandler + pg_catalog + + + heap table access method + 2 + 1 + table + 3 + heap_tableam_handler + pg_catalog + + + SP-GiST index access method + 4000 + 1 + index + 334 + spghandler + pg_catalog + + + assignment + function + 10202 + 1 + 2971 + text + pg_catalog + 16 + bool + pg_catalog + 1042 + bpchar + pg_catalog + + + explicit + function + 10035 + 1 + 2558 + int4 + pg_catalog + 16 + bool + pg_catalog + 23 + int4 + pg_catalog + + + assignment + function + 10197 + 1 + 2971 + text + pg_catalog + 16 + bool + pg_catalog + 1043 + varchar + pg_catalog + + + assignment + function + 10192 + 1 + 2971 + text + pg_catalog + 16 + bool + pg_catalog + 25 + text + pg_catalog + + + assignment + function + 10133 + 1 + 946 + text + pg_catalog + 18 + char + pg_catalog + 1043 + varchar + pg_catalog + + + explicit + function + 10143 + 1 + 77 + int4 + pg_catalog + 18 + char + pg_catalog + 23 + int4 + pg_catalog + + + assignment + function + 10132 + 1 + 860 + bpchar + pg_catalog + 18 + char + pg_catalog + 1042 + bpchar + pg_catalog + + + implicit + function + 10131 + 1 + 946 + text + pg_catalog + 18 + char + pg_catalog + 25 + text + pg_catalog + + + assignment + function + 10135 + 1 + 408 + bpchar + pg_catalog + 19 + name + pg_catalog + 1042 + bpchar + pg_catalog + + + assignment + function + 10136 + 1 + 1401 + varchar + pg_catalog + 19 + name + pg_catalog + 1043 + varchar + pg_catalog + + + implicit + function + 10134 + 1 + 406 + text + pg_catalog + 19 + name + pg_catalog + 25 + text + pg_catalog + + + implicit + function + 10097 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 3734 + regconfig + pg_catalog + + + implicit + function + 10083 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 4191 + regcollation + pg_catalog + + + implicit + function + 10090 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 2206 + regtype + pg_catalog + + + assignment + function + 10033 + 1 + 3812 + money + pg_catalog + 20 + int8 + pg_catalog + 790 + money + pg_catalog + + + implicit + function + 10002 + 1 + 652 + float4 + pg_catalog + 20 + int8 + pg_catalog + 700 + float4 + pg_catalog + + + implicit + function + 10076 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 2205 + regclass + pg_catalog + + + implicit + function + 10113 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 4096 + regrole + pg_catalog + + + implicit + function + 10069 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 2204 + regoperator + pg_catalog + + + implicit + function + 10060 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 2203 + regoper + pg_catalog + + + implicit + function + 10120 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 4089 + regnamespace + pg_catalog + + + assignment + function + 10000 + 1 + 714 + int2 + pg_catalog + 20 + int8 + pg_catalog + 21 + int2 + pg_catalog + + + implicit + function + 10053 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 2202 + regprocedure + pg_catalog + + + explicit + function + 10186 + 1 + 2075 + bit + pg_catalog + 20 + int8 + pg_catalog + 1560 + bit + pg_catalog + + + implicit + function + 10044 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 24 + regproc + pg_catalog + + + assignment + function + 10001 + 1 + 480 + int4 + pg_catalog + 20 + int8 + pg_catalog + 23 + int4 + pg_catalog + + + implicit + function + 10004 + 1 + 1781 + numeric + pg_catalog + 20 + int8 + pg_catalog + 1700 + numeric + pg_catalog + + + implicit + function + 10104 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 3769 + regdictionary + pg_catalog + + + implicit + function + 10037 + 1 + 1287 + oid + pg_catalog + 20 + int8 + pg_catalog + 26 + oid + pg_catalog + + + implicit + function + 10003 + 1 + 482 + float8 + pg_catalog + 20 + int8 + pg_catalog + 701 + float8 + pg_catalog + + + implicit + function + 10038 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 26 + oid + pg_catalog + + + implicit + function + 10114 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 4096 + regrole + pg_catalog + + + implicit + function + 10121 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 4089 + regnamespace + pg_catalog + + + implicit + function + 10105 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 3769 + regdictionary + pg_catalog + + + implicit + function + 10098 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 3734 + regconfig + pg_catalog + + + implicit + function + 10091 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 2206 + regtype + pg_catalog + + + implicit + function + 10077 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 2205 + regclass + pg_catalog + + + implicit + function + 10070 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 2204 + regoperator + pg_catalog + + + implicit + function + 10005 + 1 + 754 + int8 + pg_catalog + 21 + int2 + pg_catalog + 20 + int8 + pg_catalog + + + implicit + function + 10061 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 2203 + regoper + pg_catalog + + + implicit + function + 10054 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 2202 + regprocedure + pg_catalog + + + implicit + function + 10006 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 23 + int4 + pg_catalog + + + implicit + function + 10009 + 1 + 1782 + numeric + pg_catalog + 21 + int2 + pg_catalog + 1700 + numeric + pg_catalog + + + implicit + function + 10084 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 4191 + regcollation + pg_catalog + + + implicit + function + 10045 + 1 + 313 + int4 + pg_catalog + 21 + int2 + pg_catalog + 24 + regproc + pg_catalog + + + implicit + function + 10008 + 1 + 235 + float8 + pg_catalog + 21 + int2 + pg_catalog + 701 + float8 + pg_catalog + + + implicit + function + 10007 + 1 + 236 + float4 + pg_catalog + 21 + int2 + pg_catalog + 700 + float4 + pg_catalog + + + assignment + function + 10011 + 1 + 314 + int2 + pg_catalog + 23 + int4 + pg_catalog + 21 + int2 + pg_catalog + + + implicit + binary + 10062 + 1 + 23 + int4 + pg_catalog + 2203 + regoper + pg_catalog + + + implicit + binary + 10071 + 1 + 23 + int4 + pg_catalog + 2204 + regoperator + pg_catalog + + + implicit + binary + 10078 + 1 + 23 + int4 + pg_catalog + 2205 + regclass + pg_catalog + + + implicit + binary + 10092 + 1 + 23 + int4 + pg_catalog + 2206 + regtype + pg_catalog + + + implicit + function + 10010 + 1 + 481 + int8 + pg_catalog + 23 + int4 + pg_catalog + 20 + int8 + pg_catalog + + + explicit + function + 10034 + 1 + 2557 + bool + pg_catalog + 23 + int4 + pg_catalog + 16 + bool + pg_catalog + + + assignment + function + 10032 + 1 + 3811 + money + pg_catalog + 23 + int4 + pg_catalog + 790 + money + pg_catalog + + + implicit + binary + 10099 + 1 + 23 + int4 + pg_catalog + 3734 + regconfig + pg_catalog + + + implicit + binary + 10106 + 1 + 23 + int4 + pg_catalog + 3769 + regdictionary + pg_catalog + + + implicit + function + 10013 + 1 + 316 + float8 + pg_catalog + 23 + int4 + pg_catalog + 701 + float8 + pg_catalog + + + implicit + function + 10012 + 1 + 318 + float4 + pg_catalog + 23 + int4 + pg_catalog + 700 + float4 + pg_catalog + + + implicit + binary + 10046 + 1 + 23 + int4 + pg_catalog + 24 + regproc + pg_catalog + + + implicit + binary + 10085 + 1 + 23 + int4 + pg_catalog + 4191 + regcollation + pg_catalog + + + implicit + binary + 10122 + 1 + 23 + int4 + pg_catalog + 4089 + regnamespace + pg_catalog + + + implicit + binary + 10039 + 1 + 23 + int4 + pg_catalog + 26 + oid + pg_catalog + + + implicit + binary + 10115 + 1 + 23 + int4 + pg_catalog + 4096 + regrole + pg_catalog + + + implicit + function + 10014 + 1 + 1740 + numeric + pg_catalog + 23 + int4 + pg_catalog + 1700 + numeric + pg_catalog + + + implicit + binary + 10055 + 1 + 23 + int4 + pg_catalog + 2202 + regprocedure + pg_catalog + + + explicit + function + 10144 + 1 + 78 + char + pg_catalog + 23 + int4 + pg_catalog + 18 + char + pg_catalog + + + explicit + function + 10187 + 1 + 1683 + bit + pg_catalog + 23 + int4 + pg_catalog + 1560 + bit + pg_catalog + + + implicit + binary + 10043 + 1 + 24 + regproc + pg_catalog + 26 + oid + pg_catalog + + + assignment + function + 10047 + 1 + 1288 + int8 + pg_catalog + 24 + regproc + pg_catalog + 20 + int8 + pg_catalog + + + assignment + binary + 10048 + 1 + 24 + regproc + pg_catalog + 23 + int4 + pg_catalog + + + implicit + binary + 10049 + 1 + 24 + regproc + pg_catalog + 2202 + regprocedure + pg_catalog + + + implicit + binary + 10125 + 1 + 25 + text + pg_catalog + 1042 + bpchar + pg_catalog + + + assignment + function + 10137 + 1 + 944 + char + pg_catalog + 25 + text + pg_catalog + 18 + char + pg_catalog + + + implicit + function + 10140 + 1 + 407 + name + pg_catalog + 25 + text + pg_catalog + 19 + name + pg_catalog + + + explicit + function + 10194 + 1 + 2896 + xml + pg_catalog + 25 + text + pg_catalog + 142 + xml + pg_catalog + + + implicit + function + 10109 + 1 + 1079 + regclass + pg_catalog + 25 + text + pg_catalog + 2205 + regclass + pg_catalog + + + implicit + binary + 10126 + 1 + 25 + text + pg_catalog + 1043 + varchar + pg_catalog + + + implicit + binary + 10095 + 1 + 26 + oid + pg_catalog + 3734 + regconfig + pg_catalog + + + implicit + binary + 10088 + 1 + 26 + oid + pg_catalog + 2206 + regtype + pg_catalog + + + implicit + binary + 10074 + 1 + 26 + oid + pg_catalog + 2205 + regclass + pg_catalog + + + implicit + binary + 10067 + 1 + 26 + oid + pg_catalog + 2204 + regoperator + pg_catalog + + + implicit + binary + 10058 + 1 + 26 + oid + pg_catalog + 2203 + regoper + pg_catalog + + + implicit + binary + 10051 + 1 + 26 + oid + pg_catalog + 2202 + regprocedure + pg_catalog + + + assignment + binary + 10041 + 1 + 26 + oid + pg_catalog + 23 + int4 + pg_catalog + + + implicit + binary + 10042 + 1 + 26 + oid + pg_catalog + 24 + regproc + pg_catalog + + + implicit + binary + 10081 + 1 + 26 + oid + pg_catalog + 4191 + regcollation + pg_catalog + + + implicit + binary + 10111 + 1 + 26 + oid + pg_catalog + 4096 + regrole + pg_catalog + + + implicit + binary + 10118 + 1 + 26 + oid + pg_catalog + 4089 + regnamespace + pg_catalog + + + implicit + binary + 10102 + 1 + 26 + oid + pg_catalog + 3769 + regdictionary + pg_catalog + + + assignment + function + 10040 + 1 + 1288 + int8 + pg_catalog + 26 + oid + pg_catalog + 20 + int8 + pg_catalog + + + assignment + io + 10215 + 1 + 114 + json + pg_catalog + 3802 + jsonb + pg_catalog + + + assignment + binary + 10198 + 1 + 142 + xml + pg_catalog + 1043 + varchar + pg_catalog + + + assignment + binary + 10193 + 1 + 142 + xml + pg_catalog + 25 + text + pg_catalog + + + assignment + binary + 10203 + 1 + 142 + xml + pg_catalog + 1042 + bpchar + pg_catalog + + + implicit + binary + 10145 + 1 + 194 + pg_node_tree + pg_catalog + 25 + text + pg_catalog + + + assignment + function + 10165 + 1 + 4091 + box + pg_catalog + 600 + point + pg_catalog + 603 + box + pg_catalog + + + explicit + function + 10166 + 1 + 1532 + point + pg_catalog + 601 + lseg + pg_catalog + 600 + point + pg_catalog + + + assignment + function + 10168 + 1 + 1449 + polygon + pg_catalog + 602 + path + pg_catalog + 604 + polygon + pg_catalog + + + explicit + function + 10167 + 1 + 1533 + point + pg_catalog + 602 + path + pg_catalog + 600 + point + pg_catalog + + + explicit + function + 10170 + 1 + 1541 + lseg + pg_catalog + 603 + box + pg_catalog + 601 + lseg + pg_catalog + + + explicit + function + 10169 + 1 + 1534 + point + pg_catalog + 603 + box + pg_catalog + 600 + point + pg_catalog + + + explicit + function + 10172 + 1 + 1479 + circle + pg_catalog + 603 + box + pg_catalog + 718 + circle + pg_catalog + + + assignment + function + 10171 + 1 + 1448 + polygon + pg_catalog + 603 + box + pg_catalog + 604 + polygon + pg_catalog + + + explicit + function + 10173 + 1 + 1540 + point + pg_catalog + 604 + polygon + pg_catalog + 600 + point + pg_catalog + + + assignment + function + 10174 + 1 + 1447 + path + pg_catalog + 604 + polygon + pg_catalog + 602 + path + pg_catalog + + + explicit + function + 10176 + 1 + 1474 + circle + pg_catalog + 604 + polygon + pg_catalog + 718 + circle + pg_catalog + + + explicit + function + 10175 + 1 + 1446 + box + pg_catalog + 604 + polygon + pg_catalog + 603 + box + pg_catalog + + + implicit + binary + 10182 + 1 + 650 + cidr + pg_catalog + 869 + inet + pg_catalog + + + assignment + function + 10190 + 1 + 730 + text + pg_catalog + 650 + cidr + pg_catalog + 25 + text + pg_catalog + + + assignment + function + 10195 + 1 + 730 + text + pg_catalog + 650 + cidr + pg_catalog + 1043 + varchar + pg_catalog + + + assignment + function + 10200 + 1 + 730 + text + pg_catalog + 650 + cidr + pg_catalog + 1042 + bpchar + pg_catalog + + + implicit + function + 10018 + 1 + 311 + float8 + pg_catalog + 700 + float4 + pg_catalog + 701 + float8 + pg_catalog + + + assignment + function + 10016 + 1 + 238 + int2 + pg_catalog + 700 + float4 + pg_catalog + 21 + int2 + pg_catalog + + + assignment + function + 10015 + 1 + 653 + int8 + pg_catalog + 700 + float4 + pg_catalog + 20 + int8 + pg_catalog + + + assignment + function + 10019 + 1 + 1742 + numeric + pg_catalog + 700 + float4 + pg_catalog + 1700 + numeric + pg_catalog + + + assignment + function + 10017 + 1 + 319 + int4 + pg_catalog + 700 + float4 + pg_catalog + 23 + int4 + pg_catalog + + + assignment + function + 10023 + 1 + 312 + float4 + pg_catalog + 701 + float8 + pg_catalog + 700 + float4 + pg_catalog + + + assignment + function + 10020 + 1 + 483 + int8 + pg_catalog + 701 + float8 + pg_catalog + 20 + int8 + pg_catalog + + + assignment + function + 10024 + 1 + 1743 + numeric + pg_catalog + 701 + float8 + pg_catalog + 1700 + numeric + pg_catalog + + + assignment + function + 10022 + 1 + 317 + int4 + pg_catalog + 701 + float8 + pg_catalog + 23 + int4 + pg_catalog + + + assignment + function + 10021 + 1 + 237 + int2 + pg_catalog + 701 + float8 + pg_catalog + 21 + int2 + pg_catalog + + + explicit + function + 10177 + 1 + 1416 + point + pg_catalog + 718 + circle + pg_catalog + 600 + point + pg_catalog + + + explicit + function + 10179 + 1 + 1544 + polygon + pg_catalog + 718 + circle + pg_catalog + 604 + polygon + pg_catalog + + + explicit + function + 10178 + 1 + 1480 + box + pg_catalog + 718 + circle + pg_catalog + 603 + box + pg_catalog + + + implicit + function + 10181 + 1 + 4124 + macaddr + pg_catalog + 774 + macaddr8 + pg_catalog + 829 + macaddr + pg_catalog + + + assignment + function + 10030 + 1 + 3823 + numeric + pg_catalog + 790 + money + pg_catalog + 1700 + numeric + pg_catalog + + + implicit + function + 10180 + 1 + 4123 + macaddr8 + pg_catalog + 829 + macaddr + pg_catalog + 774 + macaddr8 + pg_catalog + + + assignment + function + 10191 + 1 + 730 + text + pg_catalog + 869 + inet + pg_catalog + 25 + text + pg_catalog + + + assignment + function + 10183 + 1 + 1715 + cidr + pg_catalog + 869 + inet + pg_catalog + 650 + cidr + pg_catalog + + + assignment + function + 10201 + 1 + 730 + text + pg_catalog + 869 + inet + pg_catalog + 1042 + bpchar + pg_catalog + + + assignment + function + 10196 + 1 + 730 + text + pg_catalog + 869 + inet + pg_catalog + 1043 + varchar + pg_catalog + + + implicit + function + 10205 + 1 + 668 + bpchar + pg_catalog + 1042 + bpchar + pg_catalog + 1042 + bpchar + pg_catalog + + + assignment + function + 10138 + 1 + 944 + char + pg_catalog + 1042 + bpchar + pg_catalog + 18 + char + pg_catalog + + + implicit + function + 10127 + 1 + 401 + text + pg_catalog + 1042 + bpchar + pg_catalog + 25 + text + pg_catalog + + + explicit + function + 10204 + 1 + 2896 + xml + pg_catalog + 1042 + bpchar + pg_catalog + 142 + xml + pg_catalog + + + implicit + function + 10141 + 1 + 409 + name + pg_catalog + 1042 + bpchar + pg_catalog + 19 + name + pg_catalog + + + implicit + function + 10128 + 1 + 401 + text + pg_catalog + 1042 + bpchar + pg_catalog + 1043 + varchar + pg_catalog + + + implicit + function + 10206 + 1 + 669 + varchar + pg_catalog + 1043 + varchar + pg_catalog + 1043 + varchar + pg_catalog + + + implicit + binary + 10130 + 1 + 1043 + varchar + pg_catalog + 1042 + bpchar + pg_catalog + + + implicit + function + 10110 + 1 + 1079 + regclass + pg_catalog + 1043 + varchar + pg_catalog + 2205 + regclass + pg_catalog + + + implicit + binary + 10129 + 1 + 1043 + varchar + pg_catalog + 25 + text + pg_catalog + + + implicit + function + 10142 + 1 + 1400 + name + pg_catalog + 1043 + varchar + pg_catalog + 19 + name + pg_catalog + + + explicit + function + 10199 + 1 + 2896 + xml + pg_catalog + 1043 + varchar + pg_catalog + 142 + xml + pg_catalog + + + assignment + function + 10139 + 1 + 944 + char + pg_catalog + 1043 + varchar + pg_catalog + 18 + char + pg_catalog + + + implicit + function + 10152 + 1 + 2024 + timestamp + pg_catalog + 1082 + date + pg_catalog + 1114 + timestamp + pg_catalog + + + implicit + function + 10153 + 1 + 1174 + timestamptz + pg_catalog + 1082 + date + pg_catalog + 1184 + timestamptz + pg_catalog + + + implicit + function + 10207 + 1 + 1968 + time + pg_catalog + 1083 + time + pg_catalog + 1083 + time + pg_catalog + + + implicit + function + 10155 + 1 + 2047 + timetz + pg_catalog + 1083 + time + pg_catalog + 1266 + timetz + pg_catalog + + + implicit + function + 10154 + 1 + 1370 + interval + pg_catalog + 1083 + time + pg_catalog + 1186 + interval + pg_catalog + + + implicit + function + 10208 + 1 + 1961 + timestamp + pg_catalog + 1114 + timestamp + pg_catalog + 1114 + timestamp + pg_catalog + + + assignment + function + 10156 + 1 + 2029 + date + pg_catalog + 1114 + timestamp + pg_catalog + 1082 + date + pg_catalog + + + assignment + function + 10157 + 1 + 1316 + time + pg_catalog + 1114 + timestamp + pg_catalog + 1083 + time + pg_catalog + + + implicit + function + 10158 + 1 + 2028 + timestamptz + pg_catalog + 1114 + timestamp + pg_catalog + 1184 + timestamptz + pg_catalog + + + assignment + function + 10162 + 1 + 1388 + timetz + pg_catalog + 1184 + timestamptz + pg_catalog + 1266 + timetz + pg_catalog + + + assignment + function + 10159 + 1 + 1178 + date + pg_catalog + 1184 + timestamptz + pg_catalog + 1082 + date + pg_catalog + + + assignment + function + 10160 + 1 + 2019 + time + pg_catalog + 1184 + timestamptz + pg_catalog + 1083 + time + pg_catalog + + + assignment + function + 10161 + 1 + 2027 + timestamp + pg_catalog + 1184 + timestamptz + pg_catalog + 1114 + timestamp + pg_catalog + + + implicit + function + 10209 + 1 + 1967 + timestamptz + pg_catalog + 1184 + timestamptz + pg_catalog + 1184 + timestamptz + pg_catalog + + + implicit + function + 10210 + 1 + 1200 + interval + pg_catalog + 1186 + interval + pg_catalog + 1186 + interval + pg_catalog + + + assignment + function + 10163 + 1 + 1419 + time + pg_catalog + 1186 + interval + pg_catalog + 1083 + time + pg_catalog + + + assignment + function + 10164 + 1 + 2046 + time + pg_catalog + 1266 + timetz + pg_catalog + 1083 + time + pg_catalog + + + implicit + function + 10211 + 1 + 1969 + timetz + pg_catalog + 1266 + timetz + pg_catalog + 1266 + timetz + pg_catalog + + + implicit + binary + 10184 + 1 + 1560 + bit + pg_catalog + 1562 + varbit + pg_catalog + + + explicit + function + 10188 + 1 + 2076 + int8 + pg_catalog + 1560 + bit + pg_catalog + 20 + int8 + pg_catalog + + + explicit + function + 10189 + 1 + 1684 + int4 + pg_catalog + 1560 + bit + pg_catalog + 23 + int4 + pg_catalog + + + implicit + function + 10212 + 1 + 1685 + bit + pg_catalog + 1560 + bit + pg_catalog + 1560 + bit + pg_catalog + + + implicit + binary + 10185 + 1 + 1562 + varbit + pg_catalog + 1560 + bit + pg_catalog + + + implicit + function + 10213 + 1 + 1687 + varbit + pg_catalog + 1562 + varbit + pg_catalog + 1562 + varbit + pg_catalog + + + assignment + function + 10031 + 1 + 3824 + money + pg_catalog + 1700 + numeric + pg_catalog + 790 + money + pg_catalog + + + assignment + function + 10026 + 1 + 1783 + int2 + pg_catalog + 1700 + numeric + pg_catalog + 21 + int2 + pg_catalog + + + implicit + function + 10028 + 1 + 1745 + float4 + pg_catalog + 1700 + numeric + pg_catalog + 700 + float4 + pg_catalog + + + implicit + function + 10029 + 1 + 1746 + float8 + pg_catalog + 1700 + numeric + pg_catalog + 701 + float8 + pg_catalog + + + assignment + function + 10027 + 1 + 1744 + int4 + pg_catalog + 1700 + numeric + pg_catalog + 23 + int4 + pg_catalog + + + assignment + function + 10025 + 1 + 1779 + int8 + pg_catalog + 1700 + numeric + pg_catalog + 20 + int8 + pg_catalog + + + implicit + function + 10214 + 1 + 1703 + numeric + pg_catalog + 1700 + numeric + pg_catalog + 1700 + numeric + pg_catalog + + + assignment + function + 10056 + 1 + 1288 + int8 + pg_catalog + 2202 + regprocedure + pg_catalog + 20 + int8 + pg_catalog + + + assignment + binary + 10057 + 1 + 2202 + regprocedure + pg_catalog + 23 + int4 + pg_catalog + + + implicit + binary + 10050 + 1 + 2202 + regprocedure + pg_catalog + 24 + regproc + pg_catalog + + + implicit + binary + 10052 + 1 + 2202 + regprocedure + pg_catalog + 26 + oid + pg_catalog + + + assignment + function + 10063 + 1 + 1288 + int8 + pg_catalog + 2203 + regoper + pg_catalog + 20 + int8 + pg_catalog + + + implicit + binary + 10059 + 1 + 2203 + regoper + pg_catalog + 26 + oid + pg_catalog + + + implicit + binary + 10065 + 1 + 2203 + regoper + pg_catalog + 2204 + regoperator + pg_catalog + + + assignment + binary + 10064 + 1 + 2203 + regoper + pg_catalog + 23 + int4 + pg_catalog + + + implicit + binary + 10068 + 1 + 2204 + regoperator + pg_catalog + 26 + oid + pg_catalog + + + assignment + function + 10072 + 1 + 1288 + int8 + pg_catalog + 2204 + regoperator + pg_catalog + 20 + int8 + pg_catalog + + + assignment + binary + 10073 + 1 + 2204 + regoperator + pg_catalog + 23 + int4 + pg_catalog + + + implicit + binary + 10066 + 1 + 2204 + regoperator + pg_catalog + 2203 + regoper + pg_catalog + + + assignment + binary + 10080 + 1 + 2205 + regclass + pg_catalog + 23 + int4 + pg_catalog + + + implicit + binary + 10075 + 1 + 2205 + regclass + pg_catalog + 26 + oid + pg_catalog + + + assignment + function + 10079 + 1 + 1288 + int8 + pg_catalog + 2205 + regclass + pg_catalog + 20 + int8 + pg_catalog + + + assignment + function + 10093 + 1 + 1288 + int8 + pg_catalog + 2206 + regtype + pg_catalog + 20 + int8 + pg_catalog + + + assignment + binary + 10094 + 1 + 2206 + regtype + pg_catalog + 23 + int4 + pg_catalog + + + implicit + binary + 10089 + 1 + 2206 + regtype + pg_catalog + 26 + oid + pg_catalog + + + implicit + io + 10147 + 1 + 3361 + pg_ndistinct + pg_catalog + 25 + text + pg_catalog + + + implicit + binary + 10146 + 1 + 3361 + pg_ndistinct + pg_catalog + 17 + bytea + pg_catalog + + + implicit + io + 10149 + 1 + 3402 + pg_dependencies + pg_catalog + 25 + text + pg_catalog + + + implicit + binary + 10148 + 1 + 3402 + pg_dependencies + pg_catalog + 17 + bytea + pg_catalog + + + assignment + function + 10100 + 1 + 1288 + int8 + pg_catalog + 3734 + regconfig + pg_catalog + 20 + int8 + pg_catalog + + + assignment + binary + 10101 + 1 + 3734 + regconfig + pg_catalog + 23 + int4 + pg_catalog + + + implicit + binary + 10096 + 1 + 3734 + regconfig + pg_catalog + 26 + oid + pg_catalog + + + implicit + binary + 10103 + 1 + 3769 + regdictionary + pg_catalog + 26 + oid + pg_catalog + + + assignment + function + 10107 + 1 + 1288 + int8 + pg_catalog + 3769 + regdictionary + pg_catalog + 20 + int8 + pg_catalog + + + assignment + binary + 10108 + 1 + 3769 + regdictionary + pg_catalog + 23 + int4 + pg_catalog + + + explicit + function + 10218 + 1 + 3449 + numeric + pg_catalog + 3802 + jsonb + pg_catalog + 1700 + numeric + pg_catalog + + + explicit + function + 10223 + 1 + 2580 + float8 + pg_catalog + 3802 + jsonb + pg_catalog + 701 + float8 + pg_catalog + + + explicit + function + 10217 + 1 + 3556 + bool + pg_catalog + 3802 + jsonb + pg_catalog + 16 + bool + pg_catalog + + + explicit + function + 10222 + 1 + 3453 + float4 + pg_catalog + 3802 + jsonb + pg_catalog + 700 + float4 + pg_catalog + + + explicit + function + 10219 + 1 + 3450 + int2 + pg_catalog + 3802 + jsonb + pg_catalog + 21 + int2 + pg_catalog + + + explicit + function + 10220 + 1 + 3451 + int4 + pg_catalog + 3802 + jsonb + pg_catalog + 23 + int4 + pg_catalog + + + assignment + io + 10216 + 1 + 3802 + jsonb + pg_catalog + 114 + json + pg_catalog + + + explicit + function + 10221 + 1 + 3452 + int8 + pg_catalog + 3802 + jsonb + pg_catalog + 20 + int8 + pg_catalog + + + explicit + function + 10224 + 1 + 4281 + int4multirange + pg_catalog + 3904 + int4range + pg_catalog + 4451 + int4multirange + pg_catalog + + + explicit + function + 10226 + 1 + 4284 + nummultirange + pg_catalog + 3906 + numrange + pg_catalog + 4532 + nummultirange + pg_catalog + + + explicit + function + 10228 + 1 + 4287 + tsmultirange + pg_catalog + 3908 + tsrange + pg_catalog + 4533 + tsmultirange + pg_catalog + + + explicit + function + 10229 + 1 + 4290 + tstzmultirange + pg_catalog + 3910 + tstzrange + pg_catalog + 4534 + tstzmultirange + pg_catalog + + + explicit + function + 10227 + 1 + 4293 + datemultirange + pg_catalog + 3912 + daterange + pg_catalog + 4535 + datemultirange + pg_catalog + + + explicit + function + 10225 + 1 + 4296 + int8multirange + pg_catalog + 3926 + int8range + pg_catalog + 4536 + int8multirange + pg_catalog + + + assignment + binary + 10124 + 1 + 4089 + regnamespace + pg_catalog + 23 + int4 + pg_catalog + + + assignment + function + 10123 + 1 + 1288 + int8 + pg_catalog + 4089 + regnamespace + pg_catalog + 20 + int8 + pg_catalog + + + implicit + binary + 10119 + 1 + 4089 + regnamespace + pg_catalog + 26 + oid + pg_catalog + + + implicit + binary + 10112 + 1 + 4096 + regrole + pg_catalog + 26 + oid + pg_catalog + + + assignment + function + 10116 + 1 + 1288 + int8 + pg_catalog + 4096 + regrole + pg_catalog + 20 + int8 + pg_catalog + + + assignment + binary + 10117 + 1 + 4096 + regrole + pg_catalog + 23 + int4 + pg_catalog + + + implicit + binary + 10082 + 1 + 4191 + regcollation + pg_catalog + 26 + oid + pg_catalog + + + assignment + function + 10086 + 1 + 1288 + int8 + pg_catalog + 4191 + regcollation + pg_catalog + 20 + int8 + pg_catalog + + + assignment + binary + 10087 + 1 + 4191 + regcollation + pg_catalog + 23 + int4 + pg_catalog + + + implicit + binary + 10150 + 1 + 5017 + pg_mcv_list + pg_catalog + 17 + bytea + pg_catalog + + + implicit + io + 10151 + 1 + 5017 + pg_mcv_list + pg_catalog + 25 + text + pg_catalog + + + explicit + function + 10036 + 1 + 5071 + xid + pg_catalog + 5069 + xid8 + pg_catalog + 28 + xid + pg_catalog + + + PL/pgSQL procedural language + 14074 + 686 + 1.0 + 11 + pg_catalog + 14075 +14076 +14077 +14078 + + + dynamically-loaded C functions + 13 + 1 + fmgr_c_validator + pg_catalog + + + built-in functions + 12 + 1 + fmgr_internal_validator + pg_catalog + + + PL/pgSQL procedural language + plpgsql_call_handler + pg_catalog + plpgsql_inline_handler + pg_catalog + 14078 + 686 + 1 + plpgsql_validator + pg_catalog + + + SQL-language functions + 14 + 1 + 1 + fmgr_sql_validator + pg_catalog + + + 13722 + 532 + kiem + + + system catalog schema + 11 + 525 + kiem + + + standard public schema + 1 + 676242 + 2024-11-05.16:07:50 + 2200 + 526 + kiem + + + integer|0s + 22874 + 1 + 1 + 676202 + kiem + + + integer|0s + 22864 + 1 + 1 + 676201 + kiem + + + integer|0s + 22848 + 1 + 1 + 676200 + kiem + + + 22978 + 676209 + 2 + kiem +
+ + 22898 + 676203 + 2 + kiem +
+ + 22915 + 676204 + 2 + kiem +
+ + 22841 + 676200 + 2 + kiem +
+ + 22937 + 676207 + 2 + kiem +
+ + 22930 + 676207 + 2 + kiem +
+ + 22944 + 676207 + 2 + kiem +
+ + 22875 + 676202 + 2 + kiem +
+ + 22961 + 676208 + 2 + kiem +
+ + 22865 + 676202 + 2 + kiem +
+ + 22849 + 676200 + 2 + kiem +
+ + numeric|0s + 1 + 1 + 676209 + 1700 + + + varchar(99)|0s + 1 + 2 + 676209 + 1043 + + + numeric|0s + 3 + 676209 + 1700 + + + img_char + 1 + 22985 + 676209 + 1 + 22841 + + + id_char + 1 + 22983 + 1 + 676209 + 1 + 403 + + + 1 + 22984 + 1 + 676209 + 22983 + + + numeric|0s + 1 + 1 + 676203 + 1700 + + + text|0s + 1 + 2 + 676203 + 25 + + + date|0s + 1 + 3 + 676203 + 1082 + + + integer|0s + 4 + 676203 + 23 + + + integer|0s + 5 + 676203 + 23 + + + user_c + 1 + 22905 + 676203 + 1 + 22849 + + + quote_c + 1 + 22910 + 676203 + 1 + 22875 + + + id_comment + 1 + 22903 + 1 + 676203 + 1 + 403 + + + 1 + 22904 + 1 + 676203 + 22903 + + + integer|0s + 1 + 1 + 676204 + 23 + + + integer|0s + 1 + 2 + 676204 + 23 + + + user_f + 1 + 22920 + 676204 + 1 + 22849 + + + quote_f + 1 + 22925 + 676204 + 1 + 22875 + + + user_f +quote_f + 22918 + 1 + 676204 + 1 + 403 + + + 22919 + 1 + 676204 + 22918 + + + numeric|0s + 1 + 1 + 676199 + 1700 + + + varchar(99)|0s + 1 + 2 + 676199 + 1043 + + + boolean|0s + 1 + 3 + 676199 + 16 + + + id_image + 1 + 22846 + 1 + 676199 + 1 + 403 + + + 1 + 22847 + 1 + 676199 + 22846 + + + numeric|0s + 1 + 1 + 676206 + 1700 + + + varchar(99)|0s + 1 + 2 + 676206 + 1043 + + + varchar(99)|0s + 1 + 3 + 676206 + 1043 + + + varchar(99)|0s + 1 + 4 + 676206 + 1043 + + + varchar(99)|0s + 1 + 5 + 676206 + 1043 + + + varchar(99)|0s + 1 + 6 + 676206 + 1043 + + + varchar(99)|0s + 1 + 7 + 676206 + 1043 + + + id_question + 1 + 22942 + 1 + 676206 + 1 + 403 + + + 1 + 22943 + 1 + 676206 + 22942 + + + numeric|0s + 1 + 1 + 676205 + 1700 + + + integer|0s + 1 + 2 + 676205 + 23 + + + id_quiz + 1 + 22935 + 1 + 676205 + 1 + 403 + + + 1 + 22936 + 1 + 676205 + 22935 + + + numeric|0s + 1 + 1 + 676207 + 1700 + + + numeric|0s + 1 + 2 + 676207 + 1700 + + + quiz_qq + 1 + 22951 + 676207 + 1 + 22930 + + + question_qq + 1 + 22956 + 676207 + 1 + 22937 + + + quiz_qq +question_qq + 22949 + 1 + 676207 + 1 + 403 + + + 22950 + 1 + 676207 + 22949 + + + is_valid +reason + 22881 + is_valid OR (reason IS NOT NULL) + 676202 + + + integer|0s + nextval('quote_id_quote_seq'::regclass) + 1 + 1 + 676202 + 22874 + 23 + + + text|0s + 1 + 2 + 676202 + 25 + + + varchar(50)|0s + 1 + 3 + 676202 + 1043 + + + numeric|0s + 0 + 1 + 4 + 676202 + 1700 + + + varchar(50)|0s + 1 + 5 + 676202 + 1043 + + + boolean|0s + true + 1 + 6 + 676202 + 16 + + + text|0s + 7 + 676202 + 25 + + + integer|0s + 8 + 676202 + 23 + + + integer|0s + 9 + 676202 + 23 + + + user_q + 1 + 22888 + 676202 + 1 + 22849 + + + source + 1 + 22893 + 676202 + 1 + 22865 + + + id_quote + 1 + 22884 + 1 + 676202 + 1 + 403 + + + content + 1 + 22886 + 676202 + 1 + 403 + default + 100 + pg_catalog + + + 1 + 22885 + 1 + 676202 + 22884 + + + 1 + 22887 + 676202 + 22886 + + + numeric|0s + 1 + 1 + 676208 + 1700 + + + numeric|0s + 1 + 2 + 676240 + 1700 + + + integer|0s + 1 + 3 + 676208 + 23 + + + integer|0s + 1 + 4 + 676208 + 23 + + + user_r + 1 + 22968 + 676208 + 1 + 22849 + + + quiz_r + 1 + 22973 + 676208 + 1 + 22930 + + + user_r +quiz_r + 22966 + 1 + 676208 + 1 + 403 + + + 22967 + 1 + 676208 + 22966 + + + type + 22869 + (type)::text = ANY ((ARRAY['movie'::character varying, 'video-game'::character varying, 'novel'::character varying, 'anime'::character varying, 'tv'::character varying])::text[]) + 676201 + + + integer|0s + nextval('source_id_source_seq'::regclass) + 1 + 1 + 676201 + 22864 + 23 + + + varchar(99)|0s + 1 + 2 + 676201 + 1043 + + + varchar(30)|0s + 1 + 3 + 676201 + 1043 + + + numeric|0s + 1 + 4 + 676201 + 1700 + + + id_source + 1 + 22872 + 1 + 676201 + 1 + 403 + + + 1 + 22873 + 1 + 676201 + 22872 + + + integer|0s + nextval('users_id_user_seq'::regclass) + 1 + 1 + 676200 + 22848 + 23 + + + varchar(50)|0s + 1 + 2 + 676200 + 1043 + + + varchar(50)|0s + 1 + 3 + 676200 + 1043 + + + varchar(99)|0s + 1 + 4 + 676200 + 1043 + + + date|0s + 1 + 5 + 676200 + 1082 + + + boolean|0s + 1 + 6 + 676200 + 16 + + + numeric|0s + 7 + 676200 + 1700 + + + img_prfl + 1 + 22859 + 676200 + 1 + 22841 + + + id_user + 1 + 22855 + 1 + 676200 + 1 + 403 + + + username +email + 22857 + 676200 + 1 + 403 + 100 +100 + default +default + pg_catalog +pg_catalog + + + 1 + 22856 + 1 + 676200 + 22855 + + + 22858 + 676200 + 22857 + +
\ No newline at end of file diff --git a/.idea/dataSources/351a7e7c-c4d1-4e89-bf03-667b32764270/storage_v2/_src_/database/dbwikifantasy.OCIa2Q/schema/public.abK9xQ.meta b/.idea/dataSources/351a7e7c-c4d1-4e89-bf03-667b32764270/storage_v2/_src_/database/dbwikifantasy.OCIa2Q/schema/public.abK9xQ.meta index 54e5111..fb33bc5 100644 --- a/.idea/dataSources/351a7e7c-c4d1-4e89-bf03-667b32764270/storage_v2/_src_/database/dbwikifantasy.OCIa2Q/schema/public.abK9xQ.meta +++ b/.idea/dataSources/351a7e7c-c4d1-4e89-bf03-667b32764270/storage_v2/_src_/database/dbwikifantasy.OCIa2Q/schema/public.abK9xQ.meta @@ -1,2 +1,2 @@ -#n:public -! [676242, 0, null, null, -2147483648, -2147483648] +#n:public +! [676242, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml index 0d9afcc..11d7505 100644 --- a/.idea/material_theme_project_new.xml +++ b/.idea/material_theme_project_new.xml @@ -1,10 +1,10 @@ - - - - - + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml index bc07ff3..f78e679 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -1,33 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 35eb1dd..c8397c9 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 882bd96..6a61fb8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,131 +1,131 @@ - - - - - - - - - - - - - - - - - - - - - - - $PROJECT_DIR$/composer.json - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { - "customColor": "", - "associatedIndex": 4 -} - - - - - - - - - - - - - - - - - - - - 1730794293135 - - - - - + + + + + + + + + + + + + + + + + + + + + + + $PROJECT_DIR$/composer.json + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + "customColor": "", + "associatedIndex": 4 +} + + + + + + + + + + + + + + + + + + + + 1730794293135 + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 99b8dec..79a8cce 100755 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# WikiFantasyWeb - +# WikiFantasyWeb + diff --git a/cache/3c/3ceeff3fb7d2c301f9137b5178bfde0d.php b/cache/3c/3ceeff3fb7d2c301f9137b5178bfde0d.php index a31b42f..144d3fb 100644 --- a/cache/3c/3ceeff3fb7d2c301f9137b5178bfde0d.php +++ b/cache/3c/3ceeff3fb7d2c301f9137b5178bfde0d.php @@ -1,167 +1,167 @@ - - */ - private array $macros = []; - - public function __construct(Environment $env) - { - parent::__construct($env); - - $this->source = $this->getSourceContext(); - - $this->parent = false; - - $this->blocks = [ - ]; - } - - protected function doDisplay(array $context, array $blocks = []): iterable - { - $macros = $this->macros; - // line 1 - yield " - - - - - Wiki Fantasy : Quiz - - - - - - -
-
- \"coeur\" - \"toggle - \"quizz\" -
-
- \"Logo\" -
-
- \"user\" -
-
- - -

▶ Quiz ◀

-
-

"; - // line 44 - yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, ($context["question"] ?? null), "question", [], "any", false, false, false, 44), "html", null, true); - yield "

- 300 seconds left .. - -
-
- - - - -
- -
-
- - -"; - yield from []; - } - - /** - * @codeCoverageIgnore - */ - public function getTemplateName(): string - { - return "quiz.html.twig"; - } - - /** - * @codeCoverageIgnore - */ - public function isTraitable(): bool - { - return false; - } - - /** - * @codeCoverageIgnore - */ - public function getDebugInfo(): array - { - return array ( 126 => 59, 122 => 58, 117 => 56, 113 => 55, 108 => 53, 104 => 52, 99 => 50, 95 => 49, 87 => 44, 42 => 1,); - } - - public function getSourceContext(): Source - { - return new Source("", "quiz.html.twig", "/Users/kiem/Documents/WikiFantasy/WF-Website/vue/templates/quiz.html.twig"); - } -} + + */ + private array $macros = []; + + public function __construct(Environment $env) + { + parent::__construct($env); + + $this->source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 1 + yield " + + + + + Wiki Fantasy : Quiz + + + + + + +
+
+ \"coeur\" + \"toggle + \"quizz\" +
+
+ \"Logo\" +
+
+ \"user\" +
+
+ + +

▶ Quiz ◀

+
+

"; + // line 44 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, ($context["question"] ?? null), "question", [], "any", false, false, false, 44), "html", null, true); + yield "

+ 300 seconds left .. + +
+
+ + + + +
+ +
+
+ + +"; + yield from []; + } + + /** + * @codeCoverageIgnore + */ + public function getTemplateName(): string + { + return "quiz.html.twig"; + } + + /** + * @codeCoverageIgnore + */ + public function isTraitable(): bool + { + return false; + } + + /** + * @codeCoverageIgnore + */ + public function getDebugInfo(): array + { + return array ( 126 => 59, 122 => 58, 117 => 56, 113 => 55, 108 => 53, 104 => 52, 99 => 50, 95 => 49, 87 => 44, 42 => 1,); + } + + public function getSourceContext(): Source + { + return new Source("", "quiz.html.twig", "/Users/kiem/Documents/WikiFantasy/WF-Website/vue/templates/quiz.html.twig"); + } +} diff --git a/cache/44/4448d384ce5c0b36e3d5c422f47fbacf.php b/cache/44/4448d384ce5c0b36e3d5c422f47fbacf.php index 3823316..670f65f 100644 --- a/cache/44/4448d384ce5c0b36e3d5c422f47fbacf.php +++ b/cache/44/4448d384ce5c0b36e3d5c422f47fbacf.php @@ -1,115 +1,115 @@ - - */ - private array $macros = []; - - public function __construct(Environment $env) - { - parent::__construct($env); - - $this->source = $this->getSourceContext(); - - $this->parent = false; - - $this->blocks = [ - ]; - } - - protected function doDisplay(array $context, array $blocks = []): iterable - { - $macros = $this->macros; - // line 1 - yield "
-
-
- \"coeur\" - \"toggle - \"quizz\" -
-
- \"Logo\" -
-
- \"user\" -
-
-
-

▶ S'inscrire ◀

-
-
-
-

Identifiant *

- -
- -
-

Email *

- -
- -
-

Mot de passe *

- -
- -
-

Confirmer mot de passe *

- -
- -
-

Image *

- -
- -
- -
-
-
- -"; - yield from []; - } - - /** - * @codeCoverageIgnore - */ - public function getTemplateName(): string - { - return "signin.html"; - } - - /** - * @codeCoverageIgnore - */ - public function getDebugInfo(): array - { - return array ( 42 => 1,); - } - - public function getSourceContext(): Source - { - return new Source("", "signin.html", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/signin.html"); - } -} + + */ + private array $macros = []; + + public function __construct(Environment $env) + { + parent::__construct($env); + + $this->source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 1 + yield "
+
+
+ \"coeur\" + \"toggle + \"quizz\" +
+
+ \"Logo\" +
+
+ \"user\" +
+
+
+

▶ S'inscrire ◀

+
+
+
+

Identifiant *

+ +
+ +
+

Email *

+ +
+ +
+

Mot de passe *

+ +
+ +
+

Confirmer mot de passe *

+ +
+ +
+

Image *

+ +
+ +
+ +
+
+
+ +"; + yield from []; + } + + /** + * @codeCoverageIgnore + */ + public function getTemplateName(): string + { + return "signin.html"; + } + + /** + * @codeCoverageIgnore + */ + public function getDebugInfo(): array + { + return array ( 42 => 1,); + } + + public function getSourceContext(): Source + { + return new Source("", "signin.html", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/signin.html"); + } +} diff --git a/cache/4c/4c09a23641745f18c4a77cbf74811c72.php b/cache/4c/4c09a23641745f18c4a77cbf74811c72.php index d618adc..ff68586 100644 --- a/cache/4c/4c09a23641745f18c4a77cbf74811c72.php +++ b/cache/4c/4c09a23641745f18c4a77cbf74811c72.php @@ -1,90 +1,90 @@ - - */ - private array $macros = []; - - public function __construct(Environment $env) - { - parent::__construct($env); - - $this->source = $this->getSourceContext(); - - $this->parent = false; - - $this->blocks = [ - ]; - } - - protected function doDisplay(array $context, array $blocks = []): iterable - { - $macros = $this->macros; - // line 1 - yield " - - - - - "; - // line 6 - yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["title"] ?? null), "html", null, true); - yield " - env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["style"] ?? null), "html", null, true); - yield "\"> - - - - "; - yield from []; - } - - /** - * @codeCoverageIgnore - */ - public function getTemplateName(): string - { - return "head.html.twig"; - } - - /** - * @codeCoverageIgnore - */ - public function isTraitable(): bool - { - return false; - } - - /** - * @codeCoverageIgnore - */ - public function getDebugInfo(): array - { - return array ( 53 => 7, 49 => 6, 42 => 1,); - } - - public function getSourceContext(): Source - { - return new Source("", "head.html.twig", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/head.html.twig"); - } -} + + */ + private array $macros = []; + + public function __construct(Environment $env) + { + parent::__construct($env); + + $this->source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 1 + yield " + + + + + "; + // line 6 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["title"] ?? null), "html", null, true); + yield " + env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["style"] ?? null), "html", null, true); + yield "\"> + + + + "; + yield from []; + } + + /** + * @codeCoverageIgnore + */ + public function getTemplateName(): string + { + return "head.html.twig"; + } + + /** + * @codeCoverageIgnore + */ + public function isTraitable(): bool + { + return false; + } + + /** + * @codeCoverageIgnore + */ + public function getDebugInfo(): array + { + return array ( 53 => 7, 49 => 6, 42 => 1,); + } + + public function getSourceContext(): Source + { + return new Source("", "head.html.twig", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/head.html.twig"); + } +} diff --git a/cache/57/572879f536ab89f645ae886cddb0ed04.php b/cache/57/572879f536ab89f645ae886cddb0ed04.php index b20eacf..9ca4ffa 100644 --- a/cache/57/572879f536ab89f645ae886cddb0ed04.php +++ b/cache/57/572879f536ab89f645ae886cddb0ed04.php @@ -1,78 +1,78 @@ - - */ - private array $macros = []; - - public function __construct(Environment $env) - { - parent::__construct($env); - - $this->source = $this->getSourceContext(); - - $this->parent = false; - - $this->blocks = [ - ]; - } - - protected function doDisplay(array $context, array $blocks = []): iterable - { - $macros = $this->macros; - // line 1 - yield "
-
- \"coeur\" - \"toggle - \"quizz\" -
-
- \"Logo\" -
-
- \"user\" -
-
"; - yield from []; - } - - /** - * @codeCoverageIgnore - */ - public function getTemplateName(): string - { - return "bandeau.html.twig"; - } - - /** - * @codeCoverageIgnore - */ - public function getDebugInfo(): array - { - return array ( 42 => 1,); - } - - public function getSourceContext(): Source - { - return new Source("", "bandeau.html.twig", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/bandeau.html.twig"); - } -} + + */ + private array $macros = []; + + public function __construct(Environment $env) + { + parent::__construct($env); + + $this->source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 1 + yield "
+
+ \"coeur\" + \"toggle + \"quizz\" +
+
+ \"Logo\" +
+
+ \"user\" +
+
"; + yield from []; + } + + /** + * @codeCoverageIgnore + */ + public function getTemplateName(): string + { + return "bandeau.html.twig"; + } + + /** + * @codeCoverageIgnore + */ + public function getDebugInfo(): array + { + return array ( 42 => 1,); + } + + public function getSourceContext(): Source + { + return new Source("", "bandeau.html.twig", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/bandeau.html.twig"); + } +} diff --git a/cache/b8/b8bf2b0d7583c567fbc28aec381ed411.php b/cache/b8/b8bf2b0d7583c567fbc28aec381ed411.php index 164ff94..287342a 100644 --- a/cache/b8/b8bf2b0d7583c567fbc28aec381ed411.php +++ b/cache/b8/b8bf2b0d7583c567fbc28aec381ed411.php @@ -1,150 +1,150 @@ - - */ - private array $macros = []; - - public function __construct(Environment $env) - { - parent::__construct($env); - - $this->source = $this->getSourceContext(); - - $this->parent = false; - - $this->blocks = [ - ]; - } - - protected function doDisplay(array $context, array $blocks = []): iterable - { - $macros = $this->macros; - // line 1 - yield " - -
- env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["srcImg"] ?? null), "html", null, true); - yield "\" alt=\""; - yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["nameCarac"] ?? null), "html", null, true); - yield "\"> -

- - "; - // line 7 - yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["quoteContent"] ?? null), "html", null, true); - yield " - -

-
    -
  • - "; - // line 12 - yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["sourceName"] ?? null), "html", null, true); - yield " -
  • -
  • - "; - // line 15 - yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["nameCarac"] ?? null), "html", null, true); - yield " -
  • -
  • - "; - // line 18 - yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["dateSortie"] ?? null), "html", null, true); - yield " -
  • -
-
-

- "; - // line 23 - yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["nbLike"] ?? null), "html", null, true); - yield " -

-
-
-
- "; - // line 28 - if ((Twig\Extension\CoreExtension::length($this->env->getCharset(), ($context["comment"] ?? null)) > 0)) { - yield "
- "; - // line 29 - $context['_parent'] = $context; - $context['_seq'] = CoreExtension::ensureTraversable(($context["comment"] ?? null)); - foreach ($context['_seq'] as $context["_key"] => $context["com"]) { - // line 30 - yield "

"; - yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["com"], "user", [], "any", false, false, false, 30), "html", null, true); - yield "

-

"; - // line 31 - yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["com"], "content", [], "any", false, false, false, 31), "html", null, true); - yield "

- "; - } - $_parent = $context['_parent']; - unset($context['_seq'], $context['_key'], $context['com'], $context['_parent']); - $context = array_intersect_key($context, $_parent) + $_parent; - // line 32 - yield "
- "; - } - // line 34 - yield "
- -"; - yield from []; - } - - /** - * @codeCoverageIgnore - */ - public function getTemplateName(): string - { - return "quote.html"; - } - - /** - * @codeCoverageIgnore - */ - public function isTraitable(): bool - { - return false; - } - - /** - * @codeCoverageIgnore - */ - public function getDebugInfo(): array - { - return array ( 116 => 34, 112 => 32, 104 => 31, 99 => 30, 95 => 29, 91 => 28, 83 => 23, 75 => 18, 69 => 15, 63 => 12, 55 => 7, 47 => 4, 42 => 1,); - } - - public function getSourceContext(): Source - { - return new Source("", "quote.html", "/home/www/kekentin/public_html/WF/WF-Website/vue/templates/quote.html"); - } -} + + */ + private array $macros = []; + + public function __construct(Environment $env) + { + parent::__construct($env); + + $this->source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 1 + yield " + +
+ env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["srcImg"] ?? null), "html", null, true); + yield "\" alt=\""; + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["nameCarac"] ?? null), "html", null, true); + yield "\"> +

+ + "; + // line 7 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["quoteContent"] ?? null), "html", null, true); + yield " + +

+
    +
  • + "; + // line 12 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["sourceName"] ?? null), "html", null, true); + yield " +
  • +
  • + "; + // line 15 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["nameCarac"] ?? null), "html", null, true); + yield " +
  • +
  • + "; + // line 18 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["dateSortie"] ?? null), "html", null, true); + yield " +
  • +
+
+

+ "; + // line 23 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["nbLike"] ?? null), "html", null, true); + yield " +

+
+
+
+ "; + // line 28 + if ((Twig\Extension\CoreExtension::length($this->env->getCharset(), ($context["comment"] ?? null)) > 0)) { + yield "
+ "; + // line 29 + $context['_parent'] = $context; + $context['_seq'] = CoreExtension::ensureTraversable(($context["comment"] ?? null)); + foreach ($context['_seq'] as $context["_key"] => $context["com"]) { + // line 30 + yield "

"; + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["com"], "user", [], "any", false, false, false, 30), "html", null, true); + yield "

+

"; + // line 31 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["com"], "content", [], "any", false, false, false, 31), "html", null, true); + yield "

+ "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_key'], $context['com'], $context['_parent']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 32 + yield "
+ "; + } + // line 34 + yield "
+ +"; + yield from []; + } + + /** + * @codeCoverageIgnore + */ + public function getTemplateName(): string + { + return "quote.html"; + } + + /** + * @codeCoverageIgnore + */ + public function isTraitable(): bool + { + return false; + } + + /** + * @codeCoverageIgnore + */ + public function getDebugInfo(): array + { + return array ( 116 => 34, 112 => 32, 104 => 31, 99 => 30, 95 => 29, 91 => 28, 83 => 23, 75 => 18, 69 => 15, 63 => 12, 55 => 7, 47 => 4, 42 => 1,); + } + + public function getSourceContext(): Source + { + return new Source("", "quote.html", "/home/www/kekentin/public_html/WF/WF-Website/vue/templates/quote.html"); + } +} diff --git a/cache/f9/f92f69760ebb764380af0f11a2633512.php b/cache/f9/f92f69760ebb764380af0f11a2633512.php index 9f20119..200059a 100644 --- a/cache/f9/f92f69760ebb764380af0f11a2633512.php +++ b/cache/f9/f92f69760ebb764380af0f11a2633512.php @@ -1,102 +1,102 @@ - - */ - private array $macros = []; - - public function __construct(Environment $env) - { - parent::__construct($env); - - $this->source = $this->getSourceContext(); - - $this->parent = false; - - $this->blocks = [ - ]; - } - - protected function doDisplay(array $context, array $blocks = []): iterable - { - $macros = $this->macros; - // line 1 - yield "
-
-
- \"coeur\" - \"toggle - \"quizz\" -
-
- \"Logo\" -
-
- \"user\" -
-
-
-

▶ Connexion ◀

- -
-

Identifiant *

- - -

Mot de passe *

- - -
-

Vous n'avez pas de compte?

- S'incrire -
- - -
- -
- -
- -"; - yield from []; - } - - /** - * @codeCoverageIgnore - */ - public function getTemplateName(): string - { - return "login.html"; - } - - /** - * @codeCoverageIgnore - */ - public function getDebugInfo(): array - { - return array ( 42 => 1,); - } - - public function getSourceContext(): Source - { - return new Source("", "login.html", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/login.html"); - } -} + + */ + private array $macros = []; + + public function __construct(Environment $env) + { + parent::__construct($env); + + $this->source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 1 + yield "
+
+
+ \"coeur\" + \"toggle + \"quizz\" +
+
+ \"Logo\" +
+
+ \"user\" +
+
+
+

▶ Connexion ◀

+ +
+

Identifiant *

+ + +

Mot de passe *

+ + +
+

Vous n'avez pas de compte?

+ S'incrire +
+ + +
+ +
+ +
+ +"; + yield from []; + } + + /** + * @codeCoverageIgnore + */ + public function getTemplateName(): string + { + return "login.html"; + } + + /** + * @codeCoverageIgnore + */ + public function getDebugInfo(): array + { + return array ( 42 => 1,); + } + + public function getSourceContext(): Source + { + return new Source("", "login.html", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/login.html"); + } +} diff --git a/citation.txt b/citation.txt index 528e2a4..bec2a48 100644 --- a/citation.txt +++ b/citation.txt @@ -1,372 +1,372 @@ - -Dans le monde il n’y a pas d’un côté le bien et le mal, il y a une part de lumière et d’ombre en chacun de nous. Ce qui compte c’est celle que l’on choisit de montrer dans nos actes, ça c’est ce que l’on est vraiment.; Harry Potter et L’ordre du Phoenix; Sirius Black; 2001; https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137&h=195&c=7&r=0&o=5&pid=1.7 - -Il faut du courage pour affronter ses ennemis mais il en faut encore plus pour affronter ses amis…; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 - -Ce ne sont pas vos ressemblances qui comptent Harry, ce sont vos différences.; Harry Potter et L’ordre du Phoenix; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 - -Le problème, c’est que les humains ont un don pour désirer ce qui leur fait le plus de mal.; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 - -Ce dont vous avez le plus peur est la peur elle-même, c’est une preuve de sagesse.; Harry Potter et le prisonnier d’Azkaban; Remus Lupin; 2001; https://tse1.mm.bing.net/th/id/OIP.01EekTJQq0yQ9QQ_aNq87gHaJ-?w=162&h=218&c=7&r=0&o=5&pid=1.7 - -J’ai tout appris dans les livres. Mais il y a des choses beaucoup plus importantes, le courage, l’amitié.; Harry Potter à l’école des sorciers; Hermione; 2001; https://tse2.mm.bing.net/th/id/OPEC.aBKNyvpNlyyj9g474C474?w=186&h=241&o=5&pid=1.7 - -Tout est possible du moment qu’on a assez de cran.; Harry Potter et L’ordre du Phoenix; Ginny Weasley; 2001; https://tse3.mm.bing.net/th/id/OIP.QwHMbOI-N9zfJ_Re9I65ggHaJ1?w=140&h=187&c=7&r=0&o=5&pid=1.7 - -Ça ne fait pas grand bien de s’installer dans les rêves en oubliant de vivre…; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 - -Nous avons parié, mon père et moi. Je ne crois pas que tu tiendras dix minutes dans ce tournoi. Lui, il n’est pas d’accord, il croit que tu n’en tiendras pas cinq.; Harry Potter et la coupe de feu; Drago Malefoy; 2001; https://tse2.mm.bing.net/th/id/OIP.CthWIxuLm0a8THOguTDB_AAAAA?w=157&h=207&c=7&r=0&o=5&pid=1.7 - -C’est de la force des convictions que dépend la réussite, pas du nombre des partisans.; Harry Potter et les reliques de la mort - 2e partie; Remus Lupin; 2001; https://tse1.mm.bing.net/th/id/OIP.01EekTJQq0yQ9QQ_aNq87gHaJ-?w=162&h=218&c=7&r=0&o=5&pid=1.7 - -Je me fiche éperdument de ce que pense ton père, Malefoy. Il est vil et cruel. Et toi, tu es pathétique.; Harry Potter et la coupe de feu; Harry; 2001; https://tse3.mm.bing.net/th/id/OIP.IV9gltTWHTVtnezyCVXjwAHaJ4?w=120&h=180&c=7&r=0&o=5&pid=1.7 - -J’ai lu dans ton cœur, et ton cœur est mien.; Harry Potter et les reliques de la mort - 1re partie; Lord Voldemort; 2001; https://tse2.mm.bing.net/th/id/OIP.B9RbuWnpmV-7fI8v-H0G8gHaEK?w=290&h=180&c=7&r=0&o=5&pid=1.7 - -Dans le monde il n’y a pas d’un côté le bien et le mal, il y a une part de lumière et d’ombre en chacun de nous. Ce qui compte c’est celle que l’on choisit de montrer dans nos actes, ça c’est ce que l’on est vraiment.; Harry Potter et L’ordre du Phoenix; Sirius Black; 2001; https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137&h=195&c=7&r=0&o=5&pid=1.7 - -Il faut du courage pour affronter ses ennemis mais il en faut encore plus pour affronter ses amis…; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 - -Ce ne sont pas nos capacités qui déterminent ce que nous sommes, Harry, ce sont nos choix !; Harry Potter et la chambre des secrets; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 - -Ce ne sont pas vos ressemblances qui comptent Harry, ce sont vos différences.; Harry Potter et L’ordre du Phoenix; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 - -Le problème, c’est que les humains ont un don pour désirer ce qui leur fait le plus de mal.; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 - -Ce dont vous avez le plus peur est la peur elle-même, c’est une preuve de sagesse.; Harry Potter et le prisonnier d’Azkaban; Remus Lupin; 2001; https://tse1.mm.bing.net/th/id/OIP.01EekTJQq0yQ9QQ_aNq87gHaJ-?w=162&h=218&c=7&r=0&o=5&pid=1.7 - -J’ai tout appris dans les livres. Mais il y a des choses beaucoup plus importantes, le courage, l’amitié.; Harry Potter à l’école des sorciers; Hermione; 2001; https://tse1.mm.bing.net/th/id/OIP.DNVVrGRcxyoXfy8Nqn4DnwHaJ4?w=194&h=259&c=7&r=0&o=5&pid=1.7 - -Tout est possible du moment qu’on a assez de cran.; Harry Potter et L’ordre du Phoenix; Ginny Weasley; 2001; https://tse3.mm.bing.net/th/id/OIP.QwHMbOI-N9zfJ_Re9I65ggHaJ1?w=140&h=187&c=7&r=0&o=5&pid=1.7 - -Ça ne fait pas grand bien de s’installer dans les rêves en oubliant de vivre…; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 - -Nous avons parié, mon père et moi. Je ne crois pas que tu tiendras dix minutes dans ce tournoi. Lui, il n’est pas d’accord, il croit que tu n’en tiendras pas cinq.; Harry Potter et la coupe de feu; Drago Malefoy; 2001; https://tse2.mm.bing.net/th/id/OIP.CthWIxuLm0a8THOguTDB_AAAAA?w=157&h=207&c=7&r=0&o=5&pid=1.7 - -C’est de la force des convictions que dépend la réussite, pas du nombre des partisans.; Harry Potter et les reliques de la mort - 2e partie; Remus Lupin; 2001; https://tse1.mm.bing.net/th/id/OIP.01EekTJQq0yQ9QQ_aNq87gHaJ-?w=162&h=218&c=7&r=0&o=5&pid=1.7 - -Je me fiche éperdument de ce que pense ton père, Malefoy. Il est vil et cruel. Et toi, tu es pathétique.; Harry Potter et la coupe de feu; Harry; 2001; https://tse3.mm.bing.net/th/id/OIP.IV9gltTWHTVtnezyCVXjwAHaJ4?w=120&h=180&c=7&r=0&o=5&pid=1.7 - -J’ai lu dans ton cœur, et ton cœur est mien.; Harry Potter et les reliques de la mort - 1re partie; Lord Voldemort; 2001; https://tse2.mm.bing.net/th/id/OIP.B9RbuWnpmV-7fI8v-H0G8gHaEK?w=290&h=180&c=7&r=0&o=5&pid=1.7 - -N’essaie pas ! Fais-le, ou ne le fais pas ! Il n’y a pas d’essai.; Star Wars : Episode 5 - L’empire contre-attaque; Yoda; 1977; https://tse4.mm.bing.net/th/id/OIP.n7EwvRfr2000cw-wPd84BwHaEo?w=244&h=180&c=7&r=0&o=5&pid=1.7 - -Que la Force soit avec toi…; Star Wars : Episode 4 - Un nouvel espoir; Obi-Wan; 1977; https://tse3.mm.bing.net/th/id/OIP.J7Kmtok0f2mQT7iX_JA_5QHaE8?w=218&h=180&c=7&r=0&o=5&pid=1.7 - -Je suis ton père.; Star Wars : Episode 5 - L’empire contre-attaque; Dark Vador; 1977; https://tse3.mm.bing.net/th/id/OIP.r0YMrIo2bkQFbcmZLdrVVAHaEK?w=294&h=180&c=7&r=0&o=5&pid=1.7 - -La prophétie voulait que tu détruises les Sith pas que tu deviennes comme eux !; Star Wars : Episode 3 - La revanche des sith; Obi-Wan; 1977; https://tse3.mm.bing.net/th/id/OIP.J7Kmtok0f2mQT7iX_JA_5QHaE8?w=218&h=180&c=7&r=0&o=5&pid=1.7 - -Il y en a toujours un pour manger l’autre !; Star Wars : Episode 1 - La menace fantôme; Qui-Gon Jinn; 1977; https://tse2.mm.bing.net/th/id/OIP.oZP8cTT95_4nR6VK5uB7QgHaKH?w=133&h=183&c=7&r=0&o=5&pid=1.7 - -Qui est le plus fou des deux, le fou ou le fou qui le suit ?; Star Wars : Episode 4 - Un nouvel espoir; Obi-Wan; 1977; https://tse3.mm.bing.net/th/id/OIP.J7Kmtok0f2mQT7iX_JA_5QHaE8?w=218&h=180&c=7&r=0&o=5&pid=1.7 - -S’il y a un point central dans cet univers, tu es sur la planète qui en est le plus éloigné…; Star Wars : Episode 4 - Un nouvel espoir; Luke; 1977; https://tse2.mm.bing.net/th/id/OIP.N2JpjF9aPxvz9vZYEOjc2QHaFj?w=177&h=180&c=7&r=0&o=5&pid=1.7 - -Si c’est pour l’argent que vous faites ça, alors c’est tout ce que vous recevrez !; Star Wars : Episode 4 - Un nouvel espoir; Leia; 1977; https://tse2.mm.bing.net/th/id/OIP.P5CMgdStIPfYvfNky4Kh7QHaLF?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Je sais ce qu’il faut que je fasse mais je ne sais pas si j’en aurai la force.; Star Wars : Episode 7 - Le réveil de la force; Kylo Ren; 1977; https://tse1.mm.bing.net/th/id/OIP.HlRkAcz7BjIBsRU59L4owAHaHa?w=149&h=180&c=7&r=0&o=5&pid=1.7 - -La mort est une partie naturelle de la vie.; Star Wars : Episode 3 - La revanche des sith; Yoda; 1977; https://tse4.mm.bing.net/th/id/OIP.n7EwvRfr2000cw-wPd84BwHaEo?w=244&h=180&c=7&r=0&o=5&pid=1.7 - -Votre manque de foi me consterne.; Star Wars : Episode 4 - Un nouvel espoir; Dark Vador; 1977; https://tse3.mm.bing.net/th/id/OIP.r0YMrIo2bkQFbcmZLdrVVAHaEK?w=294&h=180&c=7&r=0&o=5&pid=1.7 - -Il ne faut jamais sous-estimer un droïde.; Star Wars : Episode 9 - L'ascension de Skywalker; Leia; 1977; https://tse2.mm.bing.net/th/id/OIP.P5CMgdStIPfYvfNky4Kh7QHaLF?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Tu as peur de ne jamais être aussi fort que Dark Vador.; Star Wars : Episode 7 - Le réveil de la force; Rey; 1977; https://tse3.mm.bing.net/th/id/OIP.pPDkRAfYT1rldQW1FRuxaAHaJQ?w=123&h=180&c=7&r=0&o=5&pid=1.7 - -Vous ne passerez pas !; Le seigneur des anneaux : la communauté de l’anneau; Gandalf; 2001; https://tse2.mm.bing.net/th/id/OIP.ztKYa5HLhCKgVkY0GZ4rSAHaJ4?w=71&h=180&c=7&r=0&o=5&pid=1.7 - -Il y a du bon dans ce monde, et il faut se battre pour cela.; Le seigneur des anneaux : la communauté de l’anneau; Sam; 2001; https://tse4.mm.bing.net/th/id/OIP.edxwKxyoPXfV7_DSTeerFAHaHa?w=180&h=180&c=7&r=0&o=5&pid=1.7 - -Je ne vous dirais pas de ne pas pleurer car toutes les larmes ne sont pas un mal.; Le Seigneur des anneaux : le retour du roi; Gandalf; 2001; https://tse2.mm.bing.net/th/id/OIP.ztKYa5HLhCKgVkY0GZ4rSAHaJ4?w=71&h=180&c=7&r=0&o=5&pid=1.7 - -Je ne peux le porter pour vous, mais je peux vous porter vous !; Le Seigneur des anneaux : le retour du roi; Sam; 2001; https://tse4.mm.bing.net/th/id/OIP.edxwKxyoPXfV7_DSTeerFAHaHa?w=180&h=180&c=7&r=0&o=5&pid=1.7 - -Et bien, c’est plus gai dans un cimetière…; Le seigneur des anneaux : les deux tours; Gimli; 2001; https://tse1.mm.bing.net/th/id/OIP.RzN-g8st6li9R5HA3IIrQgHaF3?w=215&h=180&c=7&r=0&o=5&pid=1.7 - -Mon précieux.; Le seigneur des anneaux : la communauté de l’anneau; Gollum; 2001; https://tse2.mm.bing.net/th/id/OIP.s8Egh2FBsKGr6QdkdWEPnwHaE6?w=212&h=180&c=7&r=0&o=5&pid=1.7 - -Je vous aurais suivi mon frère, mon capitaine, mon roi.; Le seigneur des anneaux : la communauté de l’anneau; Boromir; 2001; https://tse1.mm.bing.net/th/id/OIP._uHLsNbgnf1m1vK3ZWE2UAHaEo?w=217&h=180&c=7&r=0&o=5&pid=1.7 - -On nous a envoyé sauver la Comté Sam, et elle a été sauvée. Mais, pas pour moi…; Le Seigneur des anneaux : le retour du roi; Frodon; 2001; https://tse2.mm.bing.net/th/id/OIP.PPIESqZaNDa-qUcfSDXhdQHaGK?w=210&h=180&c=7&r=0&o=5&pid=1.7 - -Et mon arc est vôtre !; Le seigneur des anneaux : la communauté de l’anneau; Legolas; 2001; https://tse1.mm.bing.net/th/id/OIP.-8TP3nkEc30yCD1PolGRbQHaJW?w=194&h=245&c=7&r=0&o=5&pid=1.7 - -Toutes les larmes ne sont pas un mal.; Le Seigneur des anneaux : le retour du roi; Gandalf; 2001; https://tse2.mm.bing.net/th/id/OIP.ztKYa5HLhCKgVkY0GZ4rSAHaJ4?w=71&h=180&c=7&r=0&o=5&pid=1.7 - -Je suis Gandhalf le blanc, et je reviens vers vous en ce moment décisif.; Le seigneur des anneaux : les deux tours; Gandalf; 2001; https://tse2.mm.bing.net/th/id/OIP.ztKYa5HLhCKgVkY0GZ4rSAHaJ4?w=71&h=180&c=7&r=0&o=5&pid=1.7 - -Tout ce que nous avons à décider, c’est ce que nous devons faire du temps qui nous est imparti.; Le seigneur des anneaux : la communauté de l’anneau; Gandalf; 2001; https://tse2.mm.bing.net/th/id/OIP.ztKYa5HLhCKgVkY0GZ4rSAHaJ4?w=71&h=180&c=7&r=0&o=5&pid=1.7 - -Si par ma vie ou ma mort je peux vous protéger je le ferai ! - Mon épée est votre !; Le seigneur des anneaux : la communauté de l’anneau; Aragorn; 2001; https://tse1.mm.bing.net/th/id/OIP.GQ9p5tZGZBKv3fURChVROwE7DG?w=260&h=180&c=7&r=0&o=5&pid=1.7 - -Pour Frodon.; Le Seigneur des anneaux : le retour du roi; Aragorn; 2001; https://tse1.mm.bing.net/th/id/OIP.GQ9p5tZGZBKv3fURChVROwE7DG?w=260&h=180&c=7&r=0&o=5&pid=1.7 - -Mes amis… ce n’est pas à vous de vous incliner.; Le Seigneur des anneaux : le retour du roi; Aragorn; 2001; https://tse1.mm.bing.net/th/id/OIP.GQ9p5tZGZBKv3fURChVROwE7DG?w=260&h=180&c=7&r=0&o=5&pid=1.7 - -Si Dieu est tout puissant, alors il ne peut pas être tout bienfaisant. Et s’il est tout bienfaisant, c’est qu’il ne peut pas être tout puissant.; Batman v Superman : l’aube de la justice; Lex Luthor; 1989; https://tse3.mm.bing.net/th/id/OIP.S4q6m2na1Rxkc7xZ1lcfKQHaJe?w=135&h=180&c=7&r=0&o=5&pid=1.7 - -Je ne vais pas vous tuer… mais rien ne m’oblige à vous sauver.; Batman begins; Batman; 1989; https://tse1.mm.bing.net/th/id/OIP.k-xCm-NCW6Dxah3T2FlcFQHaEK?w=326&h=183&c=7&r=0&o=5&pid=1.7 - -Ne compte pas me mettre au frais !; Batman & Robin; Mr. Freeze; 1989; https://tse1.mm.bing.net/th/id/OIP.c5hOJMCbBn2CugR3e1ltNQHaIh?w=194&h=223&c=7&r=0&o=5&pid=1.7 - -Que la farce soit avec toi.; Batman, la série animée; le Joker; 1989; https://tse2.mm.bing.net/th/id/OIP.RrJkua2jY_o24eUG7wmk8QHaE-?w=232&h=180&c=7&r=0&o=5&pid=1.7 - -Tu sais, si t’as l’intention de voler des voitures, te déguises pas en voleur de voitures.; The Amazing Spider-Man; Peter Parker; 2002; https://tse1.mm.bing.net/th/id/OIP.OpPUQy_RrqL5sMd_KR7D8gHaD4?w=283&h=180&c=7&r=0&o=5&pid=1.7 - -Ne t’excuse jamais d’être le plus malin de la bande.; Spider-Man : Far From Home; Quentin Beck; 2002; https://tse4.mm.bing.net/th/id/OIP._ROT4QN7TDwCQHn6OLEswAHaEK?w=299&h=180&c=7&r=0&o=5&pid=1.7 - -Tu en fais trop : les études, le boulot, tout le temps que tu passes avec moi… Tu n’es pas Superman tu sais !; Spider-Man; May Parker; 2002; https://tse1.mm.bing.net/th/id/OIP.Fzb2IGNnUPn1wc_ne1cqgAHaL2?w=119&h=191&c=7&r=0&o=5&pid=1.7 - -Jarvis, il faut parfois savoir courir avant de savoir marcher.; Iron Man; Tony Stark; 2008; https://tse2.mm.bing.net/th/id/OIP.s4nqc0QluImn7arGZTfurQHaI7?w=131&h=180&c=7&r=0&o=5&pid=1.7 - -Les records sont fait pour être battus !; Iron Man; Tony Stark; 2008; https://tse2.mm.bing.net/th/id/OIP.s4nqc0QluImn7arGZTfurQHaI7?w=131&h=180&c=7&r=0&o=5&pid=1.7 - -Absorbez la pression, ne me la transmettez pas.; Iron Man; Tony Stark; 2008; https://tse2.mm.bing.net/th/id/OIP.s4nqc0QluImn7arGZTfurQHaI7?w=131&h=180&c=7&r=0&o=5&pid=1.7 - -C’est comme dans un rêve.; Iron Man; Tony Stark; 2008; https://tse2.mm.bing.net/th/id/OIP.s4nqc0QluImn7arGZTfurQHaI7?w=131&h=180&c=7&r=0&o=5&pid=1.7 - -La merde se crée toute seule, je ne fais que la remuer.; Deadpool; Wade / Deadpool; 2016; https://tse3.mm.bing.net/th/id/OIP.wYPg61JNUvsouPzwUhr0-QHaHa?w=162&h=180&c=7&r=0&o=5&pid=1.7 - -µ; Je parie que Vulverine en a une jolie paire dans son slip kangourou.; Deadpool; Wade / Deadpool; 2016; https://tse3.mm.bing.net/th/id/OIP.wYPg61JNUvsouPzwUhr0-QHaHa?w=162&h=180&c=7&r=0&o=5&pid=1.7 - -La plupart des gens sont condamnés à ne jamais rien voir au delà de ce que leurs yeux leur disent…; X-men 2; Kurt Wagner; 2000; https://tse3.mm.bing.net/th/id/OIP.hyDe8SvEEvDhmKfsQBqWEwHaJ8?w=194&h=261&c=7&r=0&o=5&pid=1.7 - -Disons que je suis le monstre de Frankenstein, et que je cherche mon créateur.; X-Men : Le commencement; Magneto; 2000; https://tse2.mm.bing.net/th/id/OIP.7eXM4Na7unM6BWLJcapqVwHaJ4?w=194&h=259&c=7&r=0&o=5&pid=1.7 - -Tu vaux tellement plus que ce que tu ne crois. Il n’y a pas que la douleur, la colère, tu as du cœur aussi, je l’ai vu en toi. Ce n’est pas qu’à moi que tu tournes le dos. Ici tu as une chance de faire partie d’une chose beaucoup plus grande que toi, une chose qui a besoin de toi.; X-Men : Apocalypse; Professeur Charles Xavier; 2000; https://tse3.mm.bing.net/th/id/OIP.lDzxwo1weGaA-hRMfV6bYwHaGp?w=194&h=174&c=7&r=0&o=5&pid=1.7 - -Elle ne me laisse pas faire !; X-men 2; Kurt Wagner; 2000; https://tse3.mm.bing.net/th/id/OIP.hyDe8SvEEvDhmKfsQBqWEwHaJ8?w=194&h=261&c=7&r=0&o=5&pid=1.7 - -Si je suis venu, c’est que je n’avais pas le choix. Je suis venu sauver mon monde, les personnes que j’aime. Et je suis venu parce-que le trident est leur seul espoir. Et si ça suffit pas comme raison, tu peux aller te faire foutre.; Aquaman; Arthur; 2018; https://tse3.mm.bing.net/th/id/OIP.Vbj0KGYQt_M2kAZNEdX3lQHaLb?w=194&h=299&c=7&r=0&o=5&pid=1.7 - -Un homme qui ne passe pas de temps avec sa famille n’est pas vraiment un homme.; Le parrain; Vito Corleone; 1972; https://tse2.mm.bing.net/th/id/OIP.jzIdpLlEe-MQogtqU8kAxAHaHa?w=149&h=180&c=7&r=0&o=5&pid=1.7 - -Il ne faut pas surestimer le pouvoir de pardonner.; Le Parrain, 3ème partie; Michael Corleone; 1972; https://tse2.mm.bing.net/th/id/OIP.2tQ82oaA3J3wmLyBBjrgWAHaJF?w=138&h=180&c=7&r=0&o=5&pid=1.7 - -Il ne faut pas que sa mère le voit dans cet état.; Le parrain; Vito Corleone; 1972; https://tse2.mm.bing.net/th/id/OIP.jzIdpLlEe-MQogtqU8kAxAHaHa?w=149&h=180&c=7&r=0&o=5&pid=1.7 - -Le pouvoir ça se donne pas ça se prend.; Le Parrain, 3ème partie; Michael Corleone; 1972; https://tse2.mm.bing.net/th/id/OIP.2tQ82oaA3J3wmLyBBjrgWAHaJF?w=138&h=180&c=7&r=0&o=5&pid=1.7 - -Ce qui ne me tue pas me rend plus… bizarre.; The Dark Knight: Le Chevalier noir; le Joker; 2008; https://tse4.mm.bing.net/th/id/OIP.FKM9RHVwmPE_eTQm6cvlbgHaLL?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Je suis comme un chien enragé qui court après une voiture, mais si j’en attrape une je ne sais pas à quoi elle me serait utile.; The Dark Knight: Le Chevalier noir; le Joker; 2008; https://tse4.mm.bing.net/th/id/OIP.FKM9RHVwmPE_eTQm6cvlbgHaLL?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Bien le bonsoir, je suis l’animation de la soirée !; The Dark Knight: Le Chevalier noir; le Joker; 2008; https://tse4.mm.bing.net/th/id/OIP.FKM9RHVwmPE_eTQm6cvlbgHaLL?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Vous voyez ce stylo ? Je vais le faire disparaître *BIM*. - Et voila, il a disparu.; The Dark Knight: Le Chevalier noir; le Joker; 2008; https://tse4.mm.bing.net/th/id/OIP.FKM9RHVwmPE_eTQm6cvlbgHaLL?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Ce ne sont pas juste des rêves, ce sont des souvenirs et tu as dit de ne jamais utiliser des souvenirs !; Inception; Ariadne; 2010; https://tse2.mm.bing.net/th/id/OIP.xkBsnyA8BI1MgSGbQpFhOQAAAA?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Il ne suffit pas de se mettre une plume dans le cul pour ressembler à un coq.; Fight Club; Tyler; 1999; https://tse2.mm.bing.net/th/id/OIP.GKlbhFXb8PhWKTBgLYCRNAHaHX?w=176&h=180&c=7&r=0&o=5&pid=1.7 - -Je le considère comme un impôt sur la connerie.; Fight Club; Marla; 1999; https://tse4.mm.bing.net/th/id/OIP.nFqhuPIEX-oV0i8PWjC1DwHaEx?w=186&h=180&c=7&r=0&o=5&pid=1.7 - -Si j’avais vraiment une tumeur je la nommerais Marla… Marla, la petite écorchure qu’on a sur le palais et qui ne peut cicatriser que si on ne cesse de la lécher. Mais on ne peut pas.; Fight Club; le narrateur; 1999; https://tse4.mm.bing.net/th/id/OIP.OQFYbcxGZsFJlvLIT8jrLAHaDt?w=310&h=180&c=7&r=0&o=5&pid=1.7 - -Je veux que tu saches, au lieu d’en avoir peur, que tu saches que tu mourras un jour.; Fight Club; Tyler; 1999; https://tse2.mm.bing.net/th/id/OIP.GKlbhFXb8PhWKTBgLYCRNAHaHX?w=176&h=180&c=7&r=0&o=5&pid=1.7 - -Vous avez une sorte de désespoir hystérique dans votre rire.; Fight Club; Tyler; 1999; https://tse2.mm.bing.net/th/id/OIP.GKlbhFXb8PhWKTBgLYCRNAHaHX?w=176&h=180&c=7&r=0&o=5&pid=1.7 - -Je veux que tu me frappes aussi fort que tu peux.; Fight Club; Tyler; 1999; https://tse2.mm.bing.net/th/id/OIP.GKlbhFXb8PhWKTBgLYCRNAHaHX?w=176&h=180&c=7&r=0&o=5&pid=1.7 - -Je le sais, parce que Tyler le sait.; Fight Club; le narrateur; 1999; https://tse4.mm.bing.net/th/id/OIP.OQFYbcxGZsFJlvLIT8jrLAHaDt?w=310&h=180&c=7&r=0&o=5&pid=1.7 - -Je fabrique et je vends du savon, l’objet qui indique le degré de civilisation.; Fight Club; Tyler; 1999; https://tse2.mm.bing.net/th/id/OIP.GKlbhFXb8PhWKTBgLYCRNAHaHX?w=176&h=180&c=7&r=0&o=5&pid=1.7 - -Pas de peur, pas d’affolement, et la faculté d’ignorer totalement ce qui est sans importance.; Fight Club; le narrateur; 1999; https://tse4.mm.bing.net/th/id/OIP.OQFYbcxGZsFJlvLIT8jrLAHaDt?w=310&h=180&c=7&r=0&o=5&pid=1.7 - -Si vous le voulez bien, on se taillera des pipes plus tard, les enfants.; Pulp Fiction; The Wolf; 1994; https://tse4.mm.bing.net/th/id/OIP.fc5TQflh0cbxB1GUeOdk6gHaK8?w=123&h=180&c=7&r=0&o=5&pid=1.7 - -Je fais le mort dans la 5e.; Pulp Fiction; Butch; 1994; https://tse1.mm.bing.net/th/id/OIP.luN_zVQJt2Kyf7H_kSrPyQHaJD?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Je courrais toujours pour aller partout, mais je ne pensais pas pour autant que ça allait me mener quelque part.; Forrest Gump; Forrest Gump; 1994; https://tse3.mm.bing.net/th/id/OIP.GT8e1PVP9IQvdn49uMVgeAHaE0?w=262&h=180&c=7&r=0&o=5&pid=1.7 - -Je ne sais pas si c’est maman qui avait raison ou si c’est le lieutenant Dan… Je sais pas si nous avons chacun un destin… ou si nous… si nous nous laissons porter par le hasard comme sur une brise… Mais je… je crois que c’est peut-être un peu des deux… peut-être un peu des deux arrive en même temps.; Forrest Gump; Forrest Gump; 1994; https://tse3.mm.bing.net/th/id/OIP.GT8e1PVP9IQvdn49uMVgeAHaE0?w=262&h=180&c=7&r=0&o=5&pid=1.7 - -Vous ne croirez pas si je vous le disais, mais je cours comme souffle le vent. À partir de ce jour, dès que j’allais quelque part, je le faisais en courant.; Forrest Gump; Forrest Gump; 1994; https://tse3.mm.bing.net/th/id/OIP.GT8e1PVP9IQvdn49uMVgeAHaE0?w=262&h=180&c=7&r=0&o=5&pid=1.7 - -Nous ne sommes pas ici parce que nous sommes libres, nous sommes ici parce que nous ne le sommes pas.; The Matrix Reloaded; Agent Smith; 1999; https://tse4.mm.bing.net/th/id/OIP.1mHiCYi8mwl6uzmVk0JZ3AHaJQ?w=141&h=180&c=7&r=0&o=5&pid=1.7 - -Tu prends la pilule bleue, l’histoire s’arrête là, tu te réveilles dans ton lit, et tu crois ce que tu veux. Tu prends la pilule rouge, tu restes au Pays des Merveilles et je te montre jusqu’où va le terrier.; Matrix; Morpheus; 1999; https://tse4.mm.bing.net/th/id/OIP.HHsnDYoQ9ZZwLthfRpMNugHaEL?w=291&h=180&c=7&r=0&o=5&pid=1.7 - -Le choix est une illusion créée entre ceux qui ont le pouvoir et ceux qui ne l’ont pas.; The Matrix Reloaded; le mérovingien; 1999; https://tse4.mm.bing.net/th/id/OIP.vku_hB1875k65Vxs1GKm_wAAAA?w=333&h=184&c=7&r=0&o=5&pid=1.7 - -Le pouvoir génétique est la force la plus terrible que la planète ait connu, mais vous la maniez comme un enfant qui a trouvé le flingue de son père !; Jurassic park; Ian Malcolm; 1993; https://tse1.mm.bing.net/th/id/OIP.H7i5IHvFUZl9DgyVtITn_wHaEK?w=296&h=180&c=7&r=0&o=5&pid=1.7 - -Il nous abandonne ! Il nous abandonne !; Jurassic park; Lex; 1993; https://tse4.mm.bing.net/th/id/OIP.ckCQ_jiHNatyzti0Fnq4PQHaED?w=317&h=180&c=7&r=0&o=5&pid=1.7 - -Ils se déplacent en troupeaux ! Ils se déplacent en troupeaux !; Jurassic park; Alan Grant; 1993; https://tse2.mm.bing.net/th/id/OIP.TJuWNCsibz8MVmhdNQEdMwHaE8?w=254&h=180&c=7&r=0&o=5&pid=1.7 - -Son acuité visuelle est basée sur le mouvement.; Jurassic park; Ian Malcolm; 1993; https://tse1.mm.bing.net/th/id/OIP.H7i5IHvFUZl9DgyVtITn_wHaEK?w=296&h=180&c=7&r=0&o=5&pid=1.7 - -Nous allons dans le seul endroit au monde où ce sont les oies qui vous chassent !; Le monde perdu; Ian Malcolm; 1993; https://tse1.mm.bing.net/th/id/OIP.H7i5IHvFUZl9DgyVtITn_wHaEK?w=296&h=180&c=7&r=0&o=5&pid=1.7 - -Ce que vous faites dans la vie résonne dans l’éternité.; Gladiator; Maximus; 2000; https://tse2.mm.bing.net/th/id/OIP.JfomwO3LzG6t7lsTTPtonAHaK7?w=117&h=180&c=7&r=0&o=5&pid=1.7 - -Le véritable cœur de Rome n’est pas dans le marbre du Sénat, mais dans le sable du Colisée.; Gladiator; Sénateur Gracchus; 2000; https://tse3.mm.bing.net/th/id/OIP.v7fsQh9Sd5LytyVQoez3cwHaE2?w=194&h=127&c=7&r=0&o=5&pid=1.7 - -La boue s’efface plus facilement que le sang.; Gladiator; Maximus; 2000; https://tse2.mm.bing.net/th/id/OIP.JfomwO3LzG6t7lsTTPtonAHaK7?w=117&h=180&c=7&r=0&o=5&pid=1.7 - -Mon nom est gladiator…; Gladiator; Maximus; 2000; https://tse2.mm.bing.net/th/id/OIP.JfomwO3LzG6t7lsTTPtonAHaK7?w=117&h=180&c=7&r=0&o=5&pid=1.7 - -Ils peuvent nous ôter la vie… Mais ils ne nous ôteront jamais notre liberté.; Braveheart; William Wallace; 1995; https://tse2.mm.bing.net/th/id/OIP.UICndeUgBDrka76aTOvAKQHaLH?w=147&h=220&c=7&r=0&o=5&pid=1.7 - -Ton cœur est libre, trouve le courage de le suivre.; Braveheart; Malcolm Wallace; 1995; https://tse2.mm.bing.net/th/id/OIP.7MO2w6ic7ik2arvdOTejHwHaLa?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Ils se battirent en guerrier et en poète. Ils se battirent en écossais et gagnèrent leur liberté.; Braveheart; William Wallace; 1995; https://tse2.mm.bing.net/th/id/OIP.UICndeUgBDrka76aTOvAKQHaLH?w=147&h=220&c=7&r=0&o=5&pid=1.7 - -Il les a tuées avec leur amour. C’est comme ça tous les jours dans le monde entier.; La Ligne Verte; John Coffey; 1999; https://tse4.mm.bing.net/th/id/OIP.loqNhw71Vk_C-TiyWQJoKAHaKK?w=95&h=180&c=7&r=0&o=5&pid=1.7 - -On ne peut pas cacher ce qu’on a dans son cœur.; La Ligne Verte; John Coffey; 1999; https://tse4.mm.bing.net/th/id/OIP.loqNhw71Vk_C-TiyWQJoKAHaKK?w=95&h=180&c=7&r=0&o=5&pid=1.7 - -C’est comme si j’avais des bouts de verres dans ma tête… tout le temps.; La Ligne Verte; John Coffey; 1999; https://tse4.mm.bing.net/th/id/OIP.loqNhw71Vk_C-TiyWQJoKAHaKK?w=95&h=180&c=7&r=0&o=5&pid=1.7 - -John tenait a me donner un peu de lui. Le jour ou il a saisit ma main, une partie de son pouvoir est entrée en moi. Il nous a condamné a la vie.; La Ligne Verte; Paul Edgecomb; 1999; https://tse1.mm.bing.net/th/id/OIP.csFLWCPUhS7NhdJT8-Cq-QHaEL?w=270&h=180&c=7&r=0&o=5&pid=1.7 - -J’ai rêvé de toi, j’ai rêvé que tu cherchais ton chemin dans la nuit, tout comme moi, et nous finissions par nous rencontrer… dans les ténèbres nous errions l’un et l’autre.; La Ligne Verte; Melinda Moores; 1999; https://tse4.mm.bing.net/th/id/OIP.6XMc0WCQbJ5xbzekralK7gHaD4?w=301&h=180&c=7&r=0&o=5&pid=1.7 - -Tout ce que je sais, c’est qu’à chaque fois que je tue un homme je m’éloigne un peu plus de chez moi.; Il faut sauver le soldat Ryan; le capitaine Miller; 1998; https://tse3.mm.bing.net/th/id/OIP.BeQYJEP1pQKzHDLGhTLBtgHaFj?w=243&h=182&c=7&r=0&o=5&pid=1.7 - -C’est toujours rassurant de voir que le monde est encore plus cinglé que vous !; Thor : le monde des Ténèbres; Erik Selvig; 2011; https://tse4.mm.bing.net/th/id/OIP.mbfvWIhPg0gZJA5FGmkilwHaFr?w=188&h=180&c=7&r=0&o=5&pid=1.7 - -La victoire au prix du sang des innocents n’est pas la victoire de la justice, c’est la victoire de la honte.; Captain America : civil war; le roi T’Chaka; 2011; https://tse3.mm.bing.net/th/id/OIP.eYavZu8-Xp11x2Pod8v6bQHaKw?w=194&h=282&c=7&r=0&o=5&pid=1.7 - -La vengeance est un déesse dévorante. Eux aussi en sont victimes… Je ne dois pas céder à son appel. La justice finira par triompher.; Captain America : civil war; T’Challa / Black Panther; 2011; https://tse4.mm.bing.net/th/id/OIP.XNQPKwc1OUfvnSO9MsxDYgHaE7?w=202&h=180&c=7&r=0&o=5&pid=1.7 - -Je fais les mêmes choses que Captain, mais plus lentement.; Captain America : le soldat de l'hiver; Sam Wilson; 2011; https://tse4.mm.bing.net/th/id/OIP.5XrvOjUpYQsABU-bnFQIxwHaK7?w=127&h=187&c=7&r=0&o=5&pid=1.7 - -Tu obtiens quoi si tu croises un aliéné mental solitaire avec une société qui l’abandonne dans son coin et le traite comme de la merde ? Je vais te le dire, moi, ce que tu obtiens ! Tu obtiens ce que tu mérites, enculé !; Joker; le Joker; 2019; https://tse3.mm.bing.net/th/id/OIP.P4hzN60jIU4IQ7WnfJHN5AHaJQ?w=135&h=180&c=7&r=0&o=5&pid=1.7 - -Est-ce moi, ou est-ce le monde qui devient de plus en plus fou ?; Joker; le Joker; 2019; https://tse3.mm.bing.net/th/id/OIP.P4hzN60jIU4IQ7WnfJHN5AHaJQ?w=135&h=180&c=7&r=0&o=5&pid=1.7 - -Tout ce que j’ai c’est des idées noires.; Joker; le Joker; 2019; https://tse3.mm.bing.net/th/id/OIP.P4hzN60jIU4IQ7WnfJHN5AHaJQ?w=135&h=180&c=7&r=0&o=5&pid=1.7 - -Ma mère me dit tout le temps de sourire, de faire bonne figure, elle m’a dit que j’avais une mission dans la vie : mettre du rire et de la joie dans ce monde.; Joker; le Joker; 2019; https://tse3.mm.bing.net/th/id/OIP.P4hzN60jIU4IQ7WnfJHN5AHaJQ?w=135&h=180&c=7&r=0&o=5&pid=1.7 - -L’espoir est la seule chose plus forte que la peur.; Hunger Games; le président Snow; 2012; https://tse1.mm.bing.net/th/id/OIP._zw8Sl9IsgfLzI_gd9SvRQHaEK?w=243&h=180&c=7&r=0&o=5&pid=1.7 - -Si je dois mourir, je préfère rester comme je suis…; Hunger Games; Peeta; 2012; https://tse4.mm.bing.net/th/id/OIP.a93tPzA08bhvfY-tSHHYBwHaIt?w=194&h=229&c=7&r=0&o=5&pid=1.7 - -Tu ne vas pas mourir. Je te l’interdis. D’accord ?; Hunger Games; Katniss; 2012; https://tse4.mm.bing.net/th/id/OIP.6PMXCMTZgkDKCkeY-NP6sAHaKB?w=145&h=197&c=7&r=0&o=5&pid=1.7 - -Il faut que tu gagnes, Katniss.; Hunger Games; Rue; 2012; https://tse3.mm.bing.net/th/id/OIP.nn0EAEXX7rZ2fIMSSDThGQAAAA?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Je ne veux pas perdre le garçon avec le pain.; Hunger Games; Peeta; 2012; https://tse4.mm.bing.net/th/id/OIP.a93tPzA08bhvfY-tSHHYBwHaIt?w=194&h=229&c=7&r=0&o=5&pid=1.7 - -On pourrait le faire tu sais, s’enfuir et vivre dans les bois.; Hunger Games; Gale; 2012; https://tse4.mm.bing.net/th/id/OIP.iuYaquLDGgV_o3vDOphh-gHaLH?w=127&h=191&c=7&r=0&o=5&pid=1.7 - -Acceptez la possibilité de votre mort imminente. Et comprenez au plus profond de vous que je ne pourrais rien faire pour vous sauver.; Hunger Games; Haymitch Abernathy; 2012; https://tse2.mm.bing.net/th/id/OIP.UKHYE8eX_v3E_G8OSFUcjQAAAA?w=142&h=180&c=7&r=0&o=5&pid=1.7 - -Tu pourrais vivre cent vies que tu ne le mériterais pas tu sais…; Hunger Games; Haymitch Abernathy; 2012; https://tse2.mm.bing.net/th/id/OIP.UKHYE8eX_v3E_G8OSFUcjQAAAA?w=142&h=180&c=7&r=0&o=5&pid=1.7 - -Il ne faut surtout pas te laisser aller. C’est dix fois plus long de se reconstruire que de s’écrouler.; Hunger Games : l’embrasement; Finnick Odair; 2012; https://tse2.mm.bing.net/th/id/OIP.3Je-oEIjxk44RyMF3nSi-gHaEK?w=289&h=180&c=7&r=0&o=5&pid=1.7 - -Tu veux un sucre.; Hunger Games : l’embrasement; Finnick Odair; 2012; https://tse2.mm.bing.net/th/id/OIP.3Je-oEIjxk44RyMF3nSi-gHaEK?w=289&h=180&c=7&r=0&o=5&pid=1.7 - -Il n’y a plus de district 12 Katniss.; Hunger Games : l’embrasement; Gale; 2012; https://tse4.mm.bing.net/th/id/OIP.iuYaquLDGgV_o3vDOphh-gHaLH?w=127&h=191&c=7&r=0&o=5&pid=1.7 - -Si nous brûlons, vous brûlerez avec nous !; Hunger Games : la révolte - 1re partie; Katniss; 2012; https://tse4.mm.bing.net/th/id/OIP.6PMXCMTZgkDKCkeY-NP6sAHaKB?w=145&h=197&c=7&r=0&o=5&pid=1.7 - -J’imagine que le moment est mal choisi pour vous dire que j’ai pendu un mannequin par le cou et inscrit le nom de Seneca Crane sur son torse.; Hunger Games; Katniss; 2012; https://tse4.mm.bing.net/th/id/OIP.6PMXCMTZgkDKCkeY-NP6sAHaKB?w=145&h=197&c=7&r=0&o=5&pid=1.7 - -Le feux ça se propage et si nous brûlons vous brûlerez avec nous !; Hunger Games; Katniss; 2012; https://tse4.mm.bing.net/th/id/OIP.6PMXCMTZgkDKCkeY-NP6sAHaKB?w=145&h=197&c=7&r=0&o=5&pid=1.7 - -La peur ne te paralyse pas elle te réveille.; Divergente; Quatre; 2014; https://tse2.mm.bing.net/th/id/OIP.VGvVLSX6Yib-4x0JJOMWUQHaEK?w=305&h=180&c=7&r=0&o=5&pid=1.7 - -Les gens avides de pouvoir et qui finissent par l’obtenir vivent dans la terreur de le perdre. Et c’est pour cette raison qu’il ne faut en donner qu’à ceux qui ne le désirent pas.; Divergente; Tris; 2014; https://tse3.mm.bing.net/th/id/OIP.VYjPaxqX_66-rJho-f-rCQHaK4?w=194&h=284&c=7&r=0&o=5&pid=1.7 - -La politesse, ce n’est que de la fausseté dans un paquet-cadeau.; Divergente; Christina; 2014; https://tse3.mm.bing.net/th/id/OIP.-wz8nDaqKV8gu0xZsfcE_AHaLG?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Quand on a peu de possessions, peu de désirs et que tout le monde a la même chose, on ne convoite pas les biens des autres.; Divergente; Tris; 2014; https://tse3.mm.bing.net/th/id/OIP.VYjPaxqX_66-rJho-f-rCQHaK4?w=194&h=284&c=7&r=0&o=5&pid=1.7 - -Être désavoué par des lâches fait la grandeur des braves.; Les animaux fantastiques : les crimes de Grindewald; Grindelwald; 2016; https://tse4.mm.bing.net/th/id/OIP.FFOI1GRf_n-bX02pAlZYwQHaEc?w=244&h=180&c=7&r=0&o=5&pid=1.7 - -Je suis le feu. Je suis… la Mort.; Le hobbit : la désolation de Smaug; Smaug; 2012; https://tse2.mm.bing.net/th/id/OIP.3vXkEUJ9J8s-GsnBC6I3KAHaF0?w=185&h=180&c=7&r=0&o=5&pid=1.7 - -Je jure que je ne me séparerai pas d’une seule pièce d’or, pas de la moindre parcelle.; Le hobbit : la bataille des cinq armées; Thorin; 2012; https://tse4.mm.bing.net/th/id/OIP.F1alSEClhkaZE3VGDf9IbgHaHa?w=209&h=209&c=7&r=0&o=5&pid=1.7 - -De la loyauté, de l’honneur, un cœur vaillant, c’est tout ce que je demande !; Le Hobbit : un voyage inattendu; Thörin II Ecu-De-Chêne; 2012; https://tse1.mm.bing.net/th/id/OIP.AzOPUHw61pXF-W3a1giYwAHaFH?w=194&h=134&c=7&r=0&o=5&pid=1.7 - -Will Turner, est-ce que tu veux me prendre pour femme, pour le meilleur est pour le pire, je crois que le pire est à envisager.; Pirates des Caraïbes, jusqu’au bout du monde; Elizabeth; 2003; https://tse3.mm.bing.net/th/id/OIP.VFLqe8JlbX0imVJ-Rjn4mgHaDt?w=316&h=174&c=7&r=0&o=5&pid=1.7 - -Tous les trésors ne sont pas d’argent et d’or…; Pirates des Caraibes, la malédiction du Black Pearl; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 - -Tu ne remarques rien ? Ou plutôt ne remarques-tu pas l’absence de ce que tu devrais remarquer ?; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 - -Vous pouvez me tuer mon ami, mais ne m’insultez pas !; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 - -La mort a une curieuse façon de faire le tri parmi les priorités.; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 - -Mais il me semble que comme j’ai un navire et pas vous, c’est vous qui avez besoin que je vous sauve, et je ne sais pas si j’y suis vraiment disposé.; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 - -La cruauté est affaire de perspective.; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 - -Pas de ça de pas de ça !; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 - -Je sais pas c’qui me retient de le mettre en orbite !; Toy Story 2; M. Patate; 1995; https://tse1.mm.bing.net/th/id/OIP.je21xi_joSEUE4w8OkIg9gHaEL?w=317&h=180&c=7&r=0&o=5&pid=1.7 - -Tu m’as oublié en oubliant qui tu étais.; Le roi lion; Mufassa; 1994; https://tse3.mm.bing.net/th/id/OIP.raX8ZfSizmfVbeMrR0ghZgHaG2?w=173&h=180&c=7&r=0&o=5&pid=1.7 - -Quand le monde te persécute, tu te dois de persécuter le monde.; Le roi lion; Timon; 1994; https://tse3.mm.bing.net/th/id/OIP.djhwHrNS0CLKzx4LLJWpLAHaFs?w=173&h=180&c=7&r=0&o=5&pid=1.7 - -Regarde au delà de ce que tu vois.; Le roi lion; Rafiki; 1994; https://tse4.mm.bing.net/th/id/OIP.8My5fvsa2Z1P6oWhtJc6WQHaKl?w=127&h=181&c=7&r=0&o=5&pid=1.7 - -Et si je te le dis !; Le roi lion; Scar; 1994; https://tse3.mm.bing.net/th/id/OIP.b9_3MMu1kK4yyKVCt-wtYwHaEK?w=278&h=180&c=7&r=0&o=5&pid=1.7 - -Je patauge dans l’imbécillité.; Le roi lion; Scar; 1994; https://tse3.mm.bing.net/th/id/OIP.b9_3MMu1kK4yyKVCt-wtYwHaEK?w=278&h=180&c=7&r=0&o=5&pid=1.7 - -N’oublie pas qui tu es.; Le roi lion; Mufassa; 1994; https://tse3.mm.bing.net/th/id/OIP.raX8ZfSizmfVbeMrR0ghZgHaG2?w=173&h=180&c=7&r=0&o=5&pid=1.7 - -N’oublie pas qui tu es.; Le roi lion; Mufassa; 1994; https://tse3.mm.bing.net/th/id/OIP.raX8ZfSizmfVbeMrR0ghZgHaG2?w=173&h=180&c=7&r=0&o=5&pid=1.7 - -J’ai un corps d’Apollon et du plomb dans la tête.; La belle et la bête; Gaston; 1991; https://tse2.mm.bing.net/th/id/OIP.PziDszqyhWeRqKHDL8ouwgHaJ4?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -La mort… par décapitation…; Aladdin; Jafar; 1992; https://tse3.mm.bing.net/th/id/OIP.gl3qdaf8Njvek6PM5AVgXgHaFj?w=228&h=180&c=7&r=0&o=5&pid=1.7 - -Quand on a rien, il faut faire comme si tout nous appartenait.; Aladdin; Aladdin; 1992; https://tse4.mm.bing.net/th/id/OIP._TZXuDVR3nHwrSJ9PPxJvAHaFO?w=230&h=180&c=7&r=0&o=5&pid=1.7 - -Mon seul devoir est celui de mon cœur.; Mulan 2; Mulan; 1998; https://tse1.mm.bing.net/th/id/OIP.LTvVuaapKih6VpqAOtZudgHaK6?w=194&h=287&c=7&r=0&o=5&pid=1.7 - -Nan mais tu les as vus ?! Ils sont sortis, comme des marguerites !!; Mulan; Mushu; 1998; https://tse4.mm.bing.net/th/id/OIP.omU-pPTNgHJEiTKJUpB1MAHaIw?w=114&h=180&c=7&r=0&o=5&pid=1.7 - -Vous êtes le plus privilégié des privilégiés, en contrepartie il vous faut remplir certaines responsabilités.; À tout jamais, une histoire de Cendrillon; Danielle; 1950; https://tse2.mm.bing.net/th/id/OIP.79bf2opzc4vp3nvyKdI9QAHaHa?w=164&h=180&c=7&r=0&o=5&pid=1.7 - -Je rêve ou je suis en train de me battre en duel avec un cheval ?; Raiponce; Flynn Rider; 2010; https://tse1.mm.bing.net/th/id/OIP.3svdf3xniHZ5huU-D1cptQHaEK?w=329&h=185&c=7&r=0&o=5&pid=1.7 - -Wow, que d’émotions, et il est que huit heure du matin !; Raiponce; Flynn Rider; 2010; https://tse1.mm.bing.net/th/id/OIP.3svdf3xniHZ5huU-D1cptQHaEK?w=329&h=185&c=7&r=0&o=5&pid=1.7 - -Il ne se passera plus un jour, une heure, une minute sans que je me batte !; Raiponce; Raiponce; 2010; https://tse4.mm.bing.net/th/id/OIP.lObXQdwuf5hDc_g40knCmQHaDt?w=348&h=174&c=7&r=0&o=5&pid=1.7 - -Il suffit que je te regarde dans les yeux et je me sens… je me sens chez moi.; Le monde de Némo; Dory; 2003; https://tse2.mm.bing.net/th/id/OIP.zR4rzkK7q2wCcNwZd6jjegHaIC?w=163&h=180&c=7&r=0&o=5&pid=1.7 - -Je souffre de perte de la mémoire courte.; Le monde de Némo; Dory; 2003; https://tse2.mm.bing.net/th/id/OIP.zR4rzkK7q2wCcNwZd6jjegHaIC?w=163&h=180&c=7&r=0&o=5&pid=1.7 - -Oh il a de la chance de parler baleine !; Le monde de Némo; Dory; 2003; https://tse2.mm.bing.net/th/id/OIP.zR4rzkK7q2wCcNwZd6jjegHaIC?w=163&h=180&c=7&r=0&o=5&pid=1.7 - -Je ne vous connais pas, mais je vous aime déjà.; Là-haut; Dug; 2009; https://tse1.mm.bing.net/th/id/OIP.uDr845hAlB9JoYe8i-DJ0QAAAA?w=294&h=170&c=7&r=0&o=5&pid=1.7 - -Arrête de faire ton Jean-Jacques !; Coco; Coco; 2017; https://tse1.mm.bing.net/th/id/OIP.GPIbva8dEP6Kllx-sj5ysAHaK-?w=115&h=180&c=7&r=0&o=5&pid=1.7 - -Tu conduis comme tu répares les routes.; Cars; Doc Hudson; 2006; https://tse1.mm.bing.net/th/id/OIP.7ZWmLIPHcKWDZZjROnCh3AHaDF?w=287&h=145&c=7&r=0&o=5&pid=1.7 - -Je ne veux pas d’excuses, je veux des résultats !; Madagascar; les pingouins; 2005; https://tse2.mm.bing.net/th/id/OIP.UMdT8raLVqv9rCr2E1O_nAHaFS?w=244&h=180&c=7&r=0&o=5&pid=1.7 - -Tu me mords… LES MEULES !; Madagascar; Marty; 2005; https://tse2.mm.bing.net/th/id/OIP.Qoh2doQIigxyiOBuhgRx9gHaM7?w=115&h=186&c=7&r=0&o=5&pid=1.7 - -Pour toi poupée, je me couperais en quatre…; Shrek 2; le chat potté; 2001; https://tse4.mm.bing.net/th/id/OIP.kS6XFK6-lD-RzYdwHAj_LgHaEK?w=255&h=180&c=7&r=0&o=5&pid=1.7 - -Ma maman elle est malade et mon papa il dévalise les poubelles.; Shrek; le chat potté; 2001; https://tse4.mm.bing.net/th/id/OIP.kS6XFK6-lD-RzYdwHAj_LgHaEK?w=255&h=180&c=7&r=0&o=5&pid=1.7 - -Moi je vois pas l’intérêt de savoir parler si je peux pas raconter les secrets !; Shrek; l'âne; 2001; https://tse3.mm.bing.net/th/id/OIP.-1Ds-2D5GPiu9uejDdmgNgHaH3?w=124&h=180&c=7&r=0&o=5&pid=1.7 - -Nouille ou pas nouille, tu te préoccupes trop de ce qui a été ou de ce qui sera.; Kung Fu Panda; Maître Oogway; 2008; https://tse4.mm.bing.net/th/id/OIP.QzDh_d2T5aADiDJ7uMFU6gHaHa?w=157&h=180&c=7&r=0&o=5&pid=1.7 - -On ne facture pas la toplessitude et la séductivité.; Kung Fu Panda; Po; 2008; https://tse2.mm.bing.net/th/id/OIP.oBoBPN1VKEeJglTjZbtRUAHaJ5?w=94&h=180&c=7&r=0&o=5&pid=1.7 - -Mon nom est Po, et il va me falloir un chapeau !; Kung Fu Panda 2; Po; 2008; https://tse2.mm.bing.net/th/id/OIP.oBoBPN1VKEeJglTjZbtRUAHaJ5?w=94&h=180&c=7&r=0&o=5&pid=1.7 - + +Dans le monde il n’y a pas d’un côté le bien et le mal, il y a une part de lumière et d’ombre en chacun de nous. Ce qui compte c’est celle que l’on choisit de montrer dans nos actes, ça c’est ce que l’on est vraiment.; Harry Potter et L’ordre du Phoenix; Sirius Black; 2001; https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137&h=195&c=7&r=0&o=5&pid=1.7 + +Il faut du courage pour affronter ses ennemis mais il en faut encore plus pour affronter ses amis…; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 + +Ce ne sont pas vos ressemblances qui comptent Harry, ce sont vos différences.; Harry Potter et L’ordre du Phoenix; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 + +Le problème, c’est que les humains ont un don pour désirer ce qui leur fait le plus de mal.; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 + +Ce dont vous avez le plus peur est la peur elle-même, c’est une preuve de sagesse.; Harry Potter et le prisonnier d’Azkaban; Remus Lupin; 2001; https://tse1.mm.bing.net/th/id/OIP.01EekTJQq0yQ9QQ_aNq87gHaJ-?w=162&h=218&c=7&r=0&o=5&pid=1.7 + +J’ai tout appris dans les livres. Mais il y a des choses beaucoup plus importantes, le courage, l’amitié.; Harry Potter à l’école des sorciers; Hermione; 2001; https://tse2.mm.bing.net/th/id/OPEC.aBKNyvpNlyyj9g474C474?w=186&h=241&o=5&pid=1.7 + +Tout est possible du moment qu’on a assez de cran.; Harry Potter et L’ordre du Phoenix; Ginny Weasley; 2001; https://tse3.mm.bing.net/th/id/OIP.QwHMbOI-N9zfJ_Re9I65ggHaJ1?w=140&h=187&c=7&r=0&o=5&pid=1.7 + +Ça ne fait pas grand bien de s’installer dans les rêves en oubliant de vivre…; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 + +Nous avons parié, mon père et moi. Je ne crois pas que tu tiendras dix minutes dans ce tournoi. Lui, il n’est pas d’accord, il croit que tu n’en tiendras pas cinq.; Harry Potter et la coupe de feu; Drago Malefoy; 2001; https://tse2.mm.bing.net/th/id/OIP.CthWIxuLm0a8THOguTDB_AAAAA?w=157&h=207&c=7&r=0&o=5&pid=1.7 + +C’est de la force des convictions que dépend la réussite, pas du nombre des partisans.; Harry Potter et les reliques de la mort - 2e partie; Remus Lupin; 2001; https://tse1.mm.bing.net/th/id/OIP.01EekTJQq0yQ9QQ_aNq87gHaJ-?w=162&h=218&c=7&r=0&o=5&pid=1.7 + +Je me fiche éperdument de ce que pense ton père, Malefoy. Il est vil et cruel. Et toi, tu es pathétique.; Harry Potter et la coupe de feu; Harry; 2001; https://tse3.mm.bing.net/th/id/OIP.IV9gltTWHTVtnezyCVXjwAHaJ4?w=120&h=180&c=7&r=0&o=5&pid=1.7 + +J’ai lu dans ton cœur, et ton cœur est mien.; Harry Potter et les reliques de la mort - 1re partie; Lord Voldemort; 2001; https://tse2.mm.bing.net/th/id/OIP.B9RbuWnpmV-7fI8v-H0G8gHaEK?w=290&h=180&c=7&r=0&o=5&pid=1.7 + +Dans le monde il n’y a pas d’un côté le bien et le mal, il y a une part de lumière et d’ombre en chacun de nous. Ce qui compte c’est celle que l’on choisit de montrer dans nos actes, ça c’est ce que l’on est vraiment.; Harry Potter et L’ordre du Phoenix; Sirius Black; 2001; https://tse2.mm.bing.net/th/id/OIP.MMpXBB5RDRYQm05FJmevGAHaKl?w=137&h=195&c=7&r=0&o=5&pid=1.7 + +Il faut du courage pour affronter ses ennemis mais il en faut encore plus pour affronter ses amis…; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 + +Ce ne sont pas nos capacités qui déterminent ce que nous sommes, Harry, ce sont nos choix !; Harry Potter et la chambre des secrets; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 + +Ce ne sont pas vos ressemblances qui comptent Harry, ce sont vos différences.; Harry Potter et L’ordre du Phoenix; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 + +Le problème, c’est que les humains ont un don pour désirer ce qui leur fait le plus de mal.; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 + +Ce dont vous avez le plus peur est la peur elle-même, c’est une preuve de sagesse.; Harry Potter et le prisonnier d’Azkaban; Remus Lupin; 2001; https://tse1.mm.bing.net/th/id/OIP.01EekTJQq0yQ9QQ_aNq87gHaJ-?w=162&h=218&c=7&r=0&o=5&pid=1.7 + +J’ai tout appris dans les livres. Mais il y a des choses beaucoup plus importantes, le courage, l’amitié.; Harry Potter à l’école des sorciers; Hermione; 2001; https://tse1.mm.bing.net/th/id/OIP.DNVVrGRcxyoXfy8Nqn4DnwHaJ4?w=194&h=259&c=7&r=0&o=5&pid=1.7 + +Tout est possible du moment qu’on a assez de cran.; Harry Potter et L’ordre du Phoenix; Ginny Weasley; 2001; https://tse3.mm.bing.net/th/id/OIP.QwHMbOI-N9zfJ_Re9I65ggHaJ1?w=140&h=187&c=7&r=0&o=5&pid=1.7 + +Ça ne fait pas grand bien de s’installer dans les rêves en oubliant de vivre…; Harry Potter à l’école des sorciers; Dumbledore; 2001; https://tse4.mm.bing.net/th/id/OIP.3i5U6ihAOUsTFvLLT-RKtAHaJd?w=68&h=180&c=7&r=0&o=5&pid=1.7 + +Nous avons parié, mon père et moi. Je ne crois pas que tu tiendras dix minutes dans ce tournoi. Lui, il n’est pas d’accord, il croit que tu n’en tiendras pas cinq.; Harry Potter et la coupe de feu; Drago Malefoy; 2001; https://tse2.mm.bing.net/th/id/OIP.CthWIxuLm0a8THOguTDB_AAAAA?w=157&h=207&c=7&r=0&o=5&pid=1.7 + +C’est de la force des convictions que dépend la réussite, pas du nombre des partisans.; Harry Potter et les reliques de la mort - 2e partie; Remus Lupin; 2001; https://tse1.mm.bing.net/th/id/OIP.01EekTJQq0yQ9QQ_aNq87gHaJ-?w=162&h=218&c=7&r=0&o=5&pid=1.7 + +Je me fiche éperdument de ce que pense ton père, Malefoy. Il est vil et cruel. Et toi, tu es pathétique.; Harry Potter et la coupe de feu; Harry; 2001; https://tse3.mm.bing.net/th/id/OIP.IV9gltTWHTVtnezyCVXjwAHaJ4?w=120&h=180&c=7&r=0&o=5&pid=1.7 + +J’ai lu dans ton cœur, et ton cœur est mien.; Harry Potter et les reliques de la mort - 1re partie; Lord Voldemort; 2001; https://tse2.mm.bing.net/th/id/OIP.B9RbuWnpmV-7fI8v-H0G8gHaEK?w=290&h=180&c=7&r=0&o=5&pid=1.7 + +N’essaie pas ! Fais-le, ou ne le fais pas ! Il n’y a pas d’essai.; Star Wars : Episode 5 - L’empire contre-attaque; Yoda; 1977; https://tse4.mm.bing.net/th/id/OIP.n7EwvRfr2000cw-wPd84BwHaEo?w=244&h=180&c=7&r=0&o=5&pid=1.7 + +Que la Force soit avec toi…; Star Wars : Episode 4 - Un nouvel espoir; Obi-Wan; 1977; https://tse3.mm.bing.net/th/id/OIP.J7Kmtok0f2mQT7iX_JA_5QHaE8?w=218&h=180&c=7&r=0&o=5&pid=1.7 + +Je suis ton père.; Star Wars : Episode 5 - L’empire contre-attaque; Dark Vador; 1977; https://tse3.mm.bing.net/th/id/OIP.r0YMrIo2bkQFbcmZLdrVVAHaEK?w=294&h=180&c=7&r=0&o=5&pid=1.7 + +La prophétie voulait que tu détruises les Sith pas que tu deviennes comme eux !; Star Wars : Episode 3 - La revanche des sith; Obi-Wan; 1977; https://tse3.mm.bing.net/th/id/OIP.J7Kmtok0f2mQT7iX_JA_5QHaE8?w=218&h=180&c=7&r=0&o=5&pid=1.7 + +Il y en a toujours un pour manger l’autre !; Star Wars : Episode 1 - La menace fantôme; Qui-Gon Jinn; 1977; https://tse2.mm.bing.net/th/id/OIP.oZP8cTT95_4nR6VK5uB7QgHaKH?w=133&h=183&c=7&r=0&o=5&pid=1.7 + +Qui est le plus fou des deux, le fou ou le fou qui le suit ?; Star Wars : Episode 4 - Un nouvel espoir; Obi-Wan; 1977; https://tse3.mm.bing.net/th/id/OIP.J7Kmtok0f2mQT7iX_JA_5QHaE8?w=218&h=180&c=7&r=0&o=5&pid=1.7 + +S’il y a un point central dans cet univers, tu es sur la planète qui en est le plus éloigné…; Star Wars : Episode 4 - Un nouvel espoir; Luke; 1977; https://tse2.mm.bing.net/th/id/OIP.N2JpjF9aPxvz9vZYEOjc2QHaFj?w=177&h=180&c=7&r=0&o=5&pid=1.7 + +Si c’est pour l’argent que vous faites ça, alors c’est tout ce que vous recevrez !; Star Wars : Episode 4 - Un nouvel espoir; Leia; 1977; https://tse2.mm.bing.net/th/id/OIP.P5CMgdStIPfYvfNky4Kh7QHaLF?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Je sais ce qu’il faut que je fasse mais je ne sais pas si j’en aurai la force.; Star Wars : Episode 7 - Le réveil de la force; Kylo Ren; 1977; https://tse1.mm.bing.net/th/id/OIP.HlRkAcz7BjIBsRU59L4owAHaHa?w=149&h=180&c=7&r=0&o=5&pid=1.7 + +La mort est une partie naturelle de la vie.; Star Wars : Episode 3 - La revanche des sith; Yoda; 1977; https://tse4.mm.bing.net/th/id/OIP.n7EwvRfr2000cw-wPd84BwHaEo?w=244&h=180&c=7&r=0&o=5&pid=1.7 + +Votre manque de foi me consterne.; Star Wars : Episode 4 - Un nouvel espoir; Dark Vador; 1977; https://tse3.mm.bing.net/th/id/OIP.r0YMrIo2bkQFbcmZLdrVVAHaEK?w=294&h=180&c=7&r=0&o=5&pid=1.7 + +Il ne faut jamais sous-estimer un droïde.; Star Wars : Episode 9 - L'ascension de Skywalker; Leia; 1977; https://tse2.mm.bing.net/th/id/OIP.P5CMgdStIPfYvfNky4Kh7QHaLF?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Tu as peur de ne jamais être aussi fort que Dark Vador.; Star Wars : Episode 7 - Le réveil de la force; Rey; 1977; https://tse3.mm.bing.net/th/id/OIP.pPDkRAfYT1rldQW1FRuxaAHaJQ?w=123&h=180&c=7&r=0&o=5&pid=1.7 + +Vous ne passerez pas !; Le seigneur des anneaux : la communauté de l’anneau; Gandalf; 2001; https://tse2.mm.bing.net/th/id/OIP.ztKYa5HLhCKgVkY0GZ4rSAHaJ4?w=71&h=180&c=7&r=0&o=5&pid=1.7 + +Il y a du bon dans ce monde, et il faut se battre pour cela.; Le seigneur des anneaux : la communauté de l’anneau; Sam; 2001; https://tse4.mm.bing.net/th/id/OIP.edxwKxyoPXfV7_DSTeerFAHaHa?w=180&h=180&c=7&r=0&o=5&pid=1.7 + +Je ne vous dirais pas de ne pas pleurer car toutes les larmes ne sont pas un mal.; Le Seigneur des anneaux : le retour du roi; Gandalf; 2001; https://tse2.mm.bing.net/th/id/OIP.ztKYa5HLhCKgVkY0GZ4rSAHaJ4?w=71&h=180&c=7&r=0&o=5&pid=1.7 + +Je ne peux le porter pour vous, mais je peux vous porter vous !; Le Seigneur des anneaux : le retour du roi; Sam; 2001; https://tse4.mm.bing.net/th/id/OIP.edxwKxyoPXfV7_DSTeerFAHaHa?w=180&h=180&c=7&r=0&o=5&pid=1.7 + +Et bien, c’est plus gai dans un cimetière…; Le seigneur des anneaux : les deux tours; Gimli; 2001; https://tse1.mm.bing.net/th/id/OIP.RzN-g8st6li9R5HA3IIrQgHaF3?w=215&h=180&c=7&r=0&o=5&pid=1.7 + +Mon précieux.; Le seigneur des anneaux : la communauté de l’anneau; Gollum; 2001; https://tse2.mm.bing.net/th/id/OIP.s8Egh2FBsKGr6QdkdWEPnwHaE6?w=212&h=180&c=7&r=0&o=5&pid=1.7 + +Je vous aurais suivi mon frère, mon capitaine, mon roi.; Le seigneur des anneaux : la communauté de l’anneau; Boromir; 2001; https://tse1.mm.bing.net/th/id/OIP._uHLsNbgnf1m1vK3ZWE2UAHaEo?w=217&h=180&c=7&r=0&o=5&pid=1.7 + +On nous a envoyé sauver la Comté Sam, et elle a été sauvée. Mais, pas pour moi…; Le Seigneur des anneaux : le retour du roi; Frodon; 2001; https://tse2.mm.bing.net/th/id/OIP.PPIESqZaNDa-qUcfSDXhdQHaGK?w=210&h=180&c=7&r=0&o=5&pid=1.7 + +Et mon arc est vôtre !; Le seigneur des anneaux : la communauté de l’anneau; Legolas; 2001; https://tse1.mm.bing.net/th/id/OIP.-8TP3nkEc30yCD1PolGRbQHaJW?w=194&h=245&c=7&r=0&o=5&pid=1.7 + +Toutes les larmes ne sont pas un mal.; Le Seigneur des anneaux : le retour du roi; Gandalf; 2001; https://tse2.mm.bing.net/th/id/OIP.ztKYa5HLhCKgVkY0GZ4rSAHaJ4?w=71&h=180&c=7&r=0&o=5&pid=1.7 + +Je suis Gandhalf le blanc, et je reviens vers vous en ce moment décisif.; Le seigneur des anneaux : les deux tours; Gandalf; 2001; https://tse2.mm.bing.net/th/id/OIP.ztKYa5HLhCKgVkY0GZ4rSAHaJ4?w=71&h=180&c=7&r=0&o=5&pid=1.7 + +Tout ce que nous avons à décider, c’est ce que nous devons faire du temps qui nous est imparti.; Le seigneur des anneaux : la communauté de l’anneau; Gandalf; 2001; https://tse2.mm.bing.net/th/id/OIP.ztKYa5HLhCKgVkY0GZ4rSAHaJ4?w=71&h=180&c=7&r=0&o=5&pid=1.7 + +Si par ma vie ou ma mort je peux vous protéger je le ferai ! + Mon épée est votre !; Le seigneur des anneaux : la communauté de l’anneau; Aragorn; 2001; https://tse1.mm.bing.net/th/id/OIP.GQ9p5tZGZBKv3fURChVROwE7DG?w=260&h=180&c=7&r=0&o=5&pid=1.7 + +Pour Frodon.; Le Seigneur des anneaux : le retour du roi; Aragorn; 2001; https://tse1.mm.bing.net/th/id/OIP.GQ9p5tZGZBKv3fURChVROwE7DG?w=260&h=180&c=7&r=0&o=5&pid=1.7 + +Mes amis… ce n’est pas à vous de vous incliner.; Le Seigneur des anneaux : le retour du roi; Aragorn; 2001; https://tse1.mm.bing.net/th/id/OIP.GQ9p5tZGZBKv3fURChVROwE7DG?w=260&h=180&c=7&r=0&o=5&pid=1.7 + +Si Dieu est tout puissant, alors il ne peut pas être tout bienfaisant. Et s’il est tout bienfaisant, c’est qu’il ne peut pas être tout puissant.; Batman v Superman : l’aube de la justice; Lex Luthor; 1989; https://tse3.mm.bing.net/th/id/OIP.S4q6m2na1Rxkc7xZ1lcfKQHaJe?w=135&h=180&c=7&r=0&o=5&pid=1.7 + +Je ne vais pas vous tuer… mais rien ne m’oblige à vous sauver.; Batman begins; Batman; 1989; https://tse1.mm.bing.net/th/id/OIP.k-xCm-NCW6Dxah3T2FlcFQHaEK?w=326&h=183&c=7&r=0&o=5&pid=1.7 + +Ne compte pas me mettre au frais !; Batman & Robin; Mr. Freeze; 1989; https://tse1.mm.bing.net/th/id/OIP.c5hOJMCbBn2CugR3e1ltNQHaIh?w=194&h=223&c=7&r=0&o=5&pid=1.7 + +Que la farce soit avec toi.; Batman, la série animée; le Joker; 1989; https://tse2.mm.bing.net/th/id/OIP.RrJkua2jY_o24eUG7wmk8QHaE-?w=232&h=180&c=7&r=0&o=5&pid=1.7 + +Tu sais, si t’as l’intention de voler des voitures, te déguises pas en voleur de voitures.; The Amazing Spider-Man; Peter Parker; 2002; https://tse1.mm.bing.net/th/id/OIP.OpPUQy_RrqL5sMd_KR7D8gHaD4?w=283&h=180&c=7&r=0&o=5&pid=1.7 + +Ne t’excuse jamais d’être le plus malin de la bande.; Spider-Man : Far From Home; Quentin Beck; 2002; https://tse4.mm.bing.net/th/id/OIP._ROT4QN7TDwCQHn6OLEswAHaEK?w=299&h=180&c=7&r=0&o=5&pid=1.7 + +Tu en fais trop : les études, le boulot, tout le temps que tu passes avec moi… Tu n’es pas Superman tu sais !; Spider-Man; May Parker; 2002; https://tse1.mm.bing.net/th/id/OIP.Fzb2IGNnUPn1wc_ne1cqgAHaL2?w=119&h=191&c=7&r=0&o=5&pid=1.7 + +Jarvis, il faut parfois savoir courir avant de savoir marcher.; Iron Man; Tony Stark; 2008; https://tse2.mm.bing.net/th/id/OIP.s4nqc0QluImn7arGZTfurQHaI7?w=131&h=180&c=7&r=0&o=5&pid=1.7 + +Les records sont fait pour être battus !; Iron Man; Tony Stark; 2008; https://tse2.mm.bing.net/th/id/OIP.s4nqc0QluImn7arGZTfurQHaI7?w=131&h=180&c=7&r=0&o=5&pid=1.7 + +Absorbez la pression, ne me la transmettez pas.; Iron Man; Tony Stark; 2008; https://tse2.mm.bing.net/th/id/OIP.s4nqc0QluImn7arGZTfurQHaI7?w=131&h=180&c=7&r=0&o=5&pid=1.7 + +C’est comme dans un rêve.; Iron Man; Tony Stark; 2008; https://tse2.mm.bing.net/th/id/OIP.s4nqc0QluImn7arGZTfurQHaI7?w=131&h=180&c=7&r=0&o=5&pid=1.7 + +La merde se crée toute seule, je ne fais que la remuer.; Deadpool; Wade / Deadpool; 2016; https://tse3.mm.bing.net/th/id/OIP.wYPg61JNUvsouPzwUhr0-QHaHa?w=162&h=180&c=7&r=0&o=5&pid=1.7 + +µ; Je parie que Vulverine en a une jolie paire dans son slip kangourou.; Deadpool; Wade / Deadpool; 2016; https://tse3.mm.bing.net/th/id/OIP.wYPg61JNUvsouPzwUhr0-QHaHa?w=162&h=180&c=7&r=0&o=5&pid=1.7 + +La plupart des gens sont condamnés à ne jamais rien voir au delà de ce que leurs yeux leur disent…; X-men 2; Kurt Wagner; 2000; https://tse3.mm.bing.net/th/id/OIP.hyDe8SvEEvDhmKfsQBqWEwHaJ8?w=194&h=261&c=7&r=0&o=5&pid=1.7 + +Disons que je suis le monstre de Frankenstein, et que je cherche mon créateur.; X-Men : Le commencement; Magneto; 2000; https://tse2.mm.bing.net/th/id/OIP.7eXM4Na7unM6BWLJcapqVwHaJ4?w=194&h=259&c=7&r=0&o=5&pid=1.7 + +Tu vaux tellement plus que ce que tu ne crois. Il n’y a pas que la douleur, la colère, tu as du cœur aussi, je l’ai vu en toi. Ce n’est pas qu’à moi que tu tournes le dos. Ici tu as une chance de faire partie d’une chose beaucoup plus grande que toi, une chose qui a besoin de toi.; X-Men : Apocalypse; Professeur Charles Xavier; 2000; https://tse3.mm.bing.net/th/id/OIP.lDzxwo1weGaA-hRMfV6bYwHaGp?w=194&h=174&c=7&r=0&o=5&pid=1.7 + +Elle ne me laisse pas faire !; X-men 2; Kurt Wagner; 2000; https://tse3.mm.bing.net/th/id/OIP.hyDe8SvEEvDhmKfsQBqWEwHaJ8?w=194&h=261&c=7&r=0&o=5&pid=1.7 + +Si je suis venu, c’est que je n’avais pas le choix. Je suis venu sauver mon monde, les personnes que j’aime. Et je suis venu parce-que le trident est leur seul espoir. Et si ça suffit pas comme raison, tu peux aller te faire foutre.; Aquaman; Arthur; 2018; https://tse3.mm.bing.net/th/id/OIP.Vbj0KGYQt_M2kAZNEdX3lQHaLb?w=194&h=299&c=7&r=0&o=5&pid=1.7 + +Un homme qui ne passe pas de temps avec sa famille n’est pas vraiment un homme.; Le parrain; Vito Corleone; 1972; https://tse2.mm.bing.net/th/id/OIP.jzIdpLlEe-MQogtqU8kAxAHaHa?w=149&h=180&c=7&r=0&o=5&pid=1.7 + +Il ne faut pas surestimer le pouvoir de pardonner.; Le Parrain, 3ème partie; Michael Corleone; 1972; https://tse2.mm.bing.net/th/id/OIP.2tQ82oaA3J3wmLyBBjrgWAHaJF?w=138&h=180&c=7&r=0&o=5&pid=1.7 + +Il ne faut pas que sa mère le voit dans cet état.; Le parrain; Vito Corleone; 1972; https://tse2.mm.bing.net/th/id/OIP.jzIdpLlEe-MQogtqU8kAxAHaHa?w=149&h=180&c=7&r=0&o=5&pid=1.7 + +Le pouvoir ça se donne pas ça se prend.; Le Parrain, 3ème partie; Michael Corleone; 1972; https://tse2.mm.bing.net/th/id/OIP.2tQ82oaA3J3wmLyBBjrgWAHaJF?w=138&h=180&c=7&r=0&o=5&pid=1.7 + +Ce qui ne me tue pas me rend plus… bizarre.; The Dark Knight: Le Chevalier noir; le Joker; 2008; https://tse4.mm.bing.net/th/id/OIP.FKM9RHVwmPE_eTQm6cvlbgHaLL?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Je suis comme un chien enragé qui court après une voiture, mais si j’en attrape une je ne sais pas à quoi elle me serait utile.; The Dark Knight: Le Chevalier noir; le Joker; 2008; https://tse4.mm.bing.net/th/id/OIP.FKM9RHVwmPE_eTQm6cvlbgHaLL?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Bien le bonsoir, je suis l’animation de la soirée !; The Dark Knight: Le Chevalier noir; le Joker; 2008; https://tse4.mm.bing.net/th/id/OIP.FKM9RHVwmPE_eTQm6cvlbgHaLL?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Vous voyez ce stylo ? Je vais le faire disparaître *BIM*. + Et voila, il a disparu.; The Dark Knight: Le Chevalier noir; le Joker; 2008; https://tse4.mm.bing.net/th/id/OIP.FKM9RHVwmPE_eTQm6cvlbgHaLL?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Ce ne sont pas juste des rêves, ce sont des souvenirs et tu as dit de ne jamais utiliser des souvenirs !; Inception; Ariadne; 2010; https://tse2.mm.bing.net/th/id/OIP.xkBsnyA8BI1MgSGbQpFhOQAAAA?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Il ne suffit pas de se mettre une plume dans le cul pour ressembler à un coq.; Fight Club; Tyler; 1999; https://tse2.mm.bing.net/th/id/OIP.GKlbhFXb8PhWKTBgLYCRNAHaHX?w=176&h=180&c=7&r=0&o=5&pid=1.7 + +Je le considère comme un impôt sur la connerie.; Fight Club; Marla; 1999; https://tse4.mm.bing.net/th/id/OIP.nFqhuPIEX-oV0i8PWjC1DwHaEx?w=186&h=180&c=7&r=0&o=5&pid=1.7 + +Si j’avais vraiment une tumeur je la nommerais Marla… Marla, la petite écorchure qu’on a sur le palais et qui ne peut cicatriser que si on ne cesse de la lécher. Mais on ne peut pas.; Fight Club; le narrateur; 1999; https://tse4.mm.bing.net/th/id/OIP.OQFYbcxGZsFJlvLIT8jrLAHaDt?w=310&h=180&c=7&r=0&o=5&pid=1.7 + +Je veux que tu saches, au lieu d’en avoir peur, que tu saches que tu mourras un jour.; Fight Club; Tyler; 1999; https://tse2.mm.bing.net/th/id/OIP.GKlbhFXb8PhWKTBgLYCRNAHaHX?w=176&h=180&c=7&r=0&o=5&pid=1.7 + +Vous avez une sorte de désespoir hystérique dans votre rire.; Fight Club; Tyler; 1999; https://tse2.mm.bing.net/th/id/OIP.GKlbhFXb8PhWKTBgLYCRNAHaHX?w=176&h=180&c=7&r=0&o=5&pid=1.7 + +Je veux que tu me frappes aussi fort que tu peux.; Fight Club; Tyler; 1999; https://tse2.mm.bing.net/th/id/OIP.GKlbhFXb8PhWKTBgLYCRNAHaHX?w=176&h=180&c=7&r=0&o=5&pid=1.7 + +Je le sais, parce que Tyler le sait.; Fight Club; le narrateur; 1999; https://tse4.mm.bing.net/th/id/OIP.OQFYbcxGZsFJlvLIT8jrLAHaDt?w=310&h=180&c=7&r=0&o=5&pid=1.7 + +Je fabrique et je vends du savon, l’objet qui indique le degré de civilisation.; Fight Club; Tyler; 1999; https://tse2.mm.bing.net/th/id/OIP.GKlbhFXb8PhWKTBgLYCRNAHaHX?w=176&h=180&c=7&r=0&o=5&pid=1.7 + +Pas de peur, pas d’affolement, et la faculté d’ignorer totalement ce qui est sans importance.; Fight Club; le narrateur; 1999; https://tse4.mm.bing.net/th/id/OIP.OQFYbcxGZsFJlvLIT8jrLAHaDt?w=310&h=180&c=7&r=0&o=5&pid=1.7 + +Si vous le voulez bien, on se taillera des pipes plus tard, les enfants.; Pulp Fiction; The Wolf; 1994; https://tse4.mm.bing.net/th/id/OIP.fc5TQflh0cbxB1GUeOdk6gHaK8?w=123&h=180&c=7&r=0&o=5&pid=1.7 + +Je fais le mort dans la 5e.; Pulp Fiction; Butch; 1994; https://tse1.mm.bing.net/th/id/OIP.luN_zVQJt2Kyf7H_kSrPyQHaJD?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Je courrais toujours pour aller partout, mais je ne pensais pas pour autant que ça allait me mener quelque part.; Forrest Gump; Forrest Gump; 1994; https://tse3.mm.bing.net/th/id/OIP.GT8e1PVP9IQvdn49uMVgeAHaE0?w=262&h=180&c=7&r=0&o=5&pid=1.7 + +Je ne sais pas si c’est maman qui avait raison ou si c’est le lieutenant Dan… Je sais pas si nous avons chacun un destin… ou si nous… si nous nous laissons porter par le hasard comme sur une brise… Mais je… je crois que c’est peut-être un peu des deux… peut-être un peu des deux arrive en même temps.; Forrest Gump; Forrest Gump; 1994; https://tse3.mm.bing.net/th/id/OIP.GT8e1PVP9IQvdn49uMVgeAHaE0?w=262&h=180&c=7&r=0&o=5&pid=1.7 + +Vous ne croirez pas si je vous le disais, mais je cours comme souffle le vent. À partir de ce jour, dès que j’allais quelque part, je le faisais en courant.; Forrest Gump; Forrest Gump; 1994; https://tse3.mm.bing.net/th/id/OIP.GT8e1PVP9IQvdn49uMVgeAHaE0?w=262&h=180&c=7&r=0&o=5&pid=1.7 + +Nous ne sommes pas ici parce que nous sommes libres, nous sommes ici parce que nous ne le sommes pas.; The Matrix Reloaded; Agent Smith; 1999; https://tse4.mm.bing.net/th/id/OIP.1mHiCYi8mwl6uzmVk0JZ3AHaJQ?w=141&h=180&c=7&r=0&o=5&pid=1.7 + +Tu prends la pilule bleue, l’histoire s’arrête là, tu te réveilles dans ton lit, et tu crois ce que tu veux. Tu prends la pilule rouge, tu restes au Pays des Merveilles et je te montre jusqu’où va le terrier.; Matrix; Morpheus; 1999; https://tse4.mm.bing.net/th/id/OIP.HHsnDYoQ9ZZwLthfRpMNugHaEL?w=291&h=180&c=7&r=0&o=5&pid=1.7 + +Le choix est une illusion créée entre ceux qui ont le pouvoir et ceux qui ne l’ont pas.; The Matrix Reloaded; le mérovingien; 1999; https://tse4.mm.bing.net/th/id/OIP.vku_hB1875k65Vxs1GKm_wAAAA?w=333&h=184&c=7&r=0&o=5&pid=1.7 + +Le pouvoir génétique est la force la plus terrible que la planète ait connu, mais vous la maniez comme un enfant qui a trouvé le flingue de son père !; Jurassic park; Ian Malcolm; 1993; https://tse1.mm.bing.net/th/id/OIP.H7i5IHvFUZl9DgyVtITn_wHaEK?w=296&h=180&c=7&r=0&o=5&pid=1.7 + +Il nous abandonne ! Il nous abandonne !; Jurassic park; Lex; 1993; https://tse4.mm.bing.net/th/id/OIP.ckCQ_jiHNatyzti0Fnq4PQHaED?w=317&h=180&c=7&r=0&o=5&pid=1.7 + +Ils se déplacent en troupeaux ! Ils se déplacent en troupeaux !; Jurassic park; Alan Grant; 1993; https://tse2.mm.bing.net/th/id/OIP.TJuWNCsibz8MVmhdNQEdMwHaE8?w=254&h=180&c=7&r=0&o=5&pid=1.7 + +Son acuité visuelle est basée sur le mouvement.; Jurassic park; Ian Malcolm; 1993; https://tse1.mm.bing.net/th/id/OIP.H7i5IHvFUZl9DgyVtITn_wHaEK?w=296&h=180&c=7&r=0&o=5&pid=1.7 + +Nous allons dans le seul endroit au monde où ce sont les oies qui vous chassent !; Le monde perdu; Ian Malcolm; 1993; https://tse1.mm.bing.net/th/id/OIP.H7i5IHvFUZl9DgyVtITn_wHaEK?w=296&h=180&c=7&r=0&o=5&pid=1.7 + +Ce que vous faites dans la vie résonne dans l’éternité.; Gladiator; Maximus; 2000; https://tse2.mm.bing.net/th/id/OIP.JfomwO3LzG6t7lsTTPtonAHaK7?w=117&h=180&c=7&r=0&o=5&pid=1.7 + +Le véritable cœur de Rome n’est pas dans le marbre du Sénat, mais dans le sable du Colisée.; Gladiator; Sénateur Gracchus; 2000; https://tse3.mm.bing.net/th/id/OIP.v7fsQh9Sd5LytyVQoez3cwHaE2?w=194&h=127&c=7&r=0&o=5&pid=1.7 + +La boue s’efface plus facilement que le sang.; Gladiator; Maximus; 2000; https://tse2.mm.bing.net/th/id/OIP.JfomwO3LzG6t7lsTTPtonAHaK7?w=117&h=180&c=7&r=0&o=5&pid=1.7 + +Mon nom est gladiator…; Gladiator; Maximus; 2000; https://tse2.mm.bing.net/th/id/OIP.JfomwO3LzG6t7lsTTPtonAHaK7?w=117&h=180&c=7&r=0&o=5&pid=1.7 + +Ils peuvent nous ôter la vie… Mais ils ne nous ôteront jamais notre liberté.; Braveheart; William Wallace; 1995; https://tse2.mm.bing.net/th/id/OIP.UICndeUgBDrka76aTOvAKQHaLH?w=147&h=220&c=7&r=0&o=5&pid=1.7 + +Ton cœur est libre, trouve le courage de le suivre.; Braveheart; Malcolm Wallace; 1995; https://tse2.mm.bing.net/th/id/OIP.7MO2w6ic7ik2arvdOTejHwHaLa?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Ils se battirent en guerrier et en poète. Ils se battirent en écossais et gagnèrent leur liberté.; Braveheart; William Wallace; 1995; https://tse2.mm.bing.net/th/id/OIP.UICndeUgBDrka76aTOvAKQHaLH?w=147&h=220&c=7&r=0&o=5&pid=1.7 + +Il les a tuées avec leur amour. C’est comme ça tous les jours dans le monde entier.; La Ligne Verte; John Coffey; 1999; https://tse4.mm.bing.net/th/id/OIP.loqNhw71Vk_C-TiyWQJoKAHaKK?w=95&h=180&c=7&r=0&o=5&pid=1.7 + +On ne peut pas cacher ce qu’on a dans son cœur.; La Ligne Verte; John Coffey; 1999; https://tse4.mm.bing.net/th/id/OIP.loqNhw71Vk_C-TiyWQJoKAHaKK?w=95&h=180&c=7&r=0&o=5&pid=1.7 + +C’est comme si j’avais des bouts de verres dans ma tête… tout le temps.; La Ligne Verte; John Coffey; 1999; https://tse4.mm.bing.net/th/id/OIP.loqNhw71Vk_C-TiyWQJoKAHaKK?w=95&h=180&c=7&r=0&o=5&pid=1.7 + +John tenait a me donner un peu de lui. Le jour ou il a saisit ma main, une partie de son pouvoir est entrée en moi. Il nous a condamné a la vie.; La Ligne Verte; Paul Edgecomb; 1999; https://tse1.mm.bing.net/th/id/OIP.csFLWCPUhS7NhdJT8-Cq-QHaEL?w=270&h=180&c=7&r=0&o=5&pid=1.7 + +J’ai rêvé de toi, j’ai rêvé que tu cherchais ton chemin dans la nuit, tout comme moi, et nous finissions par nous rencontrer… dans les ténèbres nous errions l’un et l’autre.; La Ligne Verte; Melinda Moores; 1999; https://tse4.mm.bing.net/th/id/OIP.6XMc0WCQbJ5xbzekralK7gHaD4?w=301&h=180&c=7&r=0&o=5&pid=1.7 + +Tout ce que je sais, c’est qu’à chaque fois que je tue un homme je m’éloigne un peu plus de chez moi.; Il faut sauver le soldat Ryan; le capitaine Miller; 1998; https://tse3.mm.bing.net/th/id/OIP.BeQYJEP1pQKzHDLGhTLBtgHaFj?w=243&h=182&c=7&r=0&o=5&pid=1.7 + +C’est toujours rassurant de voir que le monde est encore plus cinglé que vous !; Thor : le monde des Ténèbres; Erik Selvig; 2011; https://tse4.mm.bing.net/th/id/OIP.mbfvWIhPg0gZJA5FGmkilwHaFr?w=188&h=180&c=7&r=0&o=5&pid=1.7 + +La victoire au prix du sang des innocents n’est pas la victoire de la justice, c’est la victoire de la honte.; Captain America : civil war; le roi T’Chaka; 2011; https://tse3.mm.bing.net/th/id/OIP.eYavZu8-Xp11x2Pod8v6bQHaKw?w=194&h=282&c=7&r=0&o=5&pid=1.7 + +La vengeance est un déesse dévorante. Eux aussi en sont victimes… Je ne dois pas céder à son appel. La justice finira par triompher.; Captain America : civil war; T’Challa / Black Panther; 2011; https://tse4.mm.bing.net/th/id/OIP.XNQPKwc1OUfvnSO9MsxDYgHaE7?w=202&h=180&c=7&r=0&o=5&pid=1.7 + +Je fais les mêmes choses que Captain, mais plus lentement.; Captain America : le soldat de l'hiver; Sam Wilson; 2011; https://tse4.mm.bing.net/th/id/OIP.5XrvOjUpYQsABU-bnFQIxwHaK7?w=127&h=187&c=7&r=0&o=5&pid=1.7 + +Tu obtiens quoi si tu croises un aliéné mental solitaire avec une société qui l’abandonne dans son coin et le traite comme de la merde ? Je vais te le dire, moi, ce que tu obtiens ! Tu obtiens ce que tu mérites, enculé !; Joker; le Joker; 2019; https://tse3.mm.bing.net/th/id/OIP.P4hzN60jIU4IQ7WnfJHN5AHaJQ?w=135&h=180&c=7&r=0&o=5&pid=1.7 + +Est-ce moi, ou est-ce le monde qui devient de plus en plus fou ?; Joker; le Joker; 2019; https://tse3.mm.bing.net/th/id/OIP.P4hzN60jIU4IQ7WnfJHN5AHaJQ?w=135&h=180&c=7&r=0&o=5&pid=1.7 + +Tout ce que j’ai c’est des idées noires.; Joker; le Joker; 2019; https://tse3.mm.bing.net/th/id/OIP.P4hzN60jIU4IQ7WnfJHN5AHaJQ?w=135&h=180&c=7&r=0&o=5&pid=1.7 + +Ma mère me dit tout le temps de sourire, de faire bonne figure, elle m’a dit que j’avais une mission dans la vie : mettre du rire et de la joie dans ce monde.; Joker; le Joker; 2019; https://tse3.mm.bing.net/th/id/OIP.P4hzN60jIU4IQ7WnfJHN5AHaJQ?w=135&h=180&c=7&r=0&o=5&pid=1.7 + +L’espoir est la seule chose plus forte que la peur.; Hunger Games; le président Snow; 2012; https://tse1.mm.bing.net/th/id/OIP._zw8Sl9IsgfLzI_gd9SvRQHaEK?w=243&h=180&c=7&r=0&o=5&pid=1.7 + +Si je dois mourir, je préfère rester comme je suis…; Hunger Games; Peeta; 2012; https://tse4.mm.bing.net/th/id/OIP.a93tPzA08bhvfY-tSHHYBwHaIt?w=194&h=229&c=7&r=0&o=5&pid=1.7 + +Tu ne vas pas mourir. Je te l’interdis. D’accord ?; Hunger Games; Katniss; 2012; https://tse4.mm.bing.net/th/id/OIP.6PMXCMTZgkDKCkeY-NP6sAHaKB?w=145&h=197&c=7&r=0&o=5&pid=1.7 + +Il faut que tu gagnes, Katniss.; Hunger Games; Rue; 2012; https://tse3.mm.bing.net/th/id/OIP.nn0EAEXX7rZ2fIMSSDThGQAAAA?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Je ne veux pas perdre le garçon avec le pain.; Hunger Games; Peeta; 2012; https://tse4.mm.bing.net/th/id/OIP.a93tPzA08bhvfY-tSHHYBwHaIt?w=194&h=229&c=7&r=0&o=5&pid=1.7 + +On pourrait le faire tu sais, s’enfuir et vivre dans les bois.; Hunger Games; Gale; 2012; https://tse4.mm.bing.net/th/id/OIP.iuYaquLDGgV_o3vDOphh-gHaLH?w=127&h=191&c=7&r=0&o=5&pid=1.7 + +Acceptez la possibilité de votre mort imminente. Et comprenez au plus profond de vous que je ne pourrais rien faire pour vous sauver.; Hunger Games; Haymitch Abernathy; 2012; https://tse2.mm.bing.net/th/id/OIP.UKHYE8eX_v3E_G8OSFUcjQAAAA?w=142&h=180&c=7&r=0&o=5&pid=1.7 + +Tu pourrais vivre cent vies que tu ne le mériterais pas tu sais…; Hunger Games; Haymitch Abernathy; 2012; https://tse2.mm.bing.net/th/id/OIP.UKHYE8eX_v3E_G8OSFUcjQAAAA?w=142&h=180&c=7&r=0&o=5&pid=1.7 + +Il ne faut surtout pas te laisser aller. C’est dix fois plus long de se reconstruire que de s’écrouler.; Hunger Games : l’embrasement; Finnick Odair; 2012; https://tse2.mm.bing.net/th/id/OIP.3Je-oEIjxk44RyMF3nSi-gHaEK?w=289&h=180&c=7&r=0&o=5&pid=1.7 + +Tu veux un sucre.; Hunger Games : l’embrasement; Finnick Odair; 2012; https://tse2.mm.bing.net/th/id/OIP.3Je-oEIjxk44RyMF3nSi-gHaEK?w=289&h=180&c=7&r=0&o=5&pid=1.7 + +Il n’y a plus de district 12 Katniss.; Hunger Games : l’embrasement; Gale; 2012; https://tse4.mm.bing.net/th/id/OIP.iuYaquLDGgV_o3vDOphh-gHaLH?w=127&h=191&c=7&r=0&o=5&pid=1.7 + +Si nous brûlons, vous brûlerez avec nous !; Hunger Games : la révolte - 1re partie; Katniss; 2012; https://tse4.mm.bing.net/th/id/OIP.6PMXCMTZgkDKCkeY-NP6sAHaKB?w=145&h=197&c=7&r=0&o=5&pid=1.7 + +J’imagine que le moment est mal choisi pour vous dire que j’ai pendu un mannequin par le cou et inscrit le nom de Seneca Crane sur son torse.; Hunger Games; Katniss; 2012; https://tse4.mm.bing.net/th/id/OIP.6PMXCMTZgkDKCkeY-NP6sAHaKB?w=145&h=197&c=7&r=0&o=5&pid=1.7 + +Le feux ça se propage et si nous brûlons vous brûlerez avec nous !; Hunger Games; Katniss; 2012; https://tse4.mm.bing.net/th/id/OIP.6PMXCMTZgkDKCkeY-NP6sAHaKB?w=145&h=197&c=7&r=0&o=5&pid=1.7 + +La peur ne te paralyse pas elle te réveille.; Divergente; Quatre; 2014; https://tse2.mm.bing.net/th/id/OIP.VGvVLSX6Yib-4x0JJOMWUQHaEK?w=305&h=180&c=7&r=0&o=5&pid=1.7 + +Les gens avides de pouvoir et qui finissent par l’obtenir vivent dans la terreur de le perdre. Et c’est pour cette raison qu’il ne faut en donner qu’à ceux qui ne le désirent pas.; Divergente; Tris; 2014; https://tse3.mm.bing.net/th/id/OIP.VYjPaxqX_66-rJho-f-rCQHaK4?w=194&h=284&c=7&r=0&o=5&pid=1.7 + +La politesse, ce n’est que de la fausseté dans un paquet-cadeau.; Divergente; Christina; 2014; https://tse3.mm.bing.net/th/id/OIP.-wz8nDaqKV8gu0xZsfcE_AHaLG?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Quand on a peu de possessions, peu de désirs et que tout le monde a la même chose, on ne convoite pas les biens des autres.; Divergente; Tris; 2014; https://tse3.mm.bing.net/th/id/OIP.VYjPaxqX_66-rJho-f-rCQHaK4?w=194&h=284&c=7&r=0&o=5&pid=1.7 + +Être désavoué par des lâches fait la grandeur des braves.; Les animaux fantastiques : les crimes de Grindewald; Grindelwald; 2016; https://tse4.mm.bing.net/th/id/OIP.FFOI1GRf_n-bX02pAlZYwQHaEc?w=244&h=180&c=7&r=0&o=5&pid=1.7 + +Je suis le feu. Je suis… la Mort.; Le hobbit : la désolation de Smaug; Smaug; 2012; https://tse2.mm.bing.net/th/id/OIP.3vXkEUJ9J8s-GsnBC6I3KAHaF0?w=185&h=180&c=7&r=0&o=5&pid=1.7 + +Je jure que je ne me séparerai pas d’une seule pièce d’or, pas de la moindre parcelle.; Le hobbit : la bataille des cinq armées; Thorin; 2012; https://tse4.mm.bing.net/th/id/OIP.F1alSEClhkaZE3VGDf9IbgHaHa?w=209&h=209&c=7&r=0&o=5&pid=1.7 + +De la loyauté, de l’honneur, un cœur vaillant, c’est tout ce que je demande !; Le Hobbit : un voyage inattendu; Thörin II Ecu-De-Chêne; 2012; https://tse1.mm.bing.net/th/id/OIP.AzOPUHw61pXF-W3a1giYwAHaFH?w=194&h=134&c=7&r=0&o=5&pid=1.7 + +Will Turner, est-ce que tu veux me prendre pour femme, pour le meilleur est pour le pire, je crois que le pire est à envisager.; Pirates des Caraïbes, jusqu’au bout du monde; Elizabeth; 2003; https://tse3.mm.bing.net/th/id/OIP.VFLqe8JlbX0imVJ-Rjn4mgHaDt?w=316&h=174&c=7&r=0&o=5&pid=1.7 + +Tous les trésors ne sont pas d’argent et d’or…; Pirates des Caraibes, la malédiction du Black Pearl; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 + +Tu ne remarques rien ? Ou plutôt ne remarques-tu pas l’absence de ce que tu devrais remarquer ?; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 + +Vous pouvez me tuer mon ami, mais ne m’insultez pas !; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 + +La mort a une curieuse façon de faire le tri parmi les priorités.; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 + +Mais il me semble que comme j’ai un navire et pas vous, c’est vous qui avez besoin que je vous sauve, et je ne sais pas si j’y suis vraiment disposé.; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 + +La cruauté est affaire de perspective.; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 + +Pas de ça de pas de ça !; Pirates des Caraïbes, jusqu’au bout du monde; Jack; 2003; https://tse2.mm.bing.net/th/id/OIP.l_zFAxgXMX9SnNDbFfXnqwHaFj?w=202&h=180&c=7&r=0&o=5&pid=1.7 + +Je sais pas c’qui me retient de le mettre en orbite !; Toy Story 2; M. Patate; 1995; https://tse1.mm.bing.net/th/id/OIP.je21xi_joSEUE4w8OkIg9gHaEL?w=317&h=180&c=7&r=0&o=5&pid=1.7 + +Tu m’as oublié en oubliant qui tu étais.; Le roi lion; Mufassa; 1994; https://tse3.mm.bing.net/th/id/OIP.raX8ZfSizmfVbeMrR0ghZgHaG2?w=173&h=180&c=7&r=0&o=5&pid=1.7 + +Quand le monde te persécute, tu te dois de persécuter le monde.; Le roi lion; Timon; 1994; https://tse3.mm.bing.net/th/id/OIP.djhwHrNS0CLKzx4LLJWpLAHaFs?w=173&h=180&c=7&r=0&o=5&pid=1.7 + +Regarde au delà de ce que tu vois.; Le roi lion; Rafiki; 1994; https://tse4.mm.bing.net/th/id/OIP.8My5fvsa2Z1P6oWhtJc6WQHaKl?w=127&h=181&c=7&r=0&o=5&pid=1.7 + +Et si je te le dis !; Le roi lion; Scar; 1994; https://tse3.mm.bing.net/th/id/OIP.b9_3MMu1kK4yyKVCt-wtYwHaEK?w=278&h=180&c=7&r=0&o=5&pid=1.7 + +Je patauge dans l’imbécillité.; Le roi lion; Scar; 1994; https://tse3.mm.bing.net/th/id/OIP.b9_3MMu1kK4yyKVCt-wtYwHaEK?w=278&h=180&c=7&r=0&o=5&pid=1.7 + +N’oublie pas qui tu es.; Le roi lion; Mufassa; 1994; https://tse3.mm.bing.net/th/id/OIP.raX8ZfSizmfVbeMrR0ghZgHaG2?w=173&h=180&c=7&r=0&o=5&pid=1.7 + +N’oublie pas qui tu es.; Le roi lion; Mufassa; 1994; https://tse3.mm.bing.net/th/id/OIP.raX8ZfSizmfVbeMrR0ghZgHaG2?w=173&h=180&c=7&r=0&o=5&pid=1.7 + +J’ai un corps d’Apollon et du plomb dans la tête.; La belle et la bête; Gaston; 1991; https://tse2.mm.bing.net/th/id/OIP.PziDszqyhWeRqKHDL8ouwgHaJ4?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +La mort… par décapitation…; Aladdin; Jafar; 1992; https://tse3.mm.bing.net/th/id/OIP.gl3qdaf8Njvek6PM5AVgXgHaFj?w=228&h=180&c=7&r=0&o=5&pid=1.7 + +Quand on a rien, il faut faire comme si tout nous appartenait.; Aladdin; Aladdin; 1992; https://tse4.mm.bing.net/th/id/OIP._TZXuDVR3nHwrSJ9PPxJvAHaFO?w=230&h=180&c=7&r=0&o=5&pid=1.7 + +Mon seul devoir est celui de mon cœur.; Mulan 2; Mulan; 1998; https://tse1.mm.bing.net/th/id/OIP.LTvVuaapKih6VpqAOtZudgHaK6?w=194&h=287&c=7&r=0&o=5&pid=1.7 + +Nan mais tu les as vus ?! Ils sont sortis, comme des marguerites !!; Mulan; Mushu; 1998; https://tse4.mm.bing.net/th/id/OIP.omU-pPTNgHJEiTKJUpB1MAHaIw?w=114&h=180&c=7&r=0&o=5&pid=1.7 + +Vous êtes le plus privilégié des privilégiés, en contrepartie il vous faut remplir certaines responsabilités.; À tout jamais, une histoire de Cendrillon; Danielle; 1950; https://tse2.mm.bing.net/th/id/OIP.79bf2opzc4vp3nvyKdI9QAHaHa?w=164&h=180&c=7&r=0&o=5&pid=1.7 + +Je rêve ou je suis en train de me battre en duel avec un cheval ?; Raiponce; Flynn Rider; 2010; https://tse1.mm.bing.net/th/id/OIP.3svdf3xniHZ5huU-D1cptQHaEK?w=329&h=185&c=7&r=0&o=5&pid=1.7 + +Wow, que d’émotions, et il est que huit heure du matin !; Raiponce; Flynn Rider; 2010; https://tse1.mm.bing.net/th/id/OIP.3svdf3xniHZ5huU-D1cptQHaEK?w=329&h=185&c=7&r=0&o=5&pid=1.7 + +Il ne se passera plus un jour, une heure, une minute sans que je me batte !; Raiponce; Raiponce; 2010; https://tse4.mm.bing.net/th/id/OIP.lObXQdwuf5hDc_g40knCmQHaDt?w=348&h=174&c=7&r=0&o=5&pid=1.7 + +Il suffit que je te regarde dans les yeux et je me sens… je me sens chez moi.; Le monde de Némo; Dory; 2003; https://tse2.mm.bing.net/th/id/OIP.zR4rzkK7q2wCcNwZd6jjegHaIC?w=163&h=180&c=7&r=0&o=5&pid=1.7 + +Je souffre de perte de la mémoire courte.; Le monde de Némo; Dory; 2003; https://tse2.mm.bing.net/th/id/OIP.zR4rzkK7q2wCcNwZd6jjegHaIC?w=163&h=180&c=7&r=0&o=5&pid=1.7 + +Oh il a de la chance de parler baleine !; Le monde de Némo; Dory; 2003; https://tse2.mm.bing.net/th/id/OIP.zR4rzkK7q2wCcNwZd6jjegHaIC?w=163&h=180&c=7&r=0&o=5&pid=1.7 + +Je ne vous connais pas, mais je vous aime déjà.; Là-haut; Dug; 2009; https://tse1.mm.bing.net/th/id/OIP.uDr845hAlB9JoYe8i-DJ0QAAAA?w=294&h=170&c=7&r=0&o=5&pid=1.7 + +Arrête de faire ton Jean-Jacques !; Coco; Coco; 2017; https://tse1.mm.bing.net/th/id/OIP.GPIbva8dEP6Kllx-sj5ysAHaK-?w=115&h=180&c=7&r=0&o=5&pid=1.7 + +Tu conduis comme tu répares les routes.; Cars; Doc Hudson; 2006; https://tse1.mm.bing.net/th/id/OIP.7ZWmLIPHcKWDZZjROnCh3AHaDF?w=287&h=145&c=7&r=0&o=5&pid=1.7 + +Je ne veux pas d’excuses, je veux des résultats !; Madagascar; les pingouins; 2005; https://tse2.mm.bing.net/th/id/OIP.UMdT8raLVqv9rCr2E1O_nAHaFS?w=244&h=180&c=7&r=0&o=5&pid=1.7 + +Tu me mords… LES MEULES !; Madagascar; Marty; 2005; https://tse2.mm.bing.net/th/id/OIP.Qoh2doQIigxyiOBuhgRx9gHaM7?w=115&h=186&c=7&r=0&o=5&pid=1.7 + +Pour toi poupée, je me couperais en quatre…; Shrek 2; le chat potté; 2001; https://tse4.mm.bing.net/th/id/OIP.kS6XFK6-lD-RzYdwHAj_LgHaEK?w=255&h=180&c=7&r=0&o=5&pid=1.7 + +Ma maman elle est malade et mon papa il dévalise les poubelles.; Shrek; le chat potté; 2001; https://tse4.mm.bing.net/th/id/OIP.kS6XFK6-lD-RzYdwHAj_LgHaEK?w=255&h=180&c=7&r=0&o=5&pid=1.7 + +Moi je vois pas l’intérêt de savoir parler si je peux pas raconter les secrets !; Shrek; l'âne; 2001; https://tse3.mm.bing.net/th/id/OIP.-1Ds-2D5GPiu9uejDdmgNgHaH3?w=124&h=180&c=7&r=0&o=5&pid=1.7 + +Nouille ou pas nouille, tu te préoccupes trop de ce qui a été ou de ce qui sera.; Kung Fu Panda; Maître Oogway; 2008; https://tse4.mm.bing.net/th/id/OIP.QzDh_d2T5aADiDJ7uMFU6gHaHa?w=157&h=180&c=7&r=0&o=5&pid=1.7 + +On ne facture pas la toplessitude et la séductivité.; Kung Fu Panda; Po; 2008; https://tse2.mm.bing.net/th/id/OIP.oBoBPN1VKEeJglTjZbtRUAHaJ5?w=94&h=180&c=7&r=0&o=5&pid=1.7 + +Mon nom est Po, et il va me falloir un chapeau !; Kung Fu Panda 2; Po; 2008; https://tse2.mm.bing.net/th/id/OIP.oBoBPN1VKEeJglTjZbtRUAHaJ5?w=94&h=180&c=7&r=0&o=5&pid=1.7 + Tu viens de me montrer au complet ?!; Dragons; Harold; 2010; https://tse2.mm.bing.net/th/id/OIP._OiJHgI7cal4cWNHcCE9zAHaM2?w=115&h=180&c=7&r=0&o=5&pid=1.7 \ No newline at end of file diff --git a/composer.json b/composer.json index a2369e3..5174d0b 100644 --- a/composer.json +++ b/composer.json @@ -1,15 +1,15 @@ -{ - "require": { - "twig/twig": "^3.0", - "ext-pdo": "*", - "altorouter/altorouter": "^2.0" - }, - "autoload": { - "psr-4": { - "Controleur\\": "src/Controleur/", - "Model\\": "src/Model/", - "Gateway\\": "src/Gateway/", - "Entity\\": "src/Entity/" - } - } -} +{ + "require": { + "twig/twig": "^3.0", + "ext-pdo": "*", + "altorouter/altorouter": "^2.0" + }, + "autoload": { + "psr-4": { + "Controleur\\": "src/Controleur/", + "Model\\": "src/Model/", + "Gateway\\": "src/Gateway/", + "Entity\\": "src/Entity/" + } + } +} diff --git a/composer.lock b/composer.lock index 32a9531..b200c60 100644 --- a/composer.lock +++ b/composer.lock @@ -1,462 +1,462 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "68804b2111cb6b8bf6edf66cb2b4669c", - "packages": [ - { - "name": "altorouter/altorouter", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/dannyvankooten/AltoRouter.git", - "reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2", - "reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "require-dev": { - "codeclimate/php-test-reporter": "dev-master", - "phpunit/phpunit": "5.7.*", - "squizlabs/php_codesniffer": "3.4.2" - }, - "type": "library", - "autoload": { - "classmap": [ - "AltoRouter.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Danny van Kooten", - "email": "dannyvankooten@gmail.com", - "homepage": "http://dannyvankooten.com/" - }, - { - "name": "Koen Punt", - "homepage": "https://github.com/koenpunt" - }, - { - "name": "niahoo", - "homepage": "https://github.com/niahoo" - } - ], - "description": "A lightning fast router for PHP", - "homepage": "https://github.com/dannyvankooten/AltoRouter", - "keywords": [ - "lightweight", - "router", - "routing" - ], - "support": { - "issues": "https://github.com/dannyvankooten/AltoRouter/issues", - "source": "https://github.com/dannyvankooten/AltoRouter/tree/2.0.2" - }, - "time": "2020-03-09T08:34:59+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.5.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "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": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.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": "2024-04-18T09:32:20+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.31.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.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": "2024-09-09T11:45:10+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.31.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "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 the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.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": "2024-09-09T11:45:10+00:00" - }, - { - "name": "symfony/polyfill-php81", - "version": "v1.31.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", - "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.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": "2024-09-09T11:45:10+00:00" - }, - { - "name": "twig/twig", - "version": "v3.14.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72", - "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72", - "shasum": "" - }, - "require": { - "php": ">=8.0.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php81": "^1.29" - }, - "require-dev": { - "psr/container": "^1.0|^2.0", - "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/Resources/core.php", - "src/Resources/debug.php", - "src/Resources/escaper.php", - "src/Resources/string_loader.php" - ], - "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.14.0" - }, - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/twig/twig", - "type": "tidelift" - } - ], - "time": "2024-09-09T17:55:12+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": {}, - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "ext-pdo": "*" - }, - "platform-dev": {}, - "plugin-api-version": "2.6.0" -} +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "68804b2111cb6b8bf6edf66cb2b4669c", + "packages": [ + { + "name": "altorouter/altorouter", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/dannyvankooten/AltoRouter.git", + "reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2", + "reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "require-dev": { + "codeclimate/php-test-reporter": "dev-master", + "phpunit/phpunit": "5.7.*", + "squizlabs/php_codesniffer": "3.4.2" + }, + "type": "library", + "autoload": { + "classmap": [ + "AltoRouter.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Danny van Kooten", + "email": "dannyvankooten@gmail.com", + "homepage": "http://dannyvankooten.com/" + }, + { + "name": "Koen Punt", + "homepage": "https://github.com/koenpunt" + }, + { + "name": "niahoo", + "homepage": "https://github.com/niahoo" + } + ], + "description": "A lightning fast router for PHP", + "homepage": "https://github.com/dannyvankooten/AltoRouter", + "keywords": [ + "lightweight", + "router", + "routing" + ], + "support": { + "issues": "https://github.com/dannyvankooten/AltoRouter/issues", + "source": "https://github.com/dannyvankooten/AltoRouter/tree/2.0.2" + }, + "time": "2020-03-09T08:34:59+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "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": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.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": "2024-04-18T09:32:20+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.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": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "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 the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.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": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.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": "2024-09-09T11:45:10+00:00" + }, + { + "name": "twig/twig", + "version": "v3.14.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72", + "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php81": "^1.29" + }, + "require-dev": { + "psr/container": "^1.0|^2.0", + "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/Resources/core.php", + "src/Resources/debug.php", + "src/Resources/escaper.php", + "src/Resources/string_loader.php" + ], + "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.14.0" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2024-09-09T17:55:12+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "ext-pdo": "*" + }, + "platform-dev": {}, + "plugin-api-version": "2.6.0" +} diff --git a/config/config.php b/config/config.php index 4b9837b..070fad3 100644 --- a/config/config.php +++ b/config/config.php @@ -1,35 +1,36 @@ - \ No newline at end of file diff --git a/drone.yml b/drone.yml index 903d8ca..e34626c 100644 --- a/drone.yml +++ b/drone.yml @@ -1,62 +1,62 @@ -kind: pipeline -type: docker -name: CI-pipeline - -trigger: - branch: - - master - event: - - push - -steps: - - - - name: code-inspection - image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet8 - secrets: [ SECRET_SONAR_LOGIN ] - settings: - sonar_host: https://codefirst.iut.uca.fr/sonar/ - sonar_token: - from_secret: SECRET_SONAR_LOGIN - commands: - - dotnet sonarscanner begin /k:WF-Website /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="" /d:sonar.login=$${PLUGIN_SONAR_TOKEN} - - - reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport" - - dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN} - - # database container deployment - - name: deploy-container-mysql-WIKI_FANTASY - image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest - environment: - IMAGENAME: mysql:latest - CONTAINERNAME: mysql - COMMAND: create - OVERWRITE: false - PRIVATE: true - - CODEFIRST_CLIENTDRONE_ENV_MYSQL_ROOT_PASSWORD: - from_secret: db_root_password - CODEFIRST_CLIENTDRONE_ENV_MYSQL_DATABASE: - from_secret: db_database - CODEFIRST_CLIENTDRONE_ENV_MYSQL_USER: - from_secret: db_user - CODEFIRST_CLIENTDRONE_ENV_MYSQL_PASSWORD: - from_secret: db_password - ADMINS: kentinbrongniart , kevinmondejar , lenibeaulaton , louisguichard-montguers , maximerocher , tommynguyen , matthieurestituito - - - - name: generate-and-deploy-docs - image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer - failure: ignore - volumes: - - name: - path: - commands: - - /entrypoint.sh - when: - branch: - - master - event: - - push - - pull_request - depends_on: [] +kind: pipeline +type: docker +name: CI-pipeline + +trigger: + branch: + - master + event: + - push + +steps: + + + - name: code-inspection + image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet8 + secrets: [ SECRET_SONAR_LOGIN ] + settings: + sonar_host: https://codefirst.iut.uca.fr/sonar/ + sonar_token: + from_secret: SECRET_SONAR_LOGIN + commands: + - dotnet sonarscanner begin /k:WF-Website /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="" /d:sonar.login=$${PLUGIN_SONAR_TOKEN} + + - reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport" + - dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN} + + # database container deployment + - name: deploy-container-mysql-WIKI_FANTASY + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest + environment: + IMAGENAME: mysql:latest + CONTAINERNAME: mysql + COMMAND: create + OVERWRITE: false + PRIVATE: true + + CODEFIRST_CLIENTDRONE_ENV_MYSQL_ROOT_PASSWORD: + from_secret: db_root_password + CODEFIRST_CLIENTDRONE_ENV_MYSQL_DATABASE: + from_secret: db_database + CODEFIRST_CLIENTDRONE_ENV_MYSQL_USER: + from_secret: db_user + CODEFIRST_CLIENTDRONE_ENV_MYSQL_PASSWORD: + from_secret: db_password + ADMINS: kentinbrongniart , kevinmondejar , lenibeaulaton , louisguichard-montguers , maximerocher , tommynguyen , matthieurestituito + + + - name: generate-and-deploy-docs + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer + failure: ignore + volumes: + - name: + path: + commands: + - /entrypoint.sh + when: + branch: + - master + event: + - push + - pull_request + depends_on: [] diff --git a/images/coeur.svg b/images/coeur.svg index 4ac9bb7..ffaaab5 100644 --- a/images/coeur.svg +++ b/images/coeur.svg @@ -1,3 +1,3 @@ - - - + + + diff --git a/images/dark.svg b/images/dark.svg index 442157b..57b8d3f 100644 --- a/images/dark.svg +++ b/images/dark.svg @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/images/light.svg b/images/light.svg index ad790ed..9372b72 100644 --- a/images/light.svg +++ b/images/light.svg @@ -1,10 +1,10 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/images/quizz.svg b/images/quizz.svg index 4b7c2c3..66188e1 100644 --- a/images/quizz.svg +++ b/images/quizz.svg @@ -1,3 +1,3 @@ - - - + + + diff --git a/index.php b/index.php index 22d42ce..69d0496 100644 --- a/index.php +++ b/index.php @@ -1,30 +1,30 @@ - false, -]); - -$twig->addGlobal('racine','/~kekentin/WF/WF-Website'); - -$cont = new Controleur\FrontControler($co); - -session_unset(); -session_destroy(); -$_SESSION = array(); - -?> + false, +]); + +$twig->addGlobal('racine','/~kekentin/WF/WF-Website'); + +$cont = new Controleur\FrontControler($co); + +session_unset(); +session_destroy(); +$_SESSION = array(); + +?> diff --git a/public/images/coeur.svg b/public/images/coeur.svg index 4ac9bb7..ffaaab5 100644 --- a/public/images/coeur.svg +++ b/public/images/coeur.svg @@ -1,3 +1,3 @@ - - - + + + diff --git a/public/images/dark.svg b/public/images/dark.svg index 442157b..57b8d3f 100644 --- a/public/images/dark.svg +++ b/public/images/dark.svg @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/public/images/light.svg b/public/images/light.svg index ad790ed..9372b72 100644 --- a/public/images/light.svg +++ b/public/images/light.svg @@ -1,10 +1,10 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/public/images/quizz.svg b/public/images/quizz.svg index 4b7c2c3..66188e1 100644 --- a/public/images/quizz.svg +++ b/public/images/quizz.svg @@ -1,3 +1,3 @@ - - - + + + diff --git a/public/script/auth-check.js b/public/script/auth-check.js index 02d72d9..122ce31 100644 --- a/public/script/auth-check.js +++ b/public/script/auth-check.js @@ -1,39 +1,39 @@ -// auth-check.js - -// Vérifier si l'utilisateur est connecté -function isUserLoggedIn() { - // Vérifiez si 'isLoggedIn' est défini dans le localStorage ou par un cookie - return localStorage.getItem('isLoggedIn') === 'true'; -} - -// Redirection des liens en fonction de l'état de connexion -function setupLinks() { - const favoriteLink = document.querySelector('a[href="favorite.html"]'); - const quizLink = document.querySelector('a[href="quiz.html"]'); - const userIcon = document.querySelector('.user img'); - - if (!isUserLoggedIn()) { - // Si l'utilisateur n'est pas connecté, rediriger vers la page de connexion - if (favoriteLink) favoriteLink.href = "login.html"; - if (quizLink) quizLink.href = "login.html"; - if (userIcon) { - userIcon.style.cursor = "pointer"; // Changer le curseur pour indiquer la cliquabilité - userIcon.addEventListener('click', () => { - window.location.href = "login.html"; - }); - } - } else { - // Si l'utilisateur est connecté, définir les liens vers les pages dédiées - if (favoriteLink) favoriteLink.href = "favorite.html"; - if (quizLink) quizLink.href = "quiz.html"; - if (userIcon) { - userIcon.style.cursor = "pointer"; // Changer le curseur pour indiquer la cliquabilité - userIcon.addEventListener('click', () => { - window.location.href = "user-profile.html"; - }); - } - } -} - -// Initialiser les liens lors du chargement de la page -document.addEventListener('DOMContentLoaded', setupLinks); +// auth-check.js + +// Vérifier si l'utilisateur est connecté +function isUserLoggedIn() { + // Vérifiez si 'isLoggedIn' est défini dans le localStorage ou par un cookie + return localStorage.getItem('isLoggedIn') === 'true'; +} + +// Redirection des liens en fonction de l'état de connexion +function setupLinks() { + const favoriteLink = document.querySelector('a[href="favorite.html"]'); + const quizLink = document.querySelector('a[href="quiz.html"]'); + const userIcon = document.querySelector('.user img'); + + if (!isUserLoggedIn()) { + // Si l'utilisateur n'est pas connecté, rediriger vers la page de connexion + if (favoriteLink) favoriteLink.href = "login.html"; + if (quizLink) quizLink.href = "login.html"; + if (userIcon) { + userIcon.style.cursor = "pointer"; // Changer le curseur pour indiquer la cliquabilité + userIcon.addEventListener('click', () => { + window.location.href = "login.html"; + }); + } + } else { + // Si l'utilisateur est connecté, définir les liens vers les pages dédiées + if (favoriteLink) favoriteLink.href = "favorite.html"; + if (quizLink) quizLink.href = "quiz.html"; + if (userIcon) { + userIcon.style.cursor = "pointer"; // Changer le curseur pour indiquer la cliquabilité + userIcon.addEventListener('click', () => { + window.location.href = "user-profile.html"; + }); + } + } +} + +// Initialiser les liens lors du chargement de la page +document.addEventListener('DOMContentLoaded', setupLinks); diff --git a/public/script/changeData.js b/public/script/changeData.js index 4250c12..a3bbc32 100644 --- a/public/script/changeData.js +++ b/public/script/changeData.js @@ -1,169 +1,169 @@ - -function editFieldUsername(id) { - var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - var currentValue = pElement.textContent.trim();// Obtenir le texte actuel du

- - // Créer un champ de saisie avec la valeur actuelle - var input = document.createElement('input'); - input.type = 'text'; - input.value = currentValue - input.class = 'changeValue'; - - input.setAttribute('onblur', 'saveFieldUsername("' + id + '", this.value)'); // Sauvegarde lors de la perte de focus - - // Remplacer le

par le champ - pElement.innerHTML = ''; - pElement.appendChild(input); - - input.focus(); // Mettre le focus sur le champ de saisie -} - -//Sauvegarder les changements sur la vue pour le username -function saveFieldUsername(id, newValue) { - if (id === 'username') { - if (newValue.trim() === "") { - alert('Le nom d\'utilisateur ne peut pas être vide.'); - document.getElementById(id).querySelector('input').focus(); - return; // Ne pas sauvegarder si le nom d'utilisateur est vide - } - } - - var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - - // Mettre à jour la valeur avec la nouvelle saisie - pElement.innerHTML = '' + newValue + ' '; -} - - - - -function editFieldEmail(id) { - var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - var currentValue = pElement.textContent.trim();// Obtenir le texte actuel du

- - // Créer un champ de saisie avec la valeur actuelle - var input = document.createElement('input'); - input.type = 'email'; - input.value = currentValue - input.class = 'changeValue'; - - input.setAttribute('onblur', 'saveFieldEmail("' + id + '", this.value)'); // Sauvegarde lors de la perte de focus - - // Remplacer le

par le champ - pElement.innerHTML = ''; - pElement.appendChild(input); - - input.focus(); // Mettre le focus sur le champ de saisie -} - -//Sauvegarder les changements sur la vue pour l'email -function saveFieldEmail(id, newValue) { - if (id === 'email') { - if (!validateEmail(newValue)) { - alert('Adresse email invalide. Veuillez entrer un email valide.'); - document.getElementById(id).querySelector('input').focus(); - return; // Ne pas sauvegarder si l'email n'est pas valide - } - } - if (id === 'username') { - if (newValue.trim() === "") { - alert('Le nom d\'utilisateur ne peut pas être vide.'); - document.getElementById(id).querySelector('input').focus(); - return; // Ne pas sauvegarder si le nom d'utilisateur est vide - } - } - - var pElement = document.getElementById(id); // Récupérer l'élément

via son identifiant - - // Mettre à jour la valeur avec la nouvelle saisie - pElement.innerHTML = '' + newValue + ' '; -} - - - - -//Email valide -function validateEmail(email) { - var re = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;// Regex pour vérifier le format de l'email - return re.test(String(email).toLowerCase()); -} - - - - - - - -function editFieldPassWd(id) { - var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - - pElement.innerHTML = '';// Effacer le contenu actuel de

pour insérer les inputs - - // Créer le champ de saisie pour le nouveau mot de passe - var inputNewPass = document.createElement('input'); - inputNewPass.type = 'password'; - inputNewPass.placeholder = 'Nouveau mot de passe'; // Un placeholder pour indiquer la fonction du champ - inputNewPass.classList.add('changeValue'); // Ajouter une classe CSS pour styliser l'input - inputNewPass.setAttribute('id', 'newPassword'); // Ajouter un ID pour la gestion - inputNewPass.classList.add('inputPasswd'); // Ajouter une classe au input - - - // Créer le champ de saisie pour la confirmation du mot de passe - var inputConfirmPass = document.createElement('input'); - inputConfirmPass.type = 'password'; - inputConfirmPass.placeholder = 'Confirmer le mot de passe'; // Un placeholder pour indiquer la fonction du champ - inputConfirmPass.classList.add('changeValue'); // Ajouter une classe CSS pour styliser l'input - inputConfirmPass.setAttribute('id', 'confirmPassword'); // Ajouter un ID pour la gestion - inputConfirmPass.classList.add('inputPasswd'); // Ajouter une classe au input - - // Ajouter un bouton de sauvegarde - var saveButton = document.createElement('button'); - saveButton.textContent = 'Sauvegarder le mot de passe'; - saveButton.classList.add('saveButtonPasswd'); // Ajouter une classe au bouton - - saveButton.onclick = function() { - savePasswordFields(id, inputNewPass.value, inputConfirmPass.value); - - }; - - // Ajouter les deux champs de saisie et le bouton dans l'élément

- pElement.appendChild(inputNewPass); - pElement.appendChild(document.createElement('br')); // Saut de ligne pour espacer les champs - pElement.appendChild(inputConfirmPass); - pElement.appendChild(document.createElement('br')); // Saut de ligne pour espacer - pElement.appendChild(saveButton); - - inputNewPass.focus();// Mettre le focus sur le premier champ de saisie -} - - - -function savePasswordFields(id, newPassword, confirmPassword) { - // Vérification si les champs sont vides - if (newPassword.trim() === "" || confirmPassword.trim() === ""){ - alert("Les champs de mot de passe ne doivent pas être vides."); - return; - } - - // Vérification de la correspondance des deux mots de passe - if (newPassword === confirmPassword) { - - var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant - - if(newPassword.length >= 16){ - var maskedPassword = '*'.repeat(16); // Masquer le nouveau mot de passe pour l'affichage - } - else{ - var maskedPassword = "*".repeat(newPassword.length); // Masquer le nouveau mot de passe pour l'affichage - } - - // Remplacer les champs input par le texte masqué - pElement.innerHTML = '' + maskedPassword + ' '; - alert('Mot de passe mis à jour avec succès'); - - // Possibilité d'ajouter ici une fonction pour envoyer les nouveaux mots de passe au serveur - - } else { - alert('Les mots de passe ne correspondent pas.'); - } -} + +function editFieldUsername(id) { + var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant + var currentValue = pElement.textContent.trim();// Obtenir le texte actuel du

+ + // Créer un champ de saisie avec la valeur actuelle + var input = document.createElement('input'); + input.type = 'text'; + input.value = currentValue + input.class = 'changeValue'; + + input.setAttribute('onblur', 'saveFieldUsername("' + id + '", this.value)'); // Sauvegarde lors de la perte de focus + + // Remplacer le

par le champ + pElement.innerHTML = ''; + pElement.appendChild(input); + + input.focus(); // Mettre le focus sur le champ de saisie +} + +//Sauvegarder les changements sur la vue pour le username +function saveFieldUsername(id, newValue) { + if (id === 'username') { + if (newValue.trim() === "") { + alert('Le nom d\'utilisateur ne peut pas être vide.'); + document.getElementById(id).querySelector('input').focus(); + return; // Ne pas sauvegarder si le nom d'utilisateur est vide + } + } + + var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant + + // Mettre à jour la valeur avec la nouvelle saisie + pElement.innerHTML = '' + newValue + ' '; +} + + + + +function editFieldEmail(id) { + var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant + var currentValue = pElement.textContent.trim();// Obtenir le texte actuel du

+ + // Créer un champ de saisie avec la valeur actuelle + var input = document.createElement('input'); + input.type = 'email'; + input.value = currentValue + input.class = 'changeValue'; + + input.setAttribute('onblur', 'saveFieldEmail("' + id + '", this.value)'); // Sauvegarde lors de la perte de focus + + // Remplacer le

par le champ + pElement.innerHTML = ''; + pElement.appendChild(input); + + input.focus(); // Mettre le focus sur le champ de saisie +} + +//Sauvegarder les changements sur la vue pour l'email +function saveFieldEmail(id, newValue) { + if (id === 'email') { + if (!validateEmail(newValue)) { + alert('Adresse email invalide. Veuillez entrer un email valide.'); + document.getElementById(id).querySelector('input').focus(); + return; // Ne pas sauvegarder si l'email n'est pas valide + } + } + if (id === 'username') { + if (newValue.trim() === "") { + alert('Le nom d\'utilisateur ne peut pas être vide.'); + document.getElementById(id).querySelector('input').focus(); + return; // Ne pas sauvegarder si le nom d'utilisateur est vide + } + } + + var pElement = document.getElementById(id); // Récupérer l'élément

via son identifiant + + // Mettre à jour la valeur avec la nouvelle saisie + pElement.innerHTML = '' + newValue + ' '; +} + + + + +//Email valide +function validateEmail(email) { + var re = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;// Regex pour vérifier le format de l'email + return re.test(String(email).toLowerCase()); +} + + + + + + + +function editFieldPassWd(id) { + var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant + + pElement.innerHTML = '';// Effacer le contenu actuel de

pour insérer les inputs + + // Créer le champ de saisie pour le nouveau mot de passe + var inputNewPass = document.createElement('input'); + inputNewPass.type = 'password'; + inputNewPass.placeholder = 'Nouveau mot de passe'; // Un placeholder pour indiquer la fonction du champ + inputNewPass.classList.add('changeValue'); // Ajouter une classe CSS pour styliser l'input + inputNewPass.setAttribute('id', 'newPassword'); // Ajouter un ID pour la gestion + inputNewPass.classList.add('inputPasswd'); // Ajouter une classe au input + + + // Créer le champ de saisie pour la confirmation du mot de passe + var inputConfirmPass = document.createElement('input'); + inputConfirmPass.type = 'password'; + inputConfirmPass.placeholder = 'Confirmer le mot de passe'; // Un placeholder pour indiquer la fonction du champ + inputConfirmPass.classList.add('changeValue'); // Ajouter une classe CSS pour styliser l'input + inputConfirmPass.setAttribute('id', 'confirmPassword'); // Ajouter un ID pour la gestion + inputConfirmPass.classList.add('inputPasswd'); // Ajouter une classe au input + + // Ajouter un bouton de sauvegarde + var saveButton = document.createElement('button'); + saveButton.textContent = 'Sauvegarder le mot de passe'; + saveButton.classList.add('saveButtonPasswd'); // Ajouter une classe au bouton + + saveButton.onclick = function() { + savePasswordFields(id, inputNewPass.value, inputConfirmPass.value); + + }; + + // Ajouter les deux champs de saisie et le bouton dans l'élément

+ pElement.appendChild(inputNewPass); + pElement.appendChild(document.createElement('br')); // Saut de ligne pour espacer les champs + pElement.appendChild(inputConfirmPass); + pElement.appendChild(document.createElement('br')); // Saut de ligne pour espacer + pElement.appendChild(saveButton); + + inputNewPass.focus();// Mettre le focus sur le premier champ de saisie +} + + + +function savePasswordFields(id, newPassword, confirmPassword) { + // Vérification si les champs sont vides + if (newPassword.trim() === "" || confirmPassword.trim() === ""){ + alert("Les champs de mot de passe ne doivent pas être vides."); + return; + } + + // Vérification de la correspondance des deux mots de passe + if (newPassword === confirmPassword) { + + var pElement = document.getElementById(id);// Récupérer l'élément

via son identifiant + + if(newPassword.length >= 16){ + var maskedPassword = '*'.repeat(16); // Masquer le nouveau mot de passe pour l'affichage + } + else{ + var maskedPassword = "*".repeat(newPassword.length); // Masquer le nouveau mot de passe pour l'affichage + } + + // Remplacer les champs input par le texte masqué + pElement.innerHTML = '' + maskedPassword + ' '; + alert('Mot de passe mis à jour avec succès'); + + // Possibilité d'ajouter ici une fonction pour envoyer les nouveaux mots de passe au serveur + + } else { + alert('Les mots de passe ne correspondent pas.'); + } +} diff --git a/public/script/theme-toggle.js b/public/script/theme-toggle.js index 3954f9f..e10cd94 100644 --- a/public/script/theme-toggle.js +++ b/public/script/theme-toggle.js @@ -1,51 +1,51 @@ -// Quand le document est prêt -document.addEventListener("DOMContentLoaded", function() { - const themeIcon = document.getElementById('theme-icon'); - const favicon = document.getElementById('favicon'); // Sélectionne la favicon - - // Vérifie si les éléments existent bien avant d'y accéder - if (themeIcon && favicon) { - const currentTheme = localStorage.getItem('theme') || 'dark'; // Par défaut, sombre - - // Applique le bon thème au chargement de la page - if (currentTheme === 'light') { - document.body.classList.remove('dark-mode'); - document.body.classList.add('light-mode'); - themeIcon.src = 'images/light.svg'; // Affiche l'icône pour basculer vers le mode sombre - favicon.href = 'images/iconeClaire.ico'; // Favicon pour le mode clair - } else { - document.body.classList.add('dark-mode'); - themeIcon.src = 'images/dark.svg'; // Affiche l'icône pour basculer vers le mode clair - favicon.href = 'images/iconeSombre.ico'; // Favicon pour le mode sombre - } - } else { - console.error("Élément(s) manquant(s) : icône du thème ou favicon."); - } -}); - -// Fonction pour basculer entre les thèmes -function toggleTheme() { - const body = document.body; - const themeIcon = document.getElementById('theme-icon'); - const favicon = document.getElementById('favicon'); // Sélectionne la favicon - - if (themeIcon && favicon) { - if (body.classList.contains('dark-mode')) { - // Si on est en mode sombre, on passe en mode clair - body.classList.remove('dark-mode'); - body.classList.add('light-mode'); - themeIcon.src = 'images/light.svg'; // Change vers le logo sombre - favicon.href = 'images/iconeClaire.ico'; // Favicon pour le mode clair - localStorage.setItem('theme', 'light'); // Enregistre le thème clair dans localStorage - } else { - // Sinon, on repasse en mode sombre - body.classList.remove('light-mode'); - body.classList.add('dark-mode'); - themeIcon.src = 'images/dark.svg'; // Change vers le logo clair - favicon.href = 'images/iconeSombre.ico'; // Favicon pour le mode sombre - localStorage.setItem('theme', 'dark'); // Enregistre le thème sombre dans localStorage - } - } else { - console.error("Impossible de trouver l'icône ou le favicon."); - } -} +// Quand le document est prêt +document.addEventListener("DOMContentLoaded", function() { + const themeIcon = document.getElementById('theme-icon'); + const favicon = document.getElementById('favicon'); // Sélectionne la favicon + + // Vérifie si les éléments existent bien avant d'y accéder + if (themeIcon && favicon) { + const currentTheme = localStorage.getItem('theme') || 'dark'; // Par défaut, sombre + + // Applique le bon thème au chargement de la page + if (currentTheme === 'light') { + document.body.classList.remove('dark-mode'); + document.body.classList.add('light-mode'); + themeIcon.src = 'images/light.svg'; // Affiche l'icône pour basculer vers le mode sombre + favicon.href = 'images/iconeClaire.ico'; // Favicon pour le mode clair + } else { + document.body.classList.add('dark-mode'); + themeIcon.src = 'images/dark.svg'; // Affiche l'icône pour basculer vers le mode clair + favicon.href = 'images/iconeSombre.ico'; // Favicon pour le mode sombre + } + } else { + console.error("Élément(s) manquant(s) : icône du thème ou favicon."); + } +}); + +// Fonction pour basculer entre les thèmes +function toggleTheme() { + const body = document.body; + const themeIcon = document.getElementById('theme-icon'); + const favicon = document.getElementById('favicon'); // Sélectionne la favicon + + if (themeIcon && favicon) { + if (body.classList.contains('dark-mode')) { + // Si on est en mode sombre, on passe en mode clair + body.classList.remove('dark-mode'); + body.classList.add('light-mode'); + themeIcon.src = 'images/light.svg'; // Change vers le logo sombre + favicon.href = 'images/iconeClaire.ico'; // Favicon pour le mode clair + localStorage.setItem('theme', 'light'); // Enregistre le thème clair dans localStorage + } else { + // Sinon, on repasse en mode sombre + body.classList.remove('light-mode'); + body.classList.add('dark-mode'); + themeIcon.src = 'images/dark.svg'; // Change vers le logo clair + favicon.href = 'images/iconeSombre.ico'; // Favicon pour le mode sombre + localStorage.setItem('theme', 'dark'); // Enregistre le thème sombre dans localStorage + } + } else { + console.error("Impossible de trouver l'icône ou le favicon."); + } +} diff --git a/public/script/truncateQuotes.js b/public/script/truncateQuotes.js index d1d38b4..a3e600f 100644 --- a/public/script/truncateQuotes.js +++ b/public/script/truncateQuotes.js @@ -1,11 +1,11 @@ -document.addEventListener("DOMContentLoaded", function() { - const quoteElements = document.querySelectorAll('.citation-container .quote'); - - quoteElements.forEach(quote => { - let maxLength = 135; // Nombre max de caractères avant la coupure - if (quote.textContent.length > maxLength) { - let displayedText = quote.textContent.slice(0, maxLength) + '...\"'; - quote.textContent = displayedText; - } - }); -}); +document.addEventListener("DOMContentLoaded", function() { + const quoteElements = document.querySelectorAll('.citation-container .quote'); + + quoteElements.forEach(quote => { + let maxLength = 135; // Nombre max de caractères avant la coupure + if (quote.textContent.length > maxLength) { + let displayedText = quote.textContent.slice(0, maxLength) + '...\"'; + quote.textContent = displayedText; + } + }); +}); diff --git a/public/styles/style.css b/public/styles/style.css index e445ec4..63e9bd8 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -1,145 +1,145 @@ -/* header.css */ - -/* Styles généraux */ -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: #120b1d; - font-family: "Lemon", serif; - margin-top: 200px; -} - -/* Header */ -.header { - display: flex; - position: fixed; - background-color: #000000; - right: 0; - top: 0; - width: 100%; - text-align: center; - padding: 20px; -} - -.nav { - display: flex; - align-items: center; - vertical-align: center; - gap: 30px; - width: 40%; -} - -.logo { - display: flex; - align-items: center; - justify-content: center; - width: 20%; -} - -.user { - display: flex; - flex-direction: row; - justify-content: flex-end; - align-items: center; - vertical-align: center; - gap: 30px; - width: 40%; -} - -/* Mode sombre */ -body.dark-mode { - background-color: #120B1D; - color: #ffffff; -} - -body.dark-mode .header { - background-color: #000; -} - -body.dark-mode .header img { - filter: invert(0%); -} - -body.dark-mode .nav img:hover { - filter: invert(59%) sepia(96%) saturate(6733%) hue-rotate(275deg) brightness(112%) contrast(122%); -} - -/* Mode clair */ -body.light-mode { - background-color: #ffffff; - color: #000000; -} - -body.light-mode .header { - background-color: #F7F7EB; -} - -body.light-mode .header img { - filter: invert(100%); -} - -body.light-mode .nav img:hover { - filter: invert(22%) sepia(6%) saturate(2269%) hue-rotate(193deg) brightness(98%) contrast(106%); -} - -/* Media queries for responsiveness */ - -/* For tablets and small devices */ -@media (max-width: 768px) { - .header { - flex-direction: column; - text-align: center; - } - - .nav, .logo, .user { - width: 100%; - margin-bottom: 10px; - } -} - -/* For mobile phones */ -@media (max-width: 480px) { - body { - margin-top: 100px; - } - - .nav img, .logo img { - width: 50px; - height: auto; - } - - .container { - padding: 10px; - } - - form { - width: 100%; - } - - form input { - width: 100%; - padding: 10px; - margin-bottom: 10px; - } -} - -/* Banner images should be responsive */ -.header img { - max-width: 100%; - height: auto; -} - -/* Media queries for different screen sizes */ -@media (max-width: 768px) { - .header { - flex-direction: column; - } - .header img { - width: 80px; - height: auto; - } -} +/* header.css */ + +/* Styles généraux */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: #120b1d; + font-family: "Lemon", serif; + margin-top: 200px; +} + +/* Header */ +.header { + display: flex; + position: fixed; + background-color: #000000; + right: 0; + top: 0; + width: 100%; + text-align: center; + padding: 20px; +} + +.nav { + display: flex; + align-items: center; + vertical-align: center; + gap: 30px; + width: 40%; +} + +.logo { + display: flex; + align-items: center; + justify-content: center; + width: 20%; +} + +.user { + display: flex; + flex-direction: row; + justify-content: flex-end; + align-items: center; + vertical-align: center; + gap: 30px; + width: 40%; +} + +/* Mode sombre */ +body.dark-mode { + background-color: #120B1D; + color: #ffffff; +} + +body.dark-mode .header { + background-color: #000; +} + +body.dark-mode .header img { + filter: invert(0%); +} + +body.dark-mode .nav img:hover { + filter: invert(59%) sepia(96%) saturate(6733%) hue-rotate(275deg) brightness(112%) contrast(122%); +} + +/* Mode clair */ +body.light-mode { + background-color: #ffffff; + color: #000000; +} + +body.light-mode .header { + background-color: #F7F7EB; +} + +body.light-mode .header img { + filter: invert(100%); +} + +body.light-mode .nav img:hover { + filter: invert(22%) sepia(6%) saturate(2269%) hue-rotate(193deg) brightness(98%) contrast(106%); +} + +/* Media queries for responsiveness */ + +/* For tablets and small devices */ +@media (max-width: 768px) { + .header { + flex-direction: column; + text-align: center; + } + + .nav, .logo, .user { + width: 100%; + margin-bottom: 10px; + } +} + +/* For mobile phones */ +@media (max-width: 480px) { + body { + margin-top: 100px; + } + + .nav img, .logo img { + width: 50px; + height: auto; + } + + .container { + padding: 10px; + } + + form { + width: 100%; + } + + form input { + width: 100%; + padding: 10px; + margin-bottom: 10px; + } +} + +/* Banner images should be responsive */ +.header img { + max-width: 100%; + height: auto; +} + +/* Media queries for different screen sizes */ +@media (max-width: 768px) { + .header { + flex-direction: column; + } + .header img { + width: 80px; + height: auto; + } +} diff --git a/public/styles/styleAccueil.css b/public/styles/styleAccueil.css index 7afb3e1..9f5ead4 100644 --- a/public/styles/styleAccueil.css +++ b/public/styles/styleAccueil.css @@ -1,135 +1,135 @@ -@import url('style.css'); /* Import de style.css */ - -/* Conteneur général pour les citations */ -.citations-section { - display: flex; - flex-direction: column; - gap: 20px; - padding: 20px 0; - align-items: center; - width: 100%; - margin: 0 0; -} - -/* Conteneur pour les suggestions en deux colonnes */ -.suggestions-container { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - width: 90%; - margin: 0 auto; -} - -/* Citations */ -.citation-container { - background: linear-gradient(to right, #4a148c, #7b1fa2); - border-radius: 12px; - color: white; - display: flex; - align-items: flex-start; - width: 49%; /* Chaque citation occupe 45% de la largeur pour laisser 5% d'espace */ - box-sizing: border-box; - padding: 0; - height: 150px; - overflow: hidden; - margin-bottom: 20px; - word-wrap: break-word; /* Permet de couper les mots trop longs */ - word-break: break-word; -} - -/* Fixe la taille pour s'assurer que toutes les citations restent cohérentes */ -.citation-container .text-content { - flex-grow: 1; - display: flex; - flex-direction: column; - justify-content: center; - height: 150px; -} - -/* Citation du jour - toujours en pleine largeur */ -.citation-du-jour { - width: 90%; /* Prend toute la largeur */ - background: linear-gradient(to right, #ff5722, #ff9800); /* Dégradé spécial pour la citation du jour */ - padding: 0; - overflow: hidden; - margin-bottom: 20px; - height: 150px; -} - -.suggestion { - background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); - padding: 0; - overflow: hidden; -} - -.citation-image { - width: 150px; - height: 100%; - object-fit: cover; - margin: 0; - border-radius: 0; -} - -.text-content { - flex: 1; - padding: 10px; - display: flex; - flex-direction: column; - justify-content: center; /* Centre verticalement le texte */ - word-wrap: break-word; /* Permet de couper les mots trop longs */ - word-break: break-word; -} - -.quote { - font-size: 1.2em; - margin-bottom: 10px; - font-style: italic; -} - - - -.movie, .character, .year { - margin-bottom: 5px; -} - -/* Mode sombre */ -body.dark-mode .suggestion { - background: linear-gradient(to right, #4a148c, #7b1fa2); - color:white; -} - -/* Mode clair */ -body.light-mode .suggestion { - background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); - color:black; /* Changer le texte en noir pour le mode clair */ -} - -body.light-mode .quote, -body.light-mode .movie, -body.light-mode .character, -body.light-mode .year { - color: black; /* Forcer le texte en noir pour le mode clair */ -} - -/* Responsive design */ -@media (max-width: 768px) { - .suggestions-container { - flex-direction: column; - width: 100%; - } - - .citation-container { - width: 100%; /* Chaque citation prend toute la largeur sur mobile */ - max-width: 100%; - height: 100px; /* Supprimer la hauteur fixe sur mobile */ - } - - .citation-image { - width: 100px; - height: 100px; - } - - .quote { - font-size: 1em; - } -} +@import url('style.css'); /* Import de style.css */ + +/* Conteneur général pour les citations */ +.citations-section { + display: flex; + flex-direction: column; + gap: 20px; + padding: 20px 0; + align-items: center; + width: 100%; + margin: 0 0; +} + +/* Conteneur pour les suggestions en deux colonnes */ +.suggestions-container { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + width: 90%; + margin: 0 auto; +} + +/* Citations */ +.citation-container { + background: linear-gradient(to right, #4a148c, #7b1fa2); + border-radius: 12px; + color: white; + display: flex; + align-items: flex-start; + width: 49%; /* Chaque citation occupe 45% de la largeur pour laisser 5% d'espace */ + box-sizing: border-box; + padding: 0; + height: 150px; + overflow: hidden; + margin-bottom: 20px; + word-wrap: break-word; /* Permet de couper les mots trop longs */ + word-break: break-word; +} + +/* Fixe la taille pour s'assurer que toutes les citations restent cohérentes */ +.citation-container .text-content { + flex-grow: 1; + display: flex; + flex-direction: column; + justify-content: center; + height: 150px; +} + +/* Citation du jour - toujours en pleine largeur */ +.citation-du-jour { + width: 90%; /* Prend toute la largeur */ + background: linear-gradient(to right, #ff5722, #ff9800); /* Dégradé spécial pour la citation du jour */ + padding: 0; + overflow: hidden; + margin-bottom: 20px; + height: 150px; +} + +.suggestion { + background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); + padding: 0; + overflow: hidden; +} + +.citation-image { + width: 150px; + height: 100%; + object-fit: cover; + margin: 0; + border-radius: 0; +} + +.text-content { + flex: 1; + padding: 10px; + display: flex; + flex-direction: column; + justify-content: center; /* Centre verticalement le texte */ + word-wrap: break-word; /* Permet de couper les mots trop longs */ + word-break: break-word; +} + +.quote { + font-size: 1.2em; + margin-bottom: 10px; + font-style: italic; +} + + + +.movie, .character, .year { + margin-bottom: 5px; +} + +/* Mode sombre */ +body.dark-mode .suggestion { + background: linear-gradient(to right, #4a148c, #7b1fa2); + color:white; +} + +/* Mode clair */ +body.light-mode .suggestion { + background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); + color:black; /* Changer le texte en noir pour le mode clair */ +} + +body.light-mode .quote, +body.light-mode .movie, +body.light-mode .character, +body.light-mode .year { + color: black; /* Forcer le texte en noir pour le mode clair */ +} + +/* Responsive design */ +@media (max-width: 768px) { + .suggestions-container { + flex-direction: column; + width: 100%; + } + + .citation-container { + width: 100%; /* Chaque citation prend toute la largeur sur mobile */ + max-width: 100%; + height: 100px; /* Supprimer la hauteur fixe sur mobile */ + } + + .citation-image { + width: 100px; + height: 100px; + } + + .quote { + font-size: 1em; + } +} diff --git a/public/styles/styleLogin.css b/public/styles/styleLogin.css index 5f0d309..e02bd8f 100644 --- a/public/styles/styleLogin.css +++ b/public/styles/styleLogin.css @@ -1,130 +1,130 @@ -@import url(./style.css); - -/* ====== DARK MODE ====== */ -body.dark-mode h1{ - color : white; - font-family: "Lemon", serif; - text-align: center; - font-size: 32px; - margin-top: 10%; -} - -body.dark-mode p{ - margin-top: 6%; - margin-bottom: 2%; - color : white; - font-size: 20px; - font-family: "Lemon", serif; -} - -body.dark-mode .login{ - background-color: black; - width: 30%; - margin-left: 35%; - margin-top: 3%; - border-radius: 25px; - border: 2px solid transparent; - padding: 2%; -} - -body.dark-mode .createAccount{ - margin-top: 5%; - margin-bottom: 5%; - font-size: 13px; - text-align: center; - padding-top: 1%; - color: white; - border: 1px solid transparent; - font-family: "Lemon", serif; -} - -body.dark-mode .buttonSudmite{ - background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%); - font-family: "Lemon", serif; - border: none; - color: white; - padding: 2%; - border-radius: 25px; - width: 75%; - font-size: 20px; -} - - -body.dark-mode .connexion{ - width:90%; - height: 40px; - padding-left: 3%; - margin-left: 1%; - margin-top: -1%; - border-radius: 25px; - border: none; - font-size: 15px; -} - -/* ====== LIGHT MODE ====== */ -body.light-mode h1{ - color : black; - font-family: "Lemon", serif; - text-align: center; - font-size: 32px; - margin-top: 10%; -} - -body.light-mode p{ - margin-top: 6%; - margin-bottom: 2%; - color : black; - font-size: 20px; - font-family: "Lemon", serif; -} - -body.light-mode .login{ - background-color: white; - width: 30%; - margin-left: 35%; - margin-top: 3%; - border-radius: 25px; - border: 2px solid black; - padding: 2%; -} - -body.light-mode .createAccount{ - margin-top: 5%; - margin-bottom: 5%; - font-size: 13px; - text-align: center; - padding-top: 1%; - color: black; - font-family: "Lemon", serif; -} - -body.light-mode .buttonSudmite{ - background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); - font-family: "Lemon", serif; - border: none; - color: black; - padding: 2%; - border-radius: 25px; - width: 75%; - font-size: 20px; -} - -body.light-mode .connexion{ - width:90%; - height: 40px; - padding-left: 3%; - margin-left: 1%; - margin-top: -1%; - border-radius: 25px; - border: 1px solid black; - background-color: #fff1f1; - font-size: 15px; -} - - -/* ====== DEFAULT ====== */ -.buttonSudmiteDiv{ - text-align: center; -} - - +@import url(./style.css); + +/* ====== DARK MODE ====== */ +body.dark-mode h1{ + color : white; + font-family: "Lemon", serif; + text-align: center; + font-size: 32px; + margin-top: 10%; +} + +body.dark-mode p{ + margin-top: 6%; + margin-bottom: 2%; + color : white; + font-size: 20px; + font-family: "Lemon", serif; +} + +body.dark-mode .login{ + background-color: black; + width: 30%; + margin-left: 35%; + margin-top: 3%; + border-radius: 25px; + border: 2px solid transparent; + padding: 2%; +} + +body.dark-mode .createAccount{ + margin-top: 5%; + margin-bottom: 5%; + font-size: 13px; + text-align: center; + padding-top: 1%; + color: white; + border: 1px solid transparent; + font-family: "Lemon", serif; +} + +body.dark-mode .buttonSudmite{ + background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%); + font-family: "Lemon", serif; + border: none; + color: white; + padding: 2%; + border-radius: 25px; + width: 75%; + font-size: 20px; +} + + +body.dark-mode .connexion{ + width:90%; + height: 40px; + padding-left: 3%; + margin-left: 1%; + margin-top: -1%; + border-radius: 25px; + border: none; + font-size: 15px; +} + +/* ====== LIGHT MODE ====== */ +body.light-mode h1{ + color : black; + font-family: "Lemon", serif; + text-align: center; + font-size: 32px; + margin-top: 10%; +} + +body.light-mode p{ + margin-top: 6%; + margin-bottom: 2%; + color : black; + font-size: 20px; + font-family: "Lemon", serif; +} + +body.light-mode .login{ + background-color: white; + width: 30%; + margin-left: 35%; + margin-top: 3%; + border-radius: 25px; + border: 2px solid black; + padding: 2%; +} + +body.light-mode .createAccount{ + margin-top: 5%; + margin-bottom: 5%; + font-size: 13px; + text-align: center; + padding-top: 1%; + color: black; + font-family: "Lemon", serif; +} + +body.light-mode .buttonSudmite{ + background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); + font-family: "Lemon", serif; + border: none; + color: black; + padding: 2%; + border-radius: 25px; + width: 75%; + font-size: 20px; +} + +body.light-mode .connexion{ + width:90%; + height: 40px; + padding-left: 3%; + margin-left: 1%; + margin-top: -1%; + border-radius: 25px; + border: 1px solid black; + background-color: #fff1f1; + font-size: 15px; +} + + +/* ====== DEFAULT ====== */ +.buttonSudmiteDiv{ + text-align: center; +} + + diff --git a/public/styles/styleProfil.css b/public/styles/styleProfil.css index de2ea5d..a2c828a 100644 --- a/public/styles/styleProfil.css +++ b/public/styles/styleProfil.css @@ -1,226 +1,226 @@ -@import url(./style.css); - -/* ====== DARK MODE ====== */ -body.dark-mode h1{ - color : white; - font-family: "Lemon", serif; - text-align: center; - font-size: 35px; - margin-top: 10%; -} - -body.dark-mode p{ - margin-top: 6%; - margin-bottom: 2%; - color : white; - font-size: 20px; - font-family: "Lemon", serif; -} - - -body.dark-mode .buttonSudmite{ - background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%); - font-family: "Lemon", serif; - border: none; - color: white; - padding: 5%; - border-radius: 25px; - width: 75%; - font-size: 20px; -} - -body.dark-mode .createQuote{ - margin-top: 5%; - margin-bottom: 5%; - font-size: 15px; - text-align: center; - padding-top: 1%; - color: white; - font-family: "Lemon", serif; -} - -body.dark-mode .login{ - background-color: black; - width: 30%; - margin-left: 35%; - margin-top: 9%; - border-radius: 25px; - padding-top: 1px; - padding-bottom: 1%; - border: 2px solid transparent; -} - -body.dark-mode .imgModify{ - width: 3%; - margin-left: 5%; - margin-top: 5%; - filter: invert(100%) brightness(1000%) contrast(1000%); -} - - -body.dark-mode .infoProfil > input { - width:90%; - height: 40px; - padding-left: 3%; - margin-left: 1%; - margin-top: -1%; - border-radius: 25px; - border: none; - font-size: 15px; - font-family: "Lemon", serif; - -} - - -body.dark-mode .inputPasswd{ - font-family: "Lemon", serif; - margin-top: 40%; - color: black; -} - -body.dark-mode .saveButtonPasswd { - background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%); - font-family: "Lemon", serif; - border: none; - color: white; - padding: 1%; - border-radius: 25px; - width: 55%; - font-size: 15px; - margin-top: 5%; -} - - - -/* ====== LIGHT MODE ====== */ -body.light-mode h1{ - color : black; - font-family: "Lemon", serif; - text-align: center; - font-size: 35px; - margin-top: 10%; -} -body.light-mode p{ - margin-top: 6%; - margin-bottom: 2%; - color : black; - font-size: 20px; - font-family: "Lemon", serif; -} - - -body.light-mode .buttonSudmite{ - background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); - font-family: "Lemon", serif; - border: none; - color: black; - padding: 5%; - border-radius: 25px; - width: 75%; - font-size: 20px; -} - - - -body.light-mode .createQuote{ - margin-top: 5%; - margin-bottom: 5%; - font-size: 15px; - text-align: center; - padding-top: 1%; - color: black; - font-family: "Lemon", serif; -} - -body.light-mode .login{ - background-color: white; - width: 30%; - margin-left: 35%; - margin-top: 9%; - border-radius: 25px; - padding-top: 1px; - padding-bottom: 1%; - border: 2px solid black; -} - -body.light-mode .imgModify{ - width: 3%; - margin-left: 5%; - margin-top: 5%; -} - - -body.light-mode .infoProfil > input { - width:90%; - height: 40px; - padding-left: 3%; - margin-left: 1%; - margin-top: -1%; - border-radius: 25px; - border: 1px solid black; - background-color: #fff1f1; - font-size: 15px; - font-family: "Lemon", serif; - color : black; -} - - -body.light-mode .inputPasswd{ - font-family: "Lemon", serif; - margin-top: 40%; - color: black; -} - -body.light-mode .saveButtonPasswd { - background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); - font-family: "Lemon", serif; - border: none; - color: black; - padding: 1%; - border-radius: 25px; - width: 55%; - font-size: 15px; - margin-top: 5%; -} - - -/* ====== OTHER ====== */ -.buttonSudmiteDiv{ - text-align: center; -} - -.changeValue{ - color: red; -} - - -.imageProfil{ - width: 25%; - border-radius: 25px; - display:block; - margin-left: 38%; - margin-top: 5%; -} - -.infoProfil{ - margin-left: 10%; - text-align: center; - font-size: 120%; -} - - -.languageDiv{ - margin-left: 25%; -} -.languageTitle{ - text-align: left; - font-size: 100%; -} -.languageImage{ - width: 300px; - height: 40px; - margin-left: 25%; - display:block; -} - - +@import url(./style.css); + +/* ====== DARK MODE ====== */ +body.dark-mode h1{ + color : white; + font-family: "Lemon", serif; + text-align: center; + font-size: 35px; + margin-top: 10%; +} + +body.dark-mode p{ + margin-top: 6%; + margin-bottom: 2%; + color : white; + font-size: 20px; + font-family: "Lemon", serif; +} + + +body.dark-mode .buttonSudmite{ + background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%); + font-family: "Lemon", serif; + border: none; + color: white; + padding: 5%; + border-radius: 25px; + width: 75%; + font-size: 20px; +} + +body.dark-mode .createQuote{ + margin-top: 5%; + margin-bottom: 5%; + font-size: 15px; + text-align: center; + padding-top: 1%; + color: white; + font-family: "Lemon", serif; +} + +body.dark-mode .login{ + background-color: black; + width: 30%; + margin-left: 35%; + margin-top: 9%; + border-radius: 25px; + padding-top: 1px; + padding-bottom: 1%; + border: 2px solid transparent; +} + +body.dark-mode .imgModify{ + width: 3%; + margin-left: 5%; + margin-top: 5%; + filter: invert(100%) brightness(1000%) contrast(1000%); +} + + +body.dark-mode .infoProfil > input { + width:90%; + height: 40px; + padding-left: 3%; + margin-left: 1%; + margin-top: -1%; + border-radius: 25px; + border: none; + font-size: 15px; + font-family: "Lemon", serif; + +} + + +body.dark-mode .inputPasswd{ + font-family: "Lemon", serif; + margin-top: 40%; + color: black; +} + +body.dark-mode .saveButtonPasswd { + background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%); + font-family: "Lemon", serif; + border: none; + color: white; + padding: 1%; + border-radius: 25px; + width: 55%; + font-size: 15px; + margin-top: 5%; +} + + + +/* ====== LIGHT MODE ====== */ +body.light-mode h1{ + color : black; + font-family: "Lemon", serif; + text-align: center; + font-size: 35px; + margin-top: 10%; +} +body.light-mode p{ + margin-top: 6%; + margin-bottom: 2%; + color : black; + font-size: 20px; + font-family: "Lemon", serif; +} + + +body.light-mode .buttonSudmite{ + background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); + font-family: "Lemon", serif; + border: none; + color: black; + padding: 5%; + border-radius: 25px; + width: 75%; + font-size: 20px; +} + + + +body.light-mode .createQuote{ + margin-top: 5%; + margin-bottom: 5%; + font-size: 15px; + text-align: center; + padding-top: 1%; + color: black; + font-family: "Lemon", serif; +} + +body.light-mode .login{ + background-color: white; + width: 30%; + margin-left: 35%; + margin-top: 9%; + border-radius: 25px; + padding-top: 1px; + padding-bottom: 1%; + border: 2px solid black; +} + +body.light-mode .imgModify{ + width: 3%; + margin-left: 5%; + margin-top: 5%; +} + + +body.light-mode .infoProfil > input { + width:90%; + height: 40px; + padding-left: 3%; + margin-left: 1%; + margin-top: -1%; + border-radius: 25px; + border: 1px solid black; + background-color: #fff1f1; + font-size: 15px; + font-family: "Lemon", serif; + color : black; +} + + +body.light-mode .inputPasswd{ + font-family: "Lemon", serif; + margin-top: 40%; + color: black; +} + +body.light-mode .saveButtonPasswd { + background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); + font-family: "Lemon", serif; + border: none; + color: black; + padding: 1%; + border-radius: 25px; + width: 55%; + font-size: 15px; + margin-top: 5%; +} + + +/* ====== OTHER ====== */ +.buttonSudmiteDiv{ + text-align: center; +} + +.changeValue{ + color: red; +} + + +.imageProfil{ + width: 25%; + border-radius: 25px; + display:block; + margin-left: 38%; + margin-top: 5%; +} + +.infoProfil{ + margin-left: 10%; + text-align: center; + font-size: 120%; +} + + +.languageDiv{ + margin-left: 25%; +} +.languageTitle{ + text-align: left; + font-size: 100%; +} +.languageImage{ + width: 300px; + height: 40px; + margin-left: 25%; + display:block; +} + + diff --git a/public/styles/styleQuiz.css b/public/styles/styleQuiz.css index a457836..c794ec0 100644 --- a/public/styles/styleQuiz.css +++ b/public/styles/styleQuiz.css @@ -1,154 +1,154 @@ -@import url(./style.css); - -@import url('https://fonts.googleapis.com/css2?family=Lemon&display=swap'); - -body, html { - height: 100%; - overflow: hidden; -} - -/* ====== DARK MODE ====== */ -body.dark-mode h1, body.dark-mode h2, body.dark-mode p { - color: white; - font-family: "Lemon", serif; - text-align: center; -} - -body.dark-mode .quiz { - background-color: black; - height: 60%; - width: 80%; - margin: 3% auto; - padding: 2%; - border-radius: 25px; - border: 2px solid transparent; -} - -body.dark-mode .answers { - display: flex; - flex-wrap: wrap; - justify-content: space-evenly; - - row-gap: 80px; -} - -body.dark-mode .answer { - background-color: #1b0048; - color: white; - border: none; - border-radius: 25px; - width: 35%; - padding: 35px; - font-size: 30px; - text-align: center; - cursor: pointer; -} - -body.dark-mode .answer:hover { - background-color: #6100ff; -} - -body.dark-mode .submit-button { - text-align: center; - margin-top: 80px; - -} - -body.dark-mode .buttonSudmite { - background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%); - font-family: "Lemon", serif; - border: none; - color: white; - padding: 10px 20px; - border-radius: 25px; - font-size: 30px; - cursor: pointer; -} - -/* ====== LIGHT MODE ====== */ -body.light-mode h1, body.light-mode h2, body.light-mode p { - color: black; - font-family: "Lemon", serif; - text-align: center; -} - -body.light-mode .quiz { - background-color: white; - width: 50%; - height: 90%; - margin: 3% auto; - padding: 2%; - border-radius: 25px; - border: 2px solid black; -} - -body.light-mode .answers { - display: flex; - flex-wrap: wrap; - justify-content: space-around; - gap: 1000px; - height: 90%; -} - -body.light-mode .answer { - background-color: #fff1f1; - color: black; - border: 1px solid black; - border-radius: 25px; - width: 45%; - padding: 10px; - font-size: 18px; - text-align: center; - cursor: pointer; -} - -body.light-mode .answer:hover { - background-color: #c7f6c4; -} - -body.light-mode .submit-button { - text-align: center; - margin-top: 20px; -} - -body.light-mode .buttonSudmite { - background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); - font-family: "Lemon", serif; - border: none; - color: black; - padding: 10px 20px; - border-radius: 25px; - font-size: 20px; - cursor: pointer; -} - -/* ====== OTHER ====== */ -.container { - width: 100%; - height: 100px; - background-color: transparent; - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 50px; -} - -.header { - display: flex; - width: 100%; - justify-content: space-between; - align-items: center; -} - -.nav img { - margin-right: 10px; -} - -.logo img { - display: block; - margin: 0 auto; -} - -.user img { - margin-left: 10px; +@import url(./style.css); + +@import url('https://fonts.googleapis.com/css2?family=Lemon&display=swap'); + +body, html { + height: 100%; + overflow: hidden; +} + +/* ====== DARK MODE ====== */ +body.dark-mode h1, body.dark-mode h2, body.dark-mode p { + color: white; + font-family: "Lemon", serif; + text-align: center; +} + +body.dark-mode .quiz { + background-color: black; + height: 60%; + width: 80%; + margin: 3% auto; + padding: 2%; + border-radius: 25px; + border: 2px solid transparent; +} + +body.dark-mode .answers { + display: flex; + flex-wrap: wrap; + justify-content: space-evenly; + + row-gap: 80px; +} + +body.dark-mode .answer { + background-color: #1b0048; + color: white; + border: none; + border-radius: 25px; + width: 35%; + padding: 35px; + font-size: 30px; + text-align: center; + cursor: pointer; +} + +body.dark-mode .answer:hover { + background-color: #6100ff; +} + +body.dark-mode .submit-button { + text-align: center; + margin-top: 80px; + +} + +body.dark-mode .buttonSudmite { + background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%); + font-family: "Lemon", serif; + border: none; + color: white; + padding: 10px 20px; + border-radius: 25px; + font-size: 30px; + cursor: pointer; +} + +/* ====== LIGHT MODE ====== */ +body.light-mode h1, body.light-mode h2, body.light-mode p { + color: black; + font-family: "Lemon", serif; + text-align: center; +} + +body.light-mode .quiz { + background-color: white; + width: 50%; + height: 90%; + margin: 3% auto; + padding: 2%; + border-radius: 25px; + border: 2px solid black; +} + +body.light-mode .answers { + display: flex; + flex-wrap: wrap; + justify-content: space-around; + gap: 1000px; + height: 90%; +} + +body.light-mode .answer { + background-color: #fff1f1; + color: black; + border: 1px solid black; + border-radius: 25px; + width: 45%; + padding: 10px; + font-size: 18px; + text-align: center; + cursor: pointer; +} + +body.light-mode .answer:hover { + background-color: #c7f6c4; +} + +body.light-mode .submit-button { + text-align: center; + margin-top: 20px; +} + +body.light-mode .buttonSudmite { + background: linear-gradient(180deg, rgba(187,211,249,1) 0%, rgba(199,246,196,1) 100%); + font-family: "Lemon", serif; + border: none; + color: black; + padding: 10px 20px; + border-radius: 25px; + font-size: 20px; + cursor: pointer; +} + +/* ====== OTHER ====== */ +.container { + width: 100%; + height: 100px; + background-color: transparent; + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 50px; +} + +.header { + display: flex; + width: 100%; + justify-content: space-between; + align-items: center; +} + +.nav img { + margin-right: 10px; +} + +.logo img { + display: block; + margin: 0 auto; +} + +.user img { + margin-left: 10px; } \ No newline at end of file diff --git a/public/styles/styleQuote.css b/public/styles/styleQuote.css index 2a0ee64..3b9c192 100644 --- a/public/styles/styleQuote.css +++ b/public/styles/styleQuote.css @@ -1,110 +1,110 @@ -@import url(./style.css); - -/* ====== DARK MODE ====== */ -body.dark-mode .card { - position: relative; - background-color: black; - border-radius: 15px; - width: 60%; - display: flex; - margin-left: 5%; - border: 2px solid transparent; -} - - -body.dark-mode .card-content { - color: white; - margin-left: 20px; - flex: 1; -} - - -body.dark-mode .likes { - margin-left: 85%; - font-size: 20px; - color: #fff; -} - -body.dark-mode .like-icon { - position: absolute; - top: 10px; - right: 10px; - font-size: 35px; - color: #fff; - cursor: pointer; -} - -body.dark-mode .share-icon { - position: absolute; - top: 70px; - right: 10px; - font-size: 35px; - color: #fff; - cursor: pointer; -} - -/* ====== LIGHT MODE ====== */ - -body.light-mode .card { - position: relative; - background-color: white; - border-radius: 15px; - width: 60%; - display: flex; - margin-left: 5%; - border: 2px solid black; -} - -body.light-mode .card-content { - color: black; - margin-left: 20px; - flex: 1; -} - - -body.light-mode .likes { - margin-left: 85%; - font-size: 20px; - color: black; -} - -body.light-mode .like-icon { - position: absolute; - top: 10px; - right: 10px; - font-size: 35px; - color: black; - cursor: pointer; -} - -body.light-mode .share-icon { - position: absolute; - top: 70px; - right: 10px; - font-size: 35px; - color: black; - cursor: pointer; -} - -/* ====== DEFAULT ====== */ -.infoQuote { - list-style: none; - font-size: 25px; - line-height: 40px; - margin-top: 35%; - margin-left: -45%; - margin-bottom: 20px; -} -.card-image { - border-radius: 10px; - width: 310px; - height: 270px; -} - -.quote { - margin-top: 10px; - font-size: 35px; - font-weight: bold; - font-style: italic; - margin-bottom: 15px; +@import url(./style.css); + +/* ====== DARK MODE ====== */ +body.dark-mode .card { + position: relative; + background-color: black; + border-radius: 15px; + width: 60%; + display: flex; + margin-left: 5%; + border: 2px solid transparent; +} + + +body.dark-mode .card-content { + color: white; + margin-left: 20px; + flex: 1; +} + + +body.dark-mode .likes { + margin-left: 85%; + font-size: 20px; + color: #fff; +} + +body.dark-mode .like-icon { + position: absolute; + top: 10px; + right: 10px; + font-size: 35px; + color: #fff; + cursor: pointer; +} + +body.dark-mode .share-icon { + position: absolute; + top: 70px; + right: 10px; + font-size: 35px; + color: #fff; + cursor: pointer; +} + +/* ====== LIGHT MODE ====== */ + +body.light-mode .card { + position: relative; + background-color: white; + border-radius: 15px; + width: 60%; + display: flex; + margin-left: 5%; + border: 2px solid black; +} + +body.light-mode .card-content { + color: black; + margin-left: 20px; + flex: 1; +} + + +body.light-mode .likes { + margin-left: 85%; + font-size: 20px; + color: black; +} + +body.light-mode .like-icon { + position: absolute; + top: 10px; + right: 10px; + font-size: 35px; + color: black; + cursor: pointer; +} + +body.light-mode .share-icon { + position: absolute; + top: 70px; + right: 10px; + font-size: 35px; + color: black; + cursor: pointer; +} + +/* ====== DEFAULT ====== */ +.infoQuote { + list-style: none; + font-size: 25px; + line-height: 40px; + margin-top: 35%; + margin-left: -45%; + margin-bottom: 20px; +} +.card-image { + border-radius: 10px; + width: 310px; + height: 270px; +} + +.quote { + margin-top: 10px; + font-size: 35px; + font-weight: bold; + font-style: italic; + margin-bottom: 15px; } \ No newline at end of file diff --git a/public/styles/styleSearch.css b/public/styles/styleSearch.css new file mode 100644 index 0000000..2ae7ecf --- /dev/null +++ b/public/styles/styleSearch.css @@ -0,0 +1,11 @@ +@import url(./style.css); + +/* ====== DARK MODE ====== */ +/*body.dark-mode */ + + +/* ====== LIGHT MODE ====== */ +/*body.light-mode*/ + + +/* ====== DEFAULT ====== */ diff --git a/public/styles/styleSignin.css b/public/styles/styleSignin.css index e0a7780..0411e1e 100644 --- a/public/styles/styleSignin.css +++ b/public/styles/styleSignin.css @@ -1,120 +1,120 @@ -@import url(./style.css); - -h1{ - margin-top: 10%; - text-align: center; -} - -.signin{ - border-radius: 25px; - display: grid; - grid-template-columns: 2fr 1fr; - grid-template-rows: repeat(5, 1fr); - width : 30%; - margin-left: 35%; - margin-top: 3%; - padding : 2%; -} - -p{ - font-size: 20px; - margin-top: 7%; - margin-bottom: 2%; - font-weight: bold; -} - -.DivId{ - grid-area: 1 / 1 / 2 / 2; -} - -.DivEmail{ - grid-area: 2 / 1 / 3 / 2; -} - -.mdp{ - grid-area: 3 / 1 / 4 / 3; -} - -.confmdp{ - grid-area: 4 / 1 / 5 / 3; -} - -.imgprof{ - grid-area: 1 / 2 / 3 / 3; -} - -.confirmer{ - grid-area: 5 / 1 / 6 / 3; - align-self: center; - text-align: center; -} - -.champ{ - width: 90%; - height : 35%; - border-radius: 25px; - margin-left: 1%; - padding-left: 3%; - margin-top: -1%; - font-size: 15px; -} - -.btn{ - margin-top: 10%; - width:75%; - font-size: 20px; - padding: 2%; - border-radius: 25px; - border: none; - font-family: "Lemon", serif; -} - -/*Dark mode*/ - -body.dark-mode .signin{ - background-color: #000000; - border: 2px solid transparent; -} - -body.dark-mode .h1{ - color : white; -} - -body.dark-mode .p{ - color : white; -} - -body.dark-mode .btn{ - background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%); - color : white; -} - -body.dark-mode .champ{ - background-color: #ffffff; - border: 2px solid #ffffff; -} - -/*Light*/ - -body.light-mode .signin{ - background-color: #ffffff; - border: 2px solid #000000; -} - -body.light-mode .h1{ - color : #000000; -} - -body.light-mode .p{ - color : #000000; -} - -body.light-mode .btn{ - background: linear-gradient(90deg, #caffde 0%, #b7c8ff 100%); - color : #000000; -} - -body.light-mode .champ{ - background-color: #fff1f1; - border: 1px solid #000000; +@import url(./style.css); + +h1{ + margin-top: 10%; + text-align: center; +} + +.signin{ + border-radius: 25px; + display: grid; + grid-template-columns: 2fr 1fr; + grid-template-rows: repeat(5, 1fr); + width : 30%; + margin-left: 35%; + margin-top: 3%; + padding : 2%; +} + +p{ + font-size: 20px; + margin-top: 7%; + margin-bottom: 2%; + font-weight: bold; +} + +.DivId{ + grid-area: 1 / 1 / 2 / 2; +} + +.DivEmail{ + grid-area: 2 / 1 / 3 / 2; +} + +.mdp{ + grid-area: 3 / 1 / 4 / 3; +} + +.confmdp{ + grid-area: 4 / 1 / 5 / 3; +} + +.imgprof{ + grid-area: 1 / 2 / 3 / 3; +} + +.confirmer{ + grid-area: 5 / 1 / 6 / 3; + align-self: center; + text-align: center; +} + +.champ{ + width: 90%; + height : 35%; + border-radius: 25px; + margin-left: 1%; + padding-left: 3%; + margin-top: -1%; + font-size: 15px; +} + +.btn{ + margin-top: 10%; + width:75%; + font-size: 20px; + padding: 2%; + border-radius: 25px; + border: none; + font-family: "Lemon", serif; +} + +/*Dark mode*/ + +body.dark-mode .signin{ + background-color: #000000; + border: 2px solid transparent; +} + +body.dark-mode .h1{ + color : white; +} + +body.dark-mode .p{ + color : white; +} + +body.dark-mode .btn{ + background: linear-gradient(90deg, #6100ff 0%, #1b0048 100%); + color : white; +} + +body.dark-mode .champ{ + background-color: #ffffff; + border: 2px solid #ffffff; +} + +/*Light*/ + +body.light-mode .signin{ + background-color: #ffffff; + border: 2px solid #000000; +} + +body.light-mode .h1{ + color : #000000; +} + +body.light-mode .p{ + color : #000000; +} + +body.light-mode .btn{ + background: linear-gradient(90deg, #caffde 0%, #b7c8ff 100%); + color : #000000; +} + +body.light-mode .champ{ + background-color: #fff1f1; + border: 1px solid #000000; } \ No newline at end of file diff --git a/src/Controleur/FrontControler.php b/src/Controleur/FrontControler.php index a34f293..f7c48aa 100644 --- a/src/Controleur/FrontControler.php +++ b/src/Controleur/FrontControler.php @@ -1,107 +1,108 @@ -listAction = ['visitor' => array('accueil','search','quote','login','signin'), - 'user' => array('quiz','commentary','favorite','logout'), - 'admin' => array('null')]; - - $dVueEreur = []; - - $router = new \AltoRouter(); - - $router->setBasePath('/~kekentin/WF/WF-Website'); - - $router->map('GET', '/', 'VisitorControler','accueil'); - - /* - 'i' => '[0-9]++' - 'a' => '[0-9A-Za-z]++' - 'h' => '[0-9A-Fa-f]++' - '*' => '.+?' - '**' => '.++' - '' => '[^/\.]++' - */ - - $router->map('GET|POST', '/quote/[i:idQuote]?', 'VisitorControler','quote'); - $router->map('GET|POST', '/login', 'VisitorControler','login'); - $router->map('GET|POST', '/signin', 'VisitorControler','signin'); - - $router->map('GET|POST', '/quiz/[i:id]?', 'QuizControler','quiz'); - - - $match = $router->match(); - $action = NULL; - - if(!$match){ - $dVueEreur[] = "Requête introuvable"; - $this->vueErreur($dVueEreur); - } - else{ - $controller=$match['target'] ?? null; - - $action = $match['name']; - - //Si existe, on l’appelle - if(!$this->ifExisteAction($action)){ - $dVueEreur[] = "Action introuvable"; - $this->vueErreur($dVueEreur); - } - - else if(!$this->verifDroit($action)){ - $action='login'; - $controller='VisitorControler'; - } - - else { - $controller = '\\Controleur\\' . $controller; - $controller = new $controller($co); - if (is_callable(array($controller, $action))) { - call_user_func_array(array($controller, $action), - array($match['params'])); - } - } - - } - - - } - - private function ifExisteAction(string $action):bool { - if( in_array($action , $this->listAction['admin']) || - in_array($action , $this->listAction['user']) || - in_array($action , $this->listAction['visitor']) ) { - return true; - } - - return false; - } - - private function verifDroit(string $action):bool { - if( in_array($action , $this->listAction['admin']) && $this->role == 'admin') return true; - elseif( in_array($action , $this->listAction['user']) && ($this->role == 'admin' || $this->role == 'user') ) return true; - elseif(in_array($action , $this->listAction['visitor']) && ($this->role == 'admin'|| $this->role == 'user'|| $this->role == 'visitor')) return true; - return false; - } - - private function vueErreur(array $dVueErreur){ - global $vues; - echo "{$dVueErreur[0]}"; - require_once $vues['erreur']; - } - -} +listAction = ['visitor' => array('accueil','search','quote','login','signin'), + 'user' => array('quiz','commentary','favorite','logout'), + 'admin' => array('null')]; + + $dVueEreur = []; + + $router = new \AltoRouter(); + + $router->setBasePath('/~kekentin/WF/WF-Website'); + + $router->map('GET', '/', 'VisitorControler','accueil'); + + /* + 'i' => '[0-9]++' + 'a' => '[0-9A-Za-z]++' + 'h' => '[0-9A-Fa-f]++' + '*' => '.+?' + '**' => '.++' + '' => '[^/\.]++' + */ + + $router->map('GET|POST', '/quote/[i:idQuote]?', 'VisitorControler','quote'); + $router->map('GET|POST', '/login', 'VisitorControler','login'); + $router->map('GET|POST', '/signin', 'VisitorControler','signin'); + + $router->map('GET|POST', '/quiz/[i:id]?', 'QuizControler','quiz'); + $router->map('GET|POST', '/search/[a:type]?', 'VisitorControler','search'); + + + $match = $router->match(); + $action = NULL; + + if(!$match){ + $dVueEreur[] = "Requête introuvable"; + $this->vueErreur($dVueEreur); + } + else{ + $controller=$match['target'] ?? null; + + $action = $match['name']; + + //Si existe, on l’appelle + if(!$this->ifExisteAction($action)){ + $dVueEreur[] = "Action introuvable"; + $this->vueErreur($dVueEreur); + } + + else if(!$this->verifDroit($action)){ + $action='login'; + $controller='VisitorControler'; + } + + else { + $controller = '\\Controleur\\' . $controller; + $controller = new $controller($co); + if (is_callable(array($controller, $action))) { + call_user_func_array(array($controller, $action), + array($match['params'])); + } + } + + } + + + } + + private function ifExisteAction(string $action):bool { + if( in_array($action , $this->listAction['admin']) || + in_array($action , $this->listAction['user']) || + in_array($action , $this->listAction['visitor']) ) { + return true; + } + + return false; + } + + private function verifDroit(string $action):bool { + if( in_array($action , $this->listAction['admin']) && $this->role == 'admin') return true; + elseif( in_array($action , $this->listAction['user']) && ($this->role == 'admin' || $this->role == 'user') ) return true; + elseif(in_array($action , $this->listAction['visitor']) && ($this->role == 'admin'|| $this->role == 'user'|| $this->role == 'visitor')) return true; + return false; + } + + private function vueErreur(array $dVueErreur){ + global $vues; + echo "{$dVueErreur[0]}"; + require_once $vues['erreur']; + } + +} diff --git a/src/Controleur/QuizControler.php b/src/Controleur/QuizControler.php index 0e72f6d..35809bf 100644 --- a/src/Controleur/QuizControler.php +++ b/src/Controleur/QuizControler.php @@ -1,144 +1,144 @@ - co = $co; - $this -> gw = new QuestionGateway($this->co); - $this -> mdl = new QuestionModel($this->gw); - - $loader = new FilesystemLoader('vue/templates'); - - $action = $_REQUEST['action'] ?? null; - - $id = (int) explode('/', $_SERVER['REQUEST_URI'])[2] ?? null; - - switch ($action) { - case 'canswer': - - if ($this->CorrectAnswer()) - echo "Bonne réponse"; - else echo "Mauvaise réponse"; - $this->no_question ++; - echo $this->no_question; - $this->showQuestion($id, $this->no_question); - break; - default: - switch($id) - { - case null: - // page erreur - break; - default: - $this->showQuestion($id, $this->no_question); - break; - } - } - - } - - public function CorrectAnswer() : bool - { - $answera = $_POST['answera'] ?? null; - $answerb = $_POST['answerb'] ?? null; - $answerc = $_POST['answerc'] ?? null; - $answerd = $_POST['answerd'] ?? null; - - $id= null; - $answer = null; - - if ($answera) { - $answer = explode('-', $answera)[0]; - $id = (int) explode('-', $answera)[1]; - } elseif ($answerb) { - $answer = explode('-', $answerb)[0]; - $id = (int) explode('-', $answerb)[1]; - } elseif ($answerc) { - $answer = explode('-', $answerc)[0]; - $id = (int) explode('-', $answerc)[1]; - } elseif ($answerd) { - $answer = explode('-', $answerd)[0]; - $id = (int) explode('-', $answerd)[1]; - } - - $res = $this->mdl->getQuestion($id); - return $answer == $res->getCanswer(); - } - - public function GetQuestion(int $id): array - { - $gw = new QuizQuestionGateway($this->co); - $mdl = new QuizQuestionModel($gw); - return $mdl->getAllQuestionByQuiz($id, $this->co); - } - - /** - * @throws RuntimeError - * @throws SyntaxError - * @throws LoaderError - */ - public function showQuestion(int $id, int $no) : void - { - global $twig; - $q = $this->GetQuestion($id); - $question = $q[$no]; - - $idquestion = $question->getIdQuestion(); - echo $twig->render('quiz.html.twig', ['question' => $question,'id'=>$idquestion]); - - } - - public function getNumberOfQuestion() : int - { - $gw = new QuizGateway($this->co); - $mdl = new QuizModel($gw); - return 0; - - } - -} - -/* - -getUrl() ?>> getTitle() ?> - } - -?> - - + co = $co; + $this -> gw = new QuestionGateway($this->co); + $this -> mdl = new QuestionModel($this->gw); + + $loader = new FilesystemLoader('vue/templates'); + + $action = $_REQUEST['action'] ?? null; + + $id = (int) explode('/', $_SERVER['REQUEST_URI'])[2] ?? null; + + switch ($action) { + case 'canswer': + + if ($this->CorrectAnswer()) + echo "Bonne réponse"; + else echo "Mauvaise réponse"; + $this->no_question ++; + echo $this->no_question; + $this->showQuestion($id, $this->no_question); + break; + default: + switch($id) + { + case null: + // page erreur + break; + default: + $this->showQuestion($id, $this->no_question); + break; + } + } + + } + + public function CorrectAnswer() : bool + { + $answera = $_POST['answera'] ?? null; + $answerb = $_POST['answerb'] ?? null; + $answerc = $_POST['answerc'] ?? null; + $answerd = $_POST['answerd'] ?? null; + + $id= null; + $answer = null; + + if ($answera) { + $answer = explode('-', $answera)[0]; + $id = (int) explode('-', $answera)[1]; + } elseif ($answerb) { + $answer = explode('-', $answerb)[0]; + $id = (int) explode('-', $answerb)[1]; + } elseif ($answerc) { + $answer = explode('-', $answerc)[0]; + $id = (int) explode('-', $answerc)[1]; + } elseif ($answerd) { + $answer = explode('-', $answerd)[0]; + $id = (int) explode('-', $answerd)[1]; + } + + $res = $this->mdl->getQuestion($id); + return $answer == $res->getCanswer(); + } + + public function GetQuestion(int $id): array + { + $gw = new QuizQuestionGateway($this->co); + $mdl = new QuizQuestionModel($gw); + return $mdl->getAllQuestionByQuiz($id, $this->co); + } + + /** + * @throws RuntimeError + * @throws SyntaxError + * @throws LoaderError + */ + public function showQuestion(int $id, int $no) : void + { + global $twig; + $q = $this->GetQuestion($id); + $question = $q[$no]; + + $idquestion = $question->getIdQuestion(); + echo $twig->render('quiz.html.twig', ['question' => $question,'id'=>$idquestion]); + + } + + public function getNumberOfQuestion() : int + { + $gw = new QuizGateway($this->co); + $mdl = new QuizModel($gw); + return 0; + + } + +} + +/* + +getUrl() ?>> getTitle() ?> + } + +?> + + */ \ No newline at end of file diff --git a/src/Controleur/UserControler.php b/src/Controleur/UserControler.php index 2cc513a..6820985 100644 --- a/src/Controleur/UserControler.php +++ b/src/Controleur/UserControler.php @@ -1,10 +1,10 @@ -id_user = $id_user; - $this->id_quote = $id_quote; - } - - /** - * @return int - */ - public function getIdUser(): int - { - return $this->id_user; - } - - /** - * @param int $id_user - */ - public function setIdUser(int $id_user): void - { - $this->id_user = $id_user; - } - - /** - * @return int - */ - public function getIdQuote(): int - { - return $this->id_quote; - } - - /** - * @param int $id_quote - */ - public function setIdQuote(int $id_quote): void - { - $this->id_quote = $id_quote; - } - - - -} +id_user = $id_user; + $this->id_quote = $id_quote; + } + + /** + * @return int + */ + public function getIdUser(): int + { + return $this->id_user; + } + + /** + * @param int $id_user + */ + public function setIdUser(int $id_user): void + { + $this->id_user = $id_user; + } + + /** + * @return int + */ + public function getIdQuote(): int + { + return $this->id_quote; + } + + /** + * @param int $id_quote + */ + public function setIdQuote(int $id_quote): void + { + $this->id_quote = $id_quote; + } + + + +} diff --git a/src/Entity/ImageEntity.php b/src/Entity/ImageEntity.php index e1a0979..8bdf70a 100644 --- a/src/Entity/ImageEntity.php +++ b/src/Entity/ImageEntity.php @@ -1,53 +1,53 @@ -idImg = $idImg; - $this->imgPath = $imgPath; - $this->isImgProfile = $isImgProfile; - } - - public function getIdImg(): int - { - return $this->idImg; - } - - public function setIdImg(int $idImg): void - { - $this->idImg = $idImg; - } - - public function getImgPath(): string - { - return $this->imgPath; - } - - public function setImgPath(string $imgPath): void - { - $this->imgPath = $imgPath; - } - - public function getIsImgProfile(): string - { - return $this->isImgProfile; - } - - public function setIsImgProfile(string $isImgProfile): void - { - $this->isImgProfile = $isImgProfile; - } - - -} +idImg = $idImg; + $this->imgPath = $imgPath; + $this->isImgProfile = $isImgProfile; + } + + public function getIdImg(): int + { + return $this->idImg; + } + + public function setIdImg(int $idImg): void + { + $this->idImg = $idImg; + } + + public function getImgPath(): string + { + return $this->imgPath; + } + + public function setImgPath(string $imgPath): void + { + $this->imgPath = $imgPath; + } + + public function getIsImgProfile(): string + { + return $this->isImgProfile; + } + + public function setIsImgProfile(string $isImgProfile): void + { + $this->isImgProfile = $isImgProfile; + } + + +} diff --git a/src/Entity/QuizQuestionEntity.php b/src/Entity/QuizQuestionEntity.php index 96dcf56..ba7f898 100644 --- a/src/Entity/QuizQuestionEntity.php +++ b/src/Entity/QuizQuestionEntity.php @@ -1,54 +1,54 @@ -id_question = $id_question; - $this->id_quiz = $id_quiz; - } - - /** - * @return int - */ - public function getIdQuestion(): int - { - return $this->id_question; - } - - /** - * @param int $id_question - */ - public function setIdQuestion(int $id_question): void - { - $this->id_question = $id_question; - } - - /** - * @return int - */ - public function getIdQuiz(): int - { - return $this->id_quiz; - } - - /** - * @param int $id_quiz - */ - public function setIdQuiz(int $id_quiz): void - { - $this->id_quiz = $id_quiz; - } - - - -} +id_question = $id_question; + $this->id_quiz = $id_quiz; + } + + /** + * @return int + */ + public function getIdQuestion(): int + { + return $this->id_question; + } + + /** + * @param int $id_question + */ + public function setIdQuestion(int $id_question): void + { + $this->id_question = $id_question; + } + + /** + * @return int + */ + public function getIdQuiz(): int + { + return $this->id_quiz; + } + + /** + * @param int $id_quiz + */ + public function setIdQuiz(int $id_quiz): void + { + $this->id_quiz = $id_quiz; + } + + + +} diff --git a/src/Entity/ResultsEntity.php b/src/Entity/ResultsEntity.php index bbdcd00..e2b7938 100644 --- a/src/Entity/ResultsEntity.php +++ b/src/Entity/ResultsEntity.php @@ -1,69 +1,69 @@ -idUser; - } - - public function setIdUser(int $idUser): void - { - $this->idUser = $idUser; - } - - public function getIdQuiz(): int - { - return $this->idQuiz; - } - - public function setIdQuiz(int $idQuiz): void - { - $this->idQuiz = $idQuiz; - } - - public function getTime(): int - { - return $this->time; - } - - public function setTime(int $time): void - { - $this->time = $time; - } - - public function getNbPts(): int - { - return $this->nbPts; - } - - public function setNbPts(int $nbPts): void - { - $this->nbPts = $nbPts; - } - - private int $idUser; - - private int $nbPts; - - private int $time; - - /** - * @param int $idQuiz - * @param int $idUser - * @param int $time - * @param int $nbPts - */ - public function __construct(int $idQuiz, int $idUser, int $time, int $nbPts) - { - $this -> idQuiz = $idQuiz; - $this -> idUser = $idUser; - $this -> time = $time; - $this -> nbPts = $nbPts; - } - - -} +idUser; + } + + public function setIdUser(int $idUser): void + { + $this->idUser = $idUser; + } + + public function getIdQuiz(): int + { + return $this->idQuiz; + } + + public function setIdQuiz(int $idQuiz): void + { + $this->idQuiz = $idQuiz; + } + + public function getTime(): int + { + return $this->time; + } + + public function setTime(int $time): void + { + $this->time = $time; + } + + public function getNbPts(): int + { + return $this->nbPts; + } + + public function setNbPts(int $nbPts): void + { + $this->nbPts = $nbPts; + } + + private int $idUser; + + private int $nbPts; + + private int $time; + + /** + * @param int $idQuiz + * @param int $idUser + * @param int $time + * @param int $nbPts + */ + public function __construct(int $idQuiz, int $idUser, int $time, int $nbPts) + { + $this -> idQuiz = $idQuiz; + $this -> idUser = $idUser; + $this -> time = $time; + $this -> nbPts = $nbPts; + } + + +} diff --git a/src/Entity/characterEntity.php b/src/Entity/characterEntity.php index ce41088..e64ee67 100644 --- a/src/Entity/characterEntity.php +++ b/src/Entity/characterEntity.php @@ -1,77 +1,77 @@ -id_character = $id_character; - $this->name = $name; - $this->img_path = $img_path; - } - - /** - * @return int - */ - public function getIdCharacter(): int - { - return $this->id_character; - } - - /** - * @param int $id_character - */ - public function setIdCharacter(int $id_character): void - { - $this->id_character = $id_character; - } - - /** - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string - */ - public function getImgPath(): string - { - return $this->img_path; - } - - /** - * @param string $img_path - */ - public function setImgPath(string $img_path): void - { - $this->img_path = $img_path; - } - - - - -} - +id_character = $id_character; + $this->name = $name; + $this->img_path = $img_path; + } + + /** + * @return int + */ + public function getIdCharacter(): int + { + return $this->id_character; + } + + /** + * @param int $id_character + */ + public function setIdCharacter(int $id_character): void + { + $this->id_character = $id_character; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param string $name + */ + public function setName(string $name): void + { + $this->name = $name; + } + + /** + * @return string + */ + public function getImgPath(): string + { + return $this->img_path; + } + + /** + * @param string $img_path + */ + public function setImgPath(string $img_path): void + { + $this->img_path = $img_path; + } + + + + +} + diff --git a/src/Entity/commentaryEntity.php b/src/Entity/commentaryEntity.php index bbf1fda..d66f543 100644 --- a/src/Entity/commentaryEntity.php +++ b/src/Entity/commentaryEntity.php @@ -1,72 +1,72 @@ -id_comment = $id_comment; - $this->comment = $comment; - $this->date = $date; - } - - /** - * @return int - */ - public function getIdComment(): int - { - return $this->id_comment; - } - - /** - * @param int $id_comment - */ - public function setIdComment(int $id_comment): void - { - $this->id_comment = $id_comment; - } - - /** - * @return string - */ - public function getComment(): string - { - return $this->comment; - } - - /** - * @param string $comment - */ - public function setComment(string $comment): void - { - $this->comment = $comment; - } - - /** - * @return string - */ - public function getDate(): string - { - return $this->date; - } - - /** - * @param string $date - */ - public function setDate(string $date): void - { - $this->date = $date; - } - - - -} +id_comment = $id_comment; + $this->comment = $comment; + $this->date = $date; + } + + /** + * @return int + */ + public function getIdComment(): int + { + return $this->id_comment; + } + + /** + * @param int $id_comment + */ + public function setIdComment(int $id_comment): void + { + $this->id_comment = $id_comment; + } + + /** + * @return string + */ + public function getComment(): string + { + return $this->comment; + } + + /** + * @param string $comment + */ + public function setComment(string $comment): void + { + $this->comment = $comment; + } + + /** + * @return string + */ + public function getDate(): string + { + return $this->date; + } + + /** + * @param string $date + */ + public function setDate(string $date): void + { + $this->date = $date; + } + + + +} diff --git a/src/Entity/questionEntity.php b/src/Entity/questionEntity.php index 757bc2e..c3cb082 100644 --- a/src/Entity/questionEntity.php +++ b/src/Entity/questionEntity.php @@ -1,148 +1,148 @@ -id_question = $id_question; - $this->question = $question; - $this->answerA = $answerA; - $this->answerB = $answerB; - $this->answerC = $answerC; - $this->answerD = $answerD; - $this->cAnswer = $cAnswer; - } - - /** - * @return int - */ - public function getIdQuestion(): int - { - return $this->id_question; - } - - /** - * @param int $id_question - */ - public function setIdQuestion(int $id_question): void - { - $this->id_question = $id_question; - } - - /** - * @return string - */ - public function getQuestion(): string - { - return $this->question; - } - - /** - * @param string $question - */ - public function setQuestion(string $question): void - { - $this->question = $question; - } - - /** - * @return string - */ - public function getAnswerA(): string - { - return $this->answerA; - } - - /** - * @param string $answerA - */ - public function setAnswerA(string $answerA): void - { - $this->answerA = $answerA; - } - - /** - * @return string - */ - public function getAnswerB(): string - { - return $this->answerB; - } - - /** - * @param string $answerB - */ - public function setAnswerB(string $answerB): void - { - $this->answerB = $answerB; - } - - /** - * @return string - */ - public function getAnswerC(): string - { - return $this->answerC; - } - - /** - * @param string $answerC - */ - public function setAnswerC(string $answerC): void - { - $this->answerC = $answerC; - } - - /** - * @return string - */ - public function getAnswerD(): string - { - return $this->answerD; - } - - /** - * @param string $answerD - */ - public function setAnswerD(string $answerD): void - { - $this->answerD = $answerD; - } - - /** - * @return string - */ - public function getCAnswer(): string - { - return $this->cAnswer; - } - - /** - * @param string $cAnswer - */ - public function setCAnswer(string $cAnswer): void - { - $this->cAnswer = $cAnswer; - } - - - - } +id_question = $id_question; + $this->question = $question; + $this->answerA = $answerA; + $this->answerB = $answerB; + $this->answerC = $answerC; + $this->answerD = $answerD; + $this->cAnswer = $cAnswer; + } + + /** + * @return int + */ + public function getIdQuestion(): int + { + return $this->id_question; + } + + /** + * @param int $id_question + */ + public function setIdQuestion(int $id_question): void + { + $this->id_question = $id_question; + } + + /** + * @return string + */ + public function getQuestion(): string + { + return $this->question; + } + + /** + * @param string $question + */ + public function setQuestion(string $question): void + { + $this->question = $question; + } + + /** + * @return string + */ + public function getAnswerA(): string + { + return $this->answerA; + } + + /** + * @param string $answerA + */ + public function setAnswerA(string $answerA): void + { + $this->answerA = $answerA; + } + + /** + * @return string + */ + public function getAnswerB(): string + { + return $this->answerB; + } + + /** + * @param string $answerB + */ + public function setAnswerB(string $answerB): void + { + $this->answerB = $answerB; + } + + /** + * @return string + */ + public function getAnswerC(): string + { + return $this->answerC; + } + + /** + * @param string $answerC + */ + public function setAnswerC(string $answerC): void + { + $this->answerC = $answerC; + } + + /** + * @return string + */ + public function getAnswerD(): string + { + return $this->answerD; + } + + /** + * @param string $answerD + */ + public function setAnswerD(string $answerD): void + { + $this->answerD = $answerD; + } + + /** + * @return string + */ + public function getCAnswer(): string + { + return $this->cAnswer; + } + + /** + * @param string $cAnswer + */ + public function setCAnswer(string $cAnswer): void + { + $this->cAnswer = $cAnswer; + } + + + + } diff --git a/src/Entity/quizEntity.php b/src/Entity/quizEntity.php index a135d2f..e5f31da 100644 --- a/src/Entity/quizEntity.php +++ b/src/Entity/quizEntity.php @@ -1,56 +1,56 @@ -id_quiz = $id_quiz; - $this->nb_questions = $nb_questions; - } - - /** - * @return int - */ - public function getIdQuiz(): int - { - return $this->id_quiz; - } - - /** - * @param int $id_quiz - */ - public function setIdQuiz(int $id_quiz): void - { - $this->id_quiz = $id_quiz; - } - - /** - * @return int - */ - public function getNbQuestions(): int - { - return $this->nb_questions; - } - - /** - * @param int $nb_questions - */ - public function setNbQuestions(int $nb_questions): void - { - $this->nb_questions = $nb_questions; - } - - - - -} +id_quiz = $id_quiz; + $this->nb_questions = $nb_questions; + } + + /** + * @return int + */ + public function getIdQuiz(): int + { + return $this->id_quiz; + } + + /** + * @param int $id_quiz + */ + public function setIdQuiz(int $id_quiz): void + { + $this->id_quiz = $id_quiz; + } + + /** + * @return int + */ + public function getNbQuestions(): int + { + return $this->nb_questions; + } + + /** + * @param int $nb_questions + */ + public function setNbQuestions(int $nb_questions): void + { + $this->nb_questions = $nb_questions; + } + + + + +} diff --git a/src/Entity/quoteEntity.php b/src/Entity/quoteEntity.php index 61c56a4..f5eb1ab 100644 --- a/src/Entity/quoteEntity.php +++ b/src/Entity/quoteEntity.php @@ -1,168 +1,168 @@ -id = $id; - $this->content = $content; - $this->carac = $carac; - $this->imgPath = $imgPath; - $this->titleSrc = $titleSrc; - $this->dateSrc = $dateSrc; - $this->like = $like; - $this->langue = $langue; - } - - /** - * @return int - */ - public function getId(): int - { - return $this->id; - } - - /** - * @param int $id - */ - public function setId(int $id): void - { - $this->id = $id; - } - - /** - * @return string - */ - public function getContent(): string - { - return $this->content; - } - - /** - * @param string $content - */ - public function setContent(string $content): void - { - $this->content = $content; - } - - /** - * @return string - */ - public function getCarac(): string - { - return $this->carac; - } - - /** - * @param string $carac - */ - public function setCarac(string $carac): void - { - $this->carac = $carac; - } - - /** - * @return string - */ - public function getImgPath(): string - { - return $this->imgPath; - } - - /** - * @param string $imgPath - */ - public function setImgPath(string $imgPath): void - { - $this->imgPath = $imgPath; - } - - /** - * @return string - */ - public function getTitleSrc(): string - { - return $this->titleSrc; - } - - /** - * @param string $titleSrc - */ - public function setTitleSrc(string $titleSrc): void - { - $this->titleSrc = $titleSrc; - } - - /** - * @return string - */ - public function getDateSrc(): string - { - return $this->dateSrc; - } - - /** - * @param string $dateSrc - */ - public function setDateSrc(string $dateSrc): void - { - $this->dateSrc = $dateSrc; - } - - /** - * @return int - */ - public function getLike(): int - { - return $this->like; - } - - /** - * @param int $like - */ - public function setLike(int $like): void - { - $this->like = $like; - } - - /** - * @return string - */ - public function getLangue(): string - { - return $this->langue; - } - - /** - * @param string $langue - */ - public function setLangue(string $langue): void - { - $this->langue = $langue; - } - - - - } -?> +id = $id; + $this->content = $content; + $this->carac = $carac; + $this->imgPath = $imgPath; + $this->titleSrc = $titleSrc; + $this->dateSrc = $dateSrc; + $this->like = $like; + $this->langue = $langue; + } + + /** + * @return int + */ + public function getId(): int + { + return $this->id; + } + + /** + * @param int $id + */ + public function setId(int $id): void + { + $this->id = $id; + } + + /** + * @return string + */ + public function getContent(): string + { + return $this->content; + } + + /** + * @param string $content + */ + public function setContent(string $content): void + { + $this->content = $content; + } + + /** + * @return string + */ + public function getCarac(): string + { + return $this->carac; + } + + /** + * @param string $carac + */ + public function setCarac(string $carac): void + { + $this->carac = $carac; + } + + /** + * @return string + */ + public function getImgPath(): string + { + return $this->imgPath; + } + + /** + * @param string $imgPath + */ + public function setImgPath(string $imgPath): void + { + $this->imgPath = $imgPath; + } + + /** + * @return string + */ + public function getTitleSrc(): string + { + return $this->titleSrc; + } + + /** + * @param string $titleSrc + */ + public function setTitleSrc(string $titleSrc): void + { + $this->titleSrc = $titleSrc; + } + + /** + * @return string + */ + public function getDateSrc(): string + { + return $this->dateSrc; + } + + /** + * @param string $dateSrc + */ + public function setDateSrc(string $dateSrc): void + { + $this->dateSrc = $dateSrc; + } + + /** + * @return int + */ + public function getLike(): int + { + return $this->like; + } + + /** + * @param int $like + */ + public function setLike(int $like): void + { + $this->like = $like; + } + + /** + * @return string + */ + public function getLangue(): string + { + return $this->langue; + } + + /** + * @param string $langue + */ + public function setLangue(string $langue): void + { + $this->langue = $langue; + } + + + + } +?> diff --git a/src/Entity/sourceEntity.php b/src/Entity/sourceEntity.php index 66198d4..8a41c86 100644 --- a/src/Entity/sourceEntity.php +++ b/src/Entity/sourceEntity.php @@ -1,77 +1,77 @@ -id_source = $id_source; - $this->title = $title; - $this->date = $date; - } - - /** - * @return int - */ - public function getIdSource(): int - { - return $this->id_source; - } - - /** - * @param int $id_source - */ - public function setIdSource(int $id_source): void - { - $this->id_source = $id_source; - } - - /** - * @return string - */ - public function getTitle(): string - { - return $this->title; - } - - /** - * @param string $title - */ - public function setTitle(string $title): void - { - $this->title = $title; - } - - /** - * @return string - */ - public function getDate(): string - { - return $this->date; - } - - /** - * @param string $date - */ - public function setDate(string $date): void - { - $this->date = $date; - } - - - - - - -} +id_source = $id_source; + $this->title = $title; + $this->date = $date; + } + + /** + * @return int + */ + public function getIdSource(): int + { + return $this->id_source; + } + + /** + * @param int $id_source + */ + public function setIdSource(int $id_source): void + { + $this->id_source = $id_source; + } + + /** + * @return string + */ + public function getTitle(): string + { + return $this->title; + } + + /** + * @param string $title + */ + public function setTitle(string $title): void + { + $this->title = $title; + } + + /** + * @return string + */ + public function getDate(): string + { + return $this->date; + } + + /** + * @param string $date + */ + public function setDate(string $date): void + { + $this->date = $date; + } + + + + + + +} diff --git a/src/Entity/userEntity.php b/src/Entity/userEntity.php index f0546be..10ef40c 100644 --- a/src/Entity/userEntity.php +++ b/src/Entity/userEntity.php @@ -1,175 +1,175 @@ -id = $id; - $this->username = $username; - $this->passwd = $passwd; - $this->hidenPasswd = hidenPasswd($passwd); - $this->img = $img; - $this->email = $email; - } - - /** - * @return string - */ - public function getId(): int - { - return $this->id; - } - - /** - * @param string $id - */ - public function setId(int $id): void - { - $this->id = $id; - } - - /** - * @return string - */ - public function getUsername(): string - { - return $this->username; - } - - /** - * @param string $username - */ - public function setUsername(string $username): void - { - $this->username = $username; - } - - /** - * @return string - */ - public function getImg(): int - { - return $this->img; - } - - /** - * @param string $img - */ - public function setImg(int $img): void - { - $this->img = $img; - } - - /** - * @return string - */ - public function getEmail(): string - { - return $this->email; - } - - /** - * @param string $email - */ - public function setEmail(string $email): void - { - $this->email = $email; - } - - /** - * @return string - */ - public function getPasswd(): string - { - return $this->passwd; - } - - /** - * @return string - */ - public function getHidenPasswd(): string - { - return $this->hidenPasswd; - } - - /** - * @param string $passwd - */ - public function setPasswd(string $passwd): void - { - $this->passwd = $passwd; - $this->hidenPassWd = hidenPassWd($passwd); - } - - - - } - // ============================================ En attente du Model ============================================ - /*$dsn = "pgsql:host=londres;dbname=dblebeaulato"; - $username = "lebeaulato"; - $password = ""; - - $con = new Connection($dsn,$username,$password); - - $query = 'SELECT * FROM Users WHERE id_user=:idUser'; - $con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR))); - $result = $con->getResults(); - - $u = new User($result[0]['id_user'],$result[0]['username'], $result[0]['pssword'], '../images/imageProfil.png', $result[0]['email']); - - - - - //UPDATE username User - $query = 'UPDATE Users SET username=:newUsername WHERE id_user=:idUser'; - $con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR), ':newUsername'=> array('Hello', PDO::PARAM_STR))); - $queryReponse = 'SELECT username FROM Users WHERE id_user=:idUser'; - - $con->executeQuery($queryReponse, array(':idUser'=>array('U003', PDO::PARAM_STR))); - $result = $con->getResults(); - $u->setUsername($result[0]['username']); - - - //UPDATE email User - $query = 'UPDATE Users SET email=:newEmail WHERE id_user=:idUser'; - $con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR), ':newEmail'=> array('hello@gmail.com', PDO::PARAM_STR))); - $queryReponse = 'SELECT email FROM Users WHERE id_user=:idUser'; - - $con->executeQuery($queryReponse, array(':idUser'=>array('U003', PDO::PARAM_STR))); - $result = $con->getResults(); - $u->setEmail($result[0]['email']); - - //UPDATE passwd User - $query = 'UPDATE Users SET pssword=:newPassWd WHERE id_user=:idUser'; - $con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR), ':newPassWd'=> array('TestMotDePasssse', PDO::PARAM_STR))); - - $queryReponse = 'SELECT pssword FROM Users WHERE id_user=:idUser'; - $con->executeQuery($queryReponse, array(':idUser'=>array('U003', PDO::PARAM_STR))); - $result = $con->getResults(); - $u->setPasswd($result[0]['pssword']); /*Test*/ - -// ================================================================================================================ - - - - function hidenPassWd(string $passwd){ - if(strlen($passwd) >= 16) return str_repeat('*', 16); - return str_repeat('*', strlen($passwd)); - } -?> +id = $id; + $this->username = $username; + $this->passwd = $passwd; + $this->hidenPasswd = hidenPasswd($passwd); + $this->img = $img; + $this->email = $email; + } + + /** + * @return string + */ + public function getId(): int + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(int $id): void + { + $this->id = $id; + } + + /** + * @return string + */ + public function getUsername(): string + { + return $this->username; + } + + /** + * @param string $username + */ + public function setUsername(string $username): void + { + $this->username = $username; + } + + /** + * @return string + */ + public function getImg(): int + { + return $this->img; + } + + /** + * @param string $img + */ + public function setImg(int $img): void + { + $this->img = $img; + } + + /** + * @return string + */ + public function getEmail(): string + { + return $this->email; + } + + /** + * @param string $email + */ + public function setEmail(string $email): void + { + $this->email = $email; + } + + /** + * @return string + */ + public function getPasswd(): string + { + return $this->passwd; + } + + /** + * @return string + */ + public function getHidenPasswd(): string + { + return $this->hidenPasswd; + } + + /** + * @param string $passwd + */ + public function setPasswd(string $passwd): void + { + $this->passwd = $passwd; + $this->hidenPassWd = hidenPassWd($passwd); + } + + + + } + // ============================================ En attente du Model ============================================ + /*$dsn = "pgsql:host=londres;dbname=dblebeaulato"; + $username = "lebeaulato"; + $password = ""; + + $con = new Connection($dsn,$username,$password); + + $query = 'SELECT * FROM Users WHERE id_user=:idUser'; + $con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR))); + $result = $con->getResults(); + + $u = new User($result[0]['id_user'],$result[0]['username'], $result[0]['pssword'], '../images/imageProfil.png', $result[0]['email']); + + + + + //UPDATE username User + $query = 'UPDATE Users SET username=:newUsername WHERE id_user=:idUser'; + $con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR), ':newUsername'=> array('Hello', PDO::PARAM_STR))); + $queryReponse = 'SELECT username FROM Users WHERE id_user=:idUser'; + + $con->executeQuery($queryReponse, array(':idUser'=>array('U003', PDO::PARAM_STR))); + $result = $con->getResults(); + $u->setUsername($result[0]['username']); + + + //UPDATE email User + $query = 'UPDATE Users SET email=:newEmail WHERE id_user=:idUser'; + $con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR), ':newEmail'=> array('hello@gmail.com', PDO::PARAM_STR))); + $queryReponse = 'SELECT email FROM Users WHERE id_user=:idUser'; + + $con->executeQuery($queryReponse, array(':idUser'=>array('U003', PDO::PARAM_STR))); + $result = $con->getResults(); + $u->setEmail($result[0]['email']); + + //UPDATE passwd User + $query = 'UPDATE Users SET pssword=:newPassWd WHERE id_user=:idUser'; + $con->executeQuery($query, array(':idUser'=>array('U003', PDO::PARAM_STR), ':newPassWd'=> array('TestMotDePasssse', PDO::PARAM_STR))); + + $queryReponse = 'SELECT pssword FROM Users WHERE id_user=:idUser'; + $con->executeQuery($queryReponse, array(':idUser'=>array('U003', PDO::PARAM_STR))); + $result = $con->getResults(); + $u->setPasswd($result[0]['pssword']); /*Test*/ + +// ================================================================================================================ + + + + function hidenPassWd(string $passwd){ + if(strlen($passwd) >= 16) return str_repeat('*', 16); + return str_repeat('*', strlen($passwd)); + } +?> diff --git a/src/Gateway/CharacterGateway.php b/src/Gateway/CharacterGateway.php index e3ccc02..27f7b9d 100644 --- a/src/Gateway/CharacterGateway.php +++ b/src/Gateway/CharacterGateway.php @@ -1,75 +1,75 @@ - co = $co; - } - - public function create(int $id_character, string $name , string $img_char) : bool - { - $query = " - INSERT INTO Characters - VALUES(:id_char, :name, :img_char) - "; - - return $this -> co -> executeQuery($query, [ - 'id_char' => array($id_character, PDO::PARAM_INT), - 'name' => array($name, PDO::PARAM_STR), - 'img_char' => array($img_char, PDO::PARAM_STR) - ]); - - } - - public function findById(int $id) : array - { - $query = "SELECT * FROM Characters WHERE id_char = :id_c"; - $this -> co -> executeQuery($query, ["id_c" => array($id, PDO::PARAM_INT)]); - return $this -> co -> getResults(); - } - - public function findByName(string $name) : array - { - $query = "SELECT * FROM Characters WHERE name = :n"; - $this -> co -> executeQuery($query, ["n" => array($name, PDO::PARAM_STR)]); - return $this -> co -> getResults(); - } - - public function findAll() : array - { - $query = "SELECT * FROM Characters"; - $this -> co -> executeQuery($query); - return $this -> co -> getResults(); - } - - public function delete(int $id) : bool - { - $query = "DELETE FROM Characters WHERE id_char = :id_c"; - return $this -> co -> executeQuery($query, ["id_c" => array($id, PDO::PARAM_INT)]); - } - - public function update(int $id_char, string $name, string $img_char) : bool - { - $query = " - UPDATE Characters - SET name = :n, img_char = :i - WHERE id_char = :id_c - "; - - return $this -> co -> executeQuery($query, [ - "id_c" => array($id_char, PDO::PARAM_INT), - "name" => array($name, PDO::PARAM_STR), - "i" => array($img_char, PDO::PARAM_STR) - ]); - } - + co = $co; + } + + public function create(int $id_character, string $name , string $img_char) : bool + { + $query = " + INSERT INTO Characters + VALUES(:id_char, :name, :img_char) + "; + + return $this -> co -> executeQuery($query, [ + 'id_char' => array($id_character, PDO::PARAM_INT), + 'name' => array($name, PDO::PARAM_STR), + 'img_char' => array($img_char, PDO::PARAM_STR) + ]); + + } + + public function findById(int $id) : array + { + $query = "SELECT * FROM Characters WHERE id_char = :id_c"; + $this -> co -> executeQuery($query, ["id_c" => array($id, PDO::PARAM_INT)]); + return $this -> co -> getResults(); + } + + public function findByName(string $name) : array + { + $query = "SELECT * FROM Characters WHERE name = :n"; + $this -> co -> executeQuery($query, ["n" => array($name, PDO::PARAM_STR)]); + return $this -> co -> getResults(); + } + + public function findAll() : array + { + $query = "SELECT * FROM Characters"; + $this -> co -> executeQuery($query); + return $this -> co -> getResults(); + } + + public function delete(int $id) : bool + { + $query = "DELETE FROM Characters WHERE id_char = :id_c"; + return $this -> co -> executeQuery($query, ["id_c" => array($id, PDO::PARAM_INT)]); + } + + public function update(int $id_char, string $name, string $img_char) : bool + { + $query = " + UPDATE Characters + SET name = :n, img_char = :i + WHERE id_char = :id_c + "; + + return $this -> co -> executeQuery($query, [ + "id_c" => array($id_char, PDO::PARAM_INT), + "name" => array($name, PDO::PARAM_STR), + "i" => array($img_char, PDO::PARAM_STR) + ]); + } + } \ No newline at end of file diff --git a/src/Gateway/Connection.php b/src/Gateway/Connection.php index 2632683..de763f7 100644 --- a/src/Gateway/Connection.php +++ b/src/Gateway/Connection.php @@ -1,35 +1,35 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } - - - /** * @param string $query - * @param array $parameters * - * @return bool Returns `true` on success, `false` otherwise - */ - - public function executeQuery(string $query, array $parameters = []) : bool{ - $this->stmt = parent::prepare($query); - foreach ($parameters as $name => $value) { - $this->stmt->bindValue($name, $value[0], $value[1]); - } - - return $this->stmt->execute(); - } - - public function getResults() : array { - return $this->stmt->fetchall(); - } - } - -?> +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } + + + /** * @param string $query + * @param array $parameters * + * @return bool Returns `true` on success, `false` otherwise + */ + + public function executeQuery(string $query, array $parameters = []) : bool{ + $this->stmt = parent::prepare($query); + foreach ($parameters as $name => $value) { + $this->stmt->bindValue($name, $value[0], $value[1]); + } + + return $this->stmt->execute(); + } + + public function getResults() : array { + return $this->stmt->fetchall(); + } + } + +?> diff --git a/src/Gateway/FavoriteGateway.php b/src/Gateway/FavoriteGateway.php index 90f3eb1..bc5156b 100644 --- a/src/Gateway/FavoriteGateway.php +++ b/src/Gateway/FavoriteGateway.php @@ -1,77 +1,77 @@ - co = $co; - } - - public function createFavoriteGateway(int $idUser, int $idQuote) : bool - { - $query = " - INSERT INTO Favorite - VALUES (:user, :quote) - "; - - return $this -> co -> executeQuery($query, [ - 'user' => array($idUser, PDO::PARAM_INT), - 'quote' => array($idQuote, PDO::PARAM_INT) - ]); - } - - public function findFavoriteById(int $idUser, int $idQuote) : array - { - $query = " - SELECT * FROM Favorite - WHERE user_f = :user AND quote_f = :quote - "; - - $this -> co -> executeQuery($query, [ - 'user' => array($idUser, PDO::PARAM_INT), - 'quote' => array($idQuote, PDO::PARAM_INT) - ]); - - return $this -> co -> getResults(); - } - - public function findFavoriteByUser(int $idUser) : array - { - $query = " - SELECT * FROM Favorite - WHERE user_f = :user - "; - - $this -> co -> executeQuery($query, ['user' => array($idUser, PDO::PARAM_INT)]); - - return $this -> co -> getResults(); - } - - public function findAllFavorite() : array - { - $query = "SELECT * FROM Favorite"; - - $this -> co -> executeQuery($query); - - return $this -> co -> getResults(); - } - - public function deleteFavoriteGateway(int $idUser, int $idQuote) : bool - { - $query = " - DELETE FROM Favorite - WHERE user_f = :user AND quote_f = :quote - "; - - return $this -> co -> executeQuery($query, [ - 'user' => array($idUser, PDO::PARAM_INT), - 'quote' => array($idQuote, PDO::PARAM_INT) - ]); - } - + co = $co; + } + + public function createFavoriteGateway(int $idUser, int $idQuote) : bool + { + $query = " + INSERT INTO Favorite + VALUES (:user, :quote) + "; + + return $this -> co -> executeQuery($query, [ + 'user' => array($idUser, PDO::PARAM_INT), + 'quote' => array($idQuote, PDO::PARAM_INT) + ]); + } + + public function findFavoriteById(int $idUser, int $idQuote) : array + { + $query = " + SELECT * FROM Favorite + WHERE user_f = :user AND quote_f = :quote + "; + + $this -> co -> executeQuery($query, [ + 'user' => array($idUser, PDO::PARAM_INT), + 'quote' => array($idQuote, PDO::PARAM_INT) + ]); + + return $this -> co -> getResults(); + } + + public function findFavoriteByUser(int $idUser) : array + { + $query = " + SELECT * FROM Favorite + WHERE user_f = :user + "; + + $this -> co -> executeQuery($query, ['user' => array($idUser, PDO::PARAM_INT)]); + + return $this -> co -> getResults(); + } + + public function findAllFavorite() : array + { + $query = "SELECT * FROM Favorite"; + + $this -> co -> executeQuery($query); + + return $this -> co -> getResults(); + } + + public function deleteFavoriteGateway(int $idUser, int $idQuote) : bool + { + $query = " + DELETE FROM Favorite + WHERE user_f = :user AND quote_f = :quote + "; + + return $this -> co -> executeQuery($query, [ + 'user' => array($idUser, PDO::PARAM_INT), + 'quote' => array($idQuote, PDO::PARAM_INT) + ]); + } + } \ No newline at end of file diff --git a/src/Gateway/ImageGateway.php b/src/Gateway/ImageGateway.php index 1349e8d..9cd9c7b 100644 --- a/src/Gateway/ImageGateway.php +++ b/src/Gateway/ImageGateway.php @@ -1,87 +1,87 @@ - co = $co; - } - - public function createImgGateway(int $idImg, string $imgPath, bool $isImgProfile) : bool - { - $query = " - INSERT INTO Images - VALUES (:id_img, :img_path, :is_img_profile) - "; - - return $this -> co -> executeQuery($query, [ - 'id_img' => array($idImg, PDO::PARAM_INT), - 'img_path' => array($imgPath, PDO::PARAM_STR), - 'is_img_profile' => array($isImgProfile, PDO::PARAM_BOOL), - ]); - } - - public function findImgById(int $idImg) : array - { - $query = " - SELECT * FROM Images - WHERE id_image = :id_img - "; - - $this -> co -> executeQuery($query, ['id_img' => array($idImg, PDO::PARAM_INT)]); - - return $this -> co -> getResults(); - } - - public function findAllImg() : array - { - $query = " - SELECT * FROM Images - "; - - $this -> co -> executeQuery($query); - - return $this -> co -> getResults(); - } - - public function findAllImgProfile() : array - { - $query = " - SELECT * FROM Images - WHERE is_img_prfl - "; - - $this -> co -> executeQuery($query); - - return $this -> co -> getResults(); - } - - public function deleteImgGateway(int $idImg) : bool - { - $query = " - DELETE FROM Images - WHERE id_image = :id_img - "; - - return $this -> co -> executeQuery($query, ['id_img' => array($idImg, PDO::PARAM_INT)]); - } - - public function updateImgGateway(int $idImg, string $imgPath) : bool - { - $query = " - UPDATE Images - SET img_path = :img_path - WHERE id_image = :id_img - "; - - return $this -> co -> executeQuery($query, [ - 'id_img' => array($idImg, PDO::PARAM_INT), - 'img_path' => array($imgPath, PDO::PARAM_STR) - ]); - } + co = $co; + } + + public function createImgGateway(int $idImg, string $imgPath, bool $isImgProfile) : bool + { + $query = " + INSERT INTO Images + VALUES (:id_img, :img_path, :is_img_profile) + "; + + return $this -> co -> executeQuery($query, [ + 'id_img' => array($idImg, PDO::PARAM_INT), + 'img_path' => array($imgPath, PDO::PARAM_STR), + 'is_img_profile' => array($isImgProfile, PDO::PARAM_BOOL), + ]); + } + + public function findImgById(int $idImg) : array + { + $query = " + SELECT * FROM Images + WHERE id_image = :id_img + "; + + $this -> co -> executeQuery($query, ['id_img' => array($idImg, PDO::PARAM_INT)]); + + return $this -> co -> getResults(); + } + + public function findAllImg() : array + { + $query = " + SELECT * FROM Images + "; + + $this -> co -> executeQuery($query); + + return $this -> co -> getResults(); + } + + public function findAllImgProfile() : array + { + $query = " + SELECT * FROM Images + WHERE is_img_prfl + "; + + $this -> co -> executeQuery($query); + + return $this -> co -> getResults(); + } + + public function deleteImgGateway(int $idImg) : bool + { + $query = " + DELETE FROM Images + WHERE id_image = :id_img + "; + + return $this -> co -> executeQuery($query, ['id_img' => array($idImg, PDO::PARAM_INT)]); + } + + public function updateImgGateway(int $idImg, string $imgPath) : bool + { + $query = " + UPDATE Images + SET img_path = :img_path + WHERE id_image = :id_img + "; + + return $this -> co -> executeQuery($query, [ + 'id_img' => array($idImg, PDO::PARAM_INT), + 'img_path' => array($imgPath, PDO::PARAM_STR) + ]); + } } \ No newline at end of file diff --git a/src/Gateway/QuestionGateway.php b/src/Gateway/QuestionGateway.php index 0e24df4..6b4b246 100644 --- a/src/Gateway/QuestionGateway.php +++ b/src/Gateway/QuestionGateway.php @@ -1,107 +1,107 @@ - co = $co; - } - - public function create(int $id_question, string $question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer): bool - { - $query = " - INSERT INTO Question - VALUES (:id_q, :question, :answerA, :answerB, :answerC, :answerD, :cAnswer) - "; - - return $this -> co -> executeQuery($query, [ - array('id_q' => $id_question, PDO::PARAM_INT), - array('question' => $question, PDO::PARAM_STR), - array('answerA' => $answerA, PDO::PARAM_STR), - array('answerB' => $answerB, PDO::PARAM_STR), - array('answerC' => $answerC, PDO::PARAM_STR), - array('answerD' => $answerD, PDO::PARAM_STR), - array('cAnswer' => $cAnswer, PDO::PARAM_STR), - ]); - } - - - public function findById(int $id) : array - { - $query = "SELECT * FROM Question WHERE id_question = :id_q"; - $this -> co -> executeQuery($query, ['id_q' => array($id, PDO::PARAM_INT)]); - return $this -> co -> getResults(); - } - - - public function updateText(int $id_q, string $newQuestion) : bool - { - $query = " - UPDATE Question - SET question = :question - WHERE id_question = :id_q - "; - - return $this -> co -> executeQuery($query, [ - 'id_q' => array($id_q, PDO::PARAM_INT), - 'question' => array($newQuestion, PDO::PARAM_STR) - ]); - } - - public function updateAnswers(int $id_q, string $newA, string $newB, string $newC, string $newD, string $newCorrect): bool - { - $query = " - UPDATE Question - SET answerA = :answerA, answerB = :answerB, - answerC = :answerC, answerD = :answerD, cAnswer = :cAnswer - WHERE id_question = :id_q - "; - - return $this -> co -> executeQuery($query, [ - 'id_q' => array($id_q, PDO::PARAM_INT), - 'answerA' => array($newA, PDO::PARAM_STR), - 'answerB' => array($newB, PDO::PARAM_STR), - 'answerC' => array($newC, PDO::PARAM_STR), - 'answerD' => array($newD, PDO::PARAM_STR), - 'cAnswer' => array($newCorrect, PDO::PARAM_STR) - ]); - } - - /** - * Deletes a question from the database by its ID - * - * @param int $id The ID of the question - * @return bool - */ - public function delete(int $id) : bool - { - $query = "DELETE FROM Question WHERE id_question = :id_q"; - - return $this -> co -> executeQuery($query, ['id_q' => array($id, PDO::PARAM_INT)]); - } - - /** - * Retrieves all quizzes from the database - * - * @return QuestionEntity[] An array of `Question` objects - */ - public function findAll() : array - { - $query = "SELECT * FROM Question"; - $this -> co -> executeQuery($query); - return $this -> co -> getResults(); - } - - public function findRdmQuestion() : array - { - $query = "SELECT * FROM Question ORDER BY RANDOM() LIMIT 1"; - $this -> co -> executeQuery($query); - return $this -> co -> getResults(); - } - -} + co = $co; + } + + public function create(int $id_question, string $question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer): bool + { + $query = " + INSERT INTO Question + VALUES (:id_q, :question, :answerA, :answerB, :answerC, :answerD, :cAnswer) + "; + + return $this -> co -> executeQuery($query, [ + array('id_q' => $id_question, PDO::PARAM_INT), + array('question' => $question, PDO::PARAM_STR), + array('answerA' => $answerA, PDO::PARAM_STR), + array('answerB' => $answerB, PDO::PARAM_STR), + array('answerC' => $answerC, PDO::PARAM_STR), + array('answerD' => $answerD, PDO::PARAM_STR), + array('cAnswer' => $cAnswer, PDO::PARAM_STR), + ]); + } + + + public function findById(int $id) : array + { + $query = "SELECT * FROM Question WHERE id_question = :id_q"; + $this -> co -> executeQuery($query, ['id_q' => array($id, PDO::PARAM_INT)]); + return $this -> co -> getResults(); + } + + + public function updateText(int $id_q, string $newQuestion) : bool + { + $query = " + UPDATE Question + SET question = :question + WHERE id_question = :id_q + "; + + return $this -> co -> executeQuery($query, [ + 'id_q' => array($id_q, PDO::PARAM_INT), + 'question' => array($newQuestion, PDO::PARAM_STR) + ]); + } + + public function updateAnswers(int $id_q, string $newA, string $newB, string $newC, string $newD, string $newCorrect): bool + { + $query = " + UPDATE Question + SET answerA = :answerA, answerB = :answerB, + answerC = :answerC, answerD = :answerD, cAnswer = :cAnswer + WHERE id_question = :id_q + "; + + return $this -> co -> executeQuery($query, [ + 'id_q' => array($id_q, PDO::PARAM_INT), + 'answerA' => array($newA, PDO::PARAM_STR), + 'answerB' => array($newB, PDO::PARAM_STR), + 'answerC' => array($newC, PDO::PARAM_STR), + 'answerD' => array($newD, PDO::PARAM_STR), + 'cAnswer' => array($newCorrect, PDO::PARAM_STR) + ]); + } + + /** + * Deletes a question from the database by its ID + * + * @param int $id The ID of the question + * @return bool + */ + public function delete(int $id) : bool + { + $query = "DELETE FROM Question WHERE id_question = :id_q"; + + return $this -> co -> executeQuery($query, ['id_q' => array($id, PDO::PARAM_INT)]); + } + + /** + * Retrieves all quizzes from the database + * + * @return QuestionEntity[] An array of `Question` objects + */ + public function findAll() : array + { + $query = "SELECT * FROM Question"; + $this -> co -> executeQuery($query); + return $this -> co -> getResults(); + } + + public function findRdmQuestion() : array + { + $query = "SELECT * FROM Question ORDER BY RANDOM() LIMIT 1"; + $this -> co -> executeQuery($query); + return $this -> co -> getResults(); + } + +} diff --git a/src/Gateway/QuizGateway.php b/src/Gateway/QuizGateway.php index 32dd837..05e464f 100644 --- a/src/Gateway/QuizGateway.php +++ b/src/Gateway/QuizGateway.php @@ -1,50 +1,50 @@ - co = $co; - } - - public function create(int $id_quiz, int $nb_questions) : bool - { - $query = " - INSERT INTO Quiz - VALUES (:id_q, :nb_q) - "; - - return $this -> co -> executeQuery($query, [ - ':id_q' => array($id_quiz, PDO::PARAM_INT), - ':nb_q' => array($nb_questions, PDO::PARAM_INT) - ]); - } - - public function findQuizById(int $id) : array - { - $query = "SELECT * FROM Quiz WHERE id_quiz = :id_q"; - $this -> co -> executeQuery($query, [':id_q' => array($id, PDO::PARAM_INT)]); - return $this -> co -> getResults(); - } - - public function delete(int $id) : bool - { - $query = "DELETE FROM Quiz WHERE id_quiz = :id_q"; - return $this -> co -> executeQuery($query, [':id_q' => array($id, PDO::PARAM_INT)]); - } - - public function findAll() : array - { - $query = "SELECT * FROM Quiz"; - $this -> co -> executeQuery($query); - return $this -> co -> getResults(); - } - + co = $co; + } + + public function create(int $id_quiz, int $nb_questions) : bool + { + $query = " + INSERT INTO Quiz + VALUES (:id_q, :nb_q) + "; + + return $this -> co -> executeQuery($query, [ + ':id_q' => array($id_quiz, PDO::PARAM_INT), + ':nb_q' => array($nb_questions, PDO::PARAM_INT) + ]); + } + + public function findQuizById(int $id) : array + { + $query = "SELECT * FROM Quiz WHERE id_quiz = :id_q"; + $this -> co -> executeQuery($query, [':id_q' => array($id, PDO::PARAM_INT)]); + return $this -> co -> getResults(); + } + + public function delete(int $id) : bool + { + $query = "DELETE FROM Quiz WHERE id_quiz = :id_q"; + return $this -> co -> executeQuery($query, [':id_q' => array($id, PDO::PARAM_INT)]); + } + + public function findAll() : array + { + $query = "SELECT * FROM Quiz"; + $this -> co -> executeQuery($query); + return $this -> co -> getResults(); + } + } \ No newline at end of file diff --git a/src/Gateway/QuizQuestionGateway.php b/src/Gateway/QuizQuestionGateway.php index 2c71b86..35a521f 100644 --- a/src/Gateway/QuizQuestionGateway.php +++ b/src/Gateway/QuizQuestionGateway.php @@ -1,73 +1,73 @@ - co = $co; - } - - public function createQuizQuestionGateway(int $idQuiz, int $idQuestion): bool - { - $query = " - INSERT INTO QuizQuestions - VALUES (:id_quiz, :id_question) - "; - - return $this -> co -> executeQuery($query, [ - 'id_quiz' => array($idQuiz, PDO::PARAM_INT), - 'id_question' => array($idQuestion, PDO::PARAM_INT) - ]); - } - - public function findQuizQuestionById(int $idQuiz, int $idQuestion) : array - { - $query = " - SELECT * FROM QuizQuestions - WHERE quiz_qq = :id_quiz AND question_qq = :id_question - "; - - $this -> co -> executeQuery($query, [ - 'id_quiz' => array($idQuiz, PDO::PARAM_INT), - 'id_question' => array($idQuestion, PDO::PARAM_INT) - ]); - - return $this -> co -> getResults(); - } - - public function findQuestionsFromQuiz(int $idQuiz) : array - { - $query = " - SELECT * FROM QuizQuestions - WHERE quiz_qq = :id_quiz - "; - - $this -> co -> executeQuery($query, ['id_quiz' => array($idQuiz, PDO::PARAM_INT)]); - - return $this -> co -> getResults(); - } - - public function deleteQuizQuestionGateway(int $idQuiz, int $idQuestion) : bool - { - $query = " - DELETE FROM QuizQuestions - WHERE quiz_qq = :id_quiz AND question_qq = :id_question - "; - - return $this -> co -> executeQuery($query, [ - 'id_quiz' => array($idQuiz, PDO::PARAM_INT), - 'id_question' => array($idQuestion, PDO::PARAM_INT) - ]); - } - - # To do : - # Method that deletes all questions related to a quiz - - - + co = $co; + } + + public function createQuizQuestionGateway(int $idQuiz, int $idQuestion): bool + { + $query = " + INSERT INTO QuizQuestions + VALUES (:id_quiz, :id_question) + "; + + return $this -> co -> executeQuery($query, [ + 'id_quiz' => array($idQuiz, PDO::PARAM_INT), + 'id_question' => array($idQuestion, PDO::PARAM_INT) + ]); + } + + public function findQuizQuestionById(int $idQuiz, int $idQuestion) : array + { + $query = " + SELECT * FROM QuizQuestions + WHERE quiz_qq = :id_quiz AND question_qq = :id_question + "; + + $this -> co -> executeQuery($query, [ + 'id_quiz' => array($idQuiz, PDO::PARAM_INT), + 'id_question' => array($idQuestion, PDO::PARAM_INT) + ]); + + return $this -> co -> getResults(); + } + + public function findQuestionsFromQuiz(int $idQuiz) : array + { + $query = " + SELECT * FROM QuizQuestions + WHERE quiz_qq = :id_quiz + "; + + $this -> co -> executeQuery($query, ['id_quiz' => array($idQuiz, PDO::PARAM_INT)]); + + return $this -> co -> getResults(); + } + + public function deleteQuizQuestionGateway(int $idQuiz, int $idQuestion) : bool + { + $query = " + DELETE FROM QuizQuestions + WHERE quiz_qq = :id_quiz AND question_qq = :id_question + "; + + return $this -> co -> executeQuery($query, [ + 'id_quiz' => array($idQuiz, PDO::PARAM_INT), + 'id_question' => array($idQuestion, PDO::PARAM_INT) + ]); + } + + # To do : + # Method that deletes all questions related to a quiz + + + } \ No newline at end of file diff --git a/src/Gateway/ResultsGateway.php b/src/Gateway/ResultsGateway.php index 0a965db..628e14e 100644 --- a/src/Gateway/ResultsGateway.php +++ b/src/Gateway/ResultsGateway.php @@ -1,131 +1,131 @@ - co = $co ; - } - - public function createResultsGateway(int $idQuiz, int $idUser, int $nbPts, int $time) : bool - { - $query = " - INSERT INTO Results - VALUES (:id_quiz, :id_user, :nb_pts, :time) - "; - - return $this -> co -> executeQuery($query, [ - 'id_quiz' => array($idQuiz, PDO::PARAM_INT), - 'id_user' => array($idUser, PDO::PARAM_INT), - 'nb_pts' => array($nbPts, PDO::PARAM_INT), - 'time' => array($time, PDO::PARAM_INT) - ]); - } - - public function findResultsByQuiz(int $idQuiz) : array - { - $query = " - SELECT * FROM Results - WHERE quiz_r = :id_quiz - "; - - $this -> co -> executeQuery($query, ['id_quiz' => array($idQuiz, PDO::PARAM_INT)]); - - return $this -> co -> getResults(); - } - - public function findResultsByUser(int $idUser) : array - { - $query = " - SELECT * FROM Results - WHERE user_r = :id_user - "; - - $this -> co -> executeQuery($query, ['id_user' => array($idUser, PDO::PARAM_INT)]); - - return $this -> co -> getResults(); - } - - public function findResultsById(int $idQuiz, int $idUser) : array - { - $query = " - SELECT * FROM Results - WHERE quiz_r = :id_quiz AND user_r = :id_user - "; - - $this -> co -> executeQuery($query, [ - 'id_user' => array($idUser, PDO::PARAM_INT), - 'id_quiz' => array($idQuiz, PDO::PARAM_INT) - ]); - - return $this -> co -> getResults(); - } - - public function findAllResults() : array - { - $query = "SELECT * FROM Results"; - - $this -> co -> executeQuery($query); - - return $this -> co -> getResults(); - } - - public function updateResults(int $idQuiz, int $idUser, ?int $score, ?int $time) : bool - { - if ($score && !$time) - { - $query = " - UPDATE Results - SET score = :score - WHERE quiz_r = :id_quiz AND user_r = :id_user - "; - - return $this -> co -> executeQuery($query, [ - 'id_quiz' => array($idQuiz, PDO::PARAM_INT), - 'id_user' => array($idUser, PDO::PARAM_INT), - 'score' => array($score, PDO::PARAM_INT) - ]); - } - - - else if (!$score && $time) - { - $query = " - UPDATE Results - SET time = :time - WHERE quiz_r = :id_quiz AND user_r = :id_user - "; - - return $this -> co -> executeQuery($query, [ - 'id_quiz' => array($idQuiz, PDO::PARAM_INT), - 'id_user' => array($idUser, PDO::PARAM_INT), - 'time' => array($time, PDO::PARAM_INT) - ]); - } - - else - { - $query = " - UPDATE Results - SET score = :score AND time = :time - WHERE quiz_r = :id_quiz AND user_r = :id_user - "; - - return $this -> co -> executeQuery($query, [ - 'id_quiz' => array($idQuiz, PDO::PARAM_INT), - 'id_user' => array($idUser, PDO::PARAM_INT), - 'score' => array($score, PDO::PARAM_INT), - 'time' => array($time, PDO::PARAM_INT) - ]); - } - - } - - + co = $co ; + } + + public function createResultsGateway(int $idQuiz, int $idUser, int $nbPts, int $time) : bool + { + $query = " + INSERT INTO Results + VALUES (:id_quiz, :id_user, :nb_pts, :time) + "; + + return $this -> co -> executeQuery($query, [ + 'id_quiz' => array($idQuiz, PDO::PARAM_INT), + 'id_user' => array($idUser, PDO::PARAM_INT), + 'nb_pts' => array($nbPts, PDO::PARAM_INT), + 'time' => array($time, PDO::PARAM_INT) + ]); + } + + public function findResultsByQuiz(int $idQuiz) : array + { + $query = " + SELECT * FROM Results + WHERE quiz_r = :id_quiz + "; + + $this -> co -> executeQuery($query, ['id_quiz' => array($idQuiz, PDO::PARAM_INT)]); + + return $this -> co -> getResults(); + } + + public function findResultsByUser(int $idUser) : array + { + $query = " + SELECT * FROM Results + WHERE user_r = :id_user + "; + + $this -> co -> executeQuery($query, ['id_user' => array($idUser, PDO::PARAM_INT)]); + + return $this -> co -> getResults(); + } + + public function findResultsById(int $idQuiz, int $idUser) : array + { + $query = " + SELECT * FROM Results + WHERE quiz_r = :id_quiz AND user_r = :id_user + "; + + $this -> co -> executeQuery($query, [ + 'id_user' => array($idUser, PDO::PARAM_INT), + 'id_quiz' => array($idQuiz, PDO::PARAM_INT) + ]); + + return $this -> co -> getResults(); + } + + public function findAllResults() : array + { + $query = "SELECT * FROM Results"; + + $this -> co -> executeQuery($query); + + return $this -> co -> getResults(); + } + + public function updateResults(int $idQuiz, int $idUser, ?int $score, ?int $time) : bool + { + if ($score && !$time) + { + $query = " + UPDATE Results + SET score = :score + WHERE quiz_r = :id_quiz AND user_r = :id_user + "; + + return $this -> co -> executeQuery($query, [ + 'id_quiz' => array($idQuiz, PDO::PARAM_INT), + 'id_user' => array($idUser, PDO::PARAM_INT), + 'score' => array($score, PDO::PARAM_INT) + ]); + } + + + else if (!$score && $time) + { + $query = " + UPDATE Results + SET time = :time + WHERE quiz_r = :id_quiz AND user_r = :id_user + "; + + return $this -> co -> executeQuery($query, [ + 'id_quiz' => array($idQuiz, PDO::PARAM_INT), + 'id_user' => array($idUser, PDO::PARAM_INT), + 'time' => array($time, PDO::PARAM_INT) + ]); + } + + else + { + $query = " + UPDATE Results + SET score = :score AND time = :time + WHERE quiz_r = :id_quiz AND user_r = :id_user + "; + + return $this -> co -> executeQuery($query, [ + 'id_quiz' => array($idQuiz, PDO::PARAM_INT), + 'id_user' => array($idUser, PDO::PARAM_INT), + 'score' => array($score, PDO::PARAM_INT), + 'time' => array($time, PDO::PARAM_INT) + ]); + } + + } + + } \ No newline at end of file diff --git a/src/Gateway/commentaryGateway.php b/src/Gateway/commentaryGateway.php index dee084a..0dd7be2 100644 --- a/src/Gateway/commentaryGateway.php +++ b/src/Gateway/commentaryGateway.php @@ -1,55 +1,55 @@ -co = $co; - } - - public function create(commentaryEntity $c) :bool { - - $query="INSERT INTO Commentary VALUES(:id_comment, :comment , :date)"; - - return $this -> co -> executeQuery($query, array( - "id_comment" => array($c->getIdComment(), PDO::PARAM_INT), - "comment" => array($c->getComment(), PDO::PARAM_STR), - "date" => array($c->getDate(), PDO::PARAM_STR))); - } - - public function findById(int $id) : ?commentaryEntity { - - $query="SELECT * FROM Commentary WHERE id_comment = :id_comment"; - - $this -> co -> executeQuery($query, array("id_comment" => $id)); - return $res = $this -> co -> getResults(); - } - - - public function findAll() : array { - $query="SELECT * FROM Commentary"; - $this -> co -> executeQuery($query); - return $res = $this -> co -> getResults(); - } - - public function delete(int $id) : bool { - $query="DELETE FROM Commentary WHERE id_comment = :id_comment"; - return $this -> co -> executeQuery($query, array("id_comment" => $id)); - - } - - public function update(commentaryEntity $c) : bool { - - $query="UPDATE Commentary SET comment = :comment WHERE id_comment = :id_comment"; - - return $this -> co -> executeQuery($query, array( - "comment" => array($c->getComment(),PDO::PARAM_STR), - "id_comment" => array($c->getIdComment(),PDO::PARAM_INT)) - ); - - } -} +co = $co; + } + + public function create(commentaryEntity $c) :bool { + + $query="INSERT INTO Commentary VALUES(:id_comment, :comment , :date)"; + + return $this -> co -> executeQuery($query, array( + "id_comment" => array($c->getIdComment(), PDO::PARAM_INT), + "comment" => array($c->getComment(), PDO::PARAM_STR), + "date" => array($c->getDate(), PDO::PARAM_STR))); + } + + public function findById(int $id) : ?commentaryEntity { + + $query="SELECT * FROM Commentary WHERE id_comment = :id_comment"; + + $this -> co -> executeQuery($query, array("id_comment" => $id)); + return $res = $this -> co -> getResults(); + } + + + public function findAll() : array { + $query="SELECT * FROM Commentary"; + $this -> co -> executeQuery($query); + return $res = $this -> co -> getResults(); + } + + public function delete(int $id) : bool { + $query="DELETE FROM Commentary WHERE id_comment = :id_comment"; + return $this -> co -> executeQuery($query, array("id_comment" => $id)); + + } + + public function update(commentaryEntity $c) : bool { + + $query="UPDATE Commentary SET comment = :comment WHERE id_comment = :id_comment"; + + return $this -> co -> executeQuery($query, array( + "comment" => array($c->getComment(),PDO::PARAM_STR), + "id_comment" => array($c->getIdComment(),PDO::PARAM_INT)) + ); + + } +} diff --git a/src/Gateway/quoteGateway.php b/src/Gateway/quoteGateway.php index 527bcdf..173353c 100644 --- a/src/Gateway/quoteGateway.php +++ b/src/Gateway/quoteGateway.php @@ -1,135 +1,135 @@ -con=$con; - } - - public function searchQuote(string $quote,int $numpage,string $language):array{ - - //recherche par citation - $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE content LIKE '%:quote%' AND isValid = true AND language = :language LIMIT 20 OFFSET :page*20;"; - $this->con->executeQuery($query,array(':quote' => array($quote,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR))); - $result=$this->con->getResults(); - return $result; - } - - public function searchSource(string $source,int $numpage,string $language):array{ - - //recherche par source - $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE s.title LIKE '%:source%' AND q.isValid = true AND language = :language LIMIT 20 OFFSET :page*20;"; - $this->con->executeQuery($query,array(':source' => array($source,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR))); - $result=$this->con->getResults(); - return $result; - } - - public function searchPers(string $Carac,int $numpage,string $language):array{ - - //recherche par personnage - $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE c.caracter LIKE '%:pers%' AND q.isValid = true AND language = :language LIMIT 20 OFFSET :page*20;"; - $this->con->executeQuery($query,array(':pers' => array($Pers,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR))); - $result=$this->con->getResults(); - return $result; - } - - public function searchId(string $id):array{ - - //recherche par id - $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE q.id_quote = '%:id%' AND q.isValid = true;"; - $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR))); - $result=$this->con->getResults(); - return $result; - } - - - - //======================== PARTI ADMIN ======================== - //Probablement à déplacer dans un autre fichier - - public function getQuoteIsValide():array{ - //obtenir les quotes en attentes de validation par l'admin - $query = 'SELECT * FROM Quote WHERE isValid=:bool'; - $this->con->executeQuery($query,array(':bool' => array(false, PDO::PARAM_BOOL))); - $result=$this->con->getResults(); - return $result; - } - - public function validQuote(int $id){ - //Valider la quote par l'admin - $query ='UPDATE Quote SET isValid=:newValide WHERE id_Quote=:id'; - $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT))); - } - - public function invalidQuote(int $id){ - //Invalide la quote par l'admin (suppression) - $query ='DELETE FROM Quote WHERE id_Quote=:id'; - $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT))); - } - - public function updateContent(int $id, string $newContent):array{ - //Update le contexte de quote passé en paramètre - $queryUpdate = 'UPDATE Quote SET content=:newContent WHERE id_quote=:idQuote'; - $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newContent'=> array($newContent, PDO::PARAM_STR))); - - //Renvoie le nouveau contexte de quote - $queryReponse = 'SELECT content FROM Quote WHERE id_quote=:idQuote'; - $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; - } - - public function updateTimeCode(int $id, string $newTimeCode):array{ - //Update le time code de quote passé en paramètre - $queryUpdate = 'UPDATE Quote SET timecode=:newTimeCode WHERE id_quote=:idQuote'; - $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newTimeCode'=> array($newTimeCode, PDO::PARAM_STR))); - - //Renvoie le nouveau contexte de quote - $queryReponse = 'SELECT timecode FROM Quote WHERE id_quote=:idQuote'; - $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; - } - - public function updateDate(int $id, int $newDate):array{ - //Update la date de quote passé en paramètre - $queryUpdate = 'UPDATE Source SET dateSource =:newdate WHERE idSource = (SELECT idSource FROM Quote WHERE idQuote =:idQuote)'; - $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newDate'=> array($newDate, PDO::PARAM_INT))); - - //Renvoie la nouvelle date de quote - $queryReponse = 'SELECT s.dateSource FROM Source s, Quote q WHERE id_quote=:idQuote AND s.idSource = q.idSource'; - $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; - } - - public function updateTitle(int $id, string $newTitle):array{ - //Update le titre de l'oeuvre de quote passé en paramètre - $queryUpdate = 'UPDATE Source SET title =:newTitle WHERE idSource = (SELECT idSource FROM Quote WHERE idQuote =:idQuote)'; - $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newTitle'=> array($newTitle, PDO::PARAM_STR))); - - //Renvoie le nouveau titre de quote - $queryReponse = 'SELECT s.title FROM Source s, Quote q WHERE id_quote=:idQuote AND s.idSource = q.idSource'; - $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; - } - - public function updateNameCharacter(int $id, string $newNameCharacter):array{ - //Update le personnage de l'oeuvre de quote passé en paramètre - $queryUpdate = 'UPDATE Character SET name =:newNameCharacter WHERE idCharacter = (SELECT idCharacter FROM Quote WHERE idQuote =:idQuote)'; - $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newNameCharacter'=> array($newNameCharacter, PDO::PARAM_STR))); - - //Renvoie le nouveau personnage de quote - $queryReponse = 'SELECT c.title FROM Character c, Quote q WHERE id_quote=:idQuote AND c.idCharacter = q.idCharacter'; - $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; - } - -} - -?> +con=$con; + } + + public function searchQuote(string $quote,int $numpage,string $language):array{ + + //recherche par citation + $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE content LIKE '%:quote%' AND isValid = true AND language = :language LIMIT 20 OFFSET :page*20;"; + $this->con->executeQuery($query,array(':quote' => array($quote,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR))); + $result=$this->con->getResults(); + return $result; + } + + public function searchSource(string $source,int $numpage,string $language):array{ + + //recherche par source + $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE s.title LIKE '%:source%' AND q.isValid = true AND language = :language LIMIT 20 OFFSET :page*20;"; + $this->con->executeQuery($query,array(':source' => array($source,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR))); + $result=$this->con->getResults(); + return $result; + } + + public function searchPers(string $Carac,int $numpage,string $language):array{ + + //recherche par personnage + $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE c.caracter LIKE '%:pers%' AND q.isValid = true AND language = :language LIMIT 20 OFFSET :page*20;"; + $this->con->executeQuery($query,array(':pers' => array($Pers,PDO::PARAM_STR),':page' => array($numpage,PDO::PARAM_INT),':language' => array($language,PDO::PARAM_STR))); + $result=$this->con->getResults(); + return $result; + } + + public function searchId(string $id):array{ + + //recherche par id + $query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE q.id_quote = '%:id%' AND q.isValid = true;"; + $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR))); + $result=$this->con->getResults(); + return $result; + } + + + + //======================== PARTI ADMIN ======================== + //Probablement à déplacer dans un autre fichier + + public function getQuoteIsValide():array{ + //obtenir les quotes en attentes de validation par l'admin + $query = 'SELECT * FROM Quote WHERE isValid=:bool'; + $this->con->executeQuery($query,array(':bool' => array(false, PDO::PARAM_BOOL))); + $result=$this->con->getResults(); + return $result; + } + + public function validQuote(int $id){ + //Valider la quote par l'admin + $query ='UPDATE Quote SET isValid=:newValide WHERE id_Quote=:id'; + $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT))); + } + + public function invalidQuote(int $id){ + //Invalide la quote par l'admin (suppression) + $query ='DELETE FROM Quote WHERE id_Quote=:id'; + $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT))); + } + + public function updateContent(int $id, string $newContent):array{ + //Update le contexte de quote passé en paramètre + $queryUpdate = 'UPDATE Quote SET content=:newContent WHERE id_quote=:idQuote'; + $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newContent'=> array($newContent, PDO::PARAM_STR))); + + //Renvoie le nouveau contexte de quote + $queryReponse = 'SELECT content FROM Quote WHERE id_quote=:idQuote'; + $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); + $result = $con->getResults(); + return $result; + } + + public function updateTimeCode(int $id, string $newTimeCode):array{ + //Update le time code de quote passé en paramètre + $queryUpdate = 'UPDATE Quote SET timecode=:newTimeCode WHERE id_quote=:idQuote'; + $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newTimeCode'=> array($newTimeCode, PDO::PARAM_STR))); + + //Renvoie le nouveau contexte de quote + $queryReponse = 'SELECT timecode FROM Quote WHERE id_quote=:idQuote'; + $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); + $result = $con->getResults(); + return $result; + } + + public function updateDate(int $id, int $newDate):array{ + //Update la date de quote passé en paramètre + $queryUpdate = 'UPDATE Source SET dateSource =:newdate WHERE idSource = (SELECT idSource FROM Quote WHERE idQuote =:idQuote)'; + $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newDate'=> array($newDate, PDO::PARAM_INT))); + + //Renvoie la nouvelle date de quote + $queryReponse = 'SELECT s.dateSource FROM Source s, Quote q WHERE id_quote=:idQuote AND s.idSource = q.idSource'; + $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); + $result = $con->getResults(); + return $result; + } + + public function updateTitle(int $id, string $newTitle):array{ + //Update le titre de l'oeuvre de quote passé en paramètre + $queryUpdate = 'UPDATE Source SET title =:newTitle WHERE idSource = (SELECT idSource FROM Quote WHERE idQuote =:idQuote)'; + $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newTitle'=> array($newTitle, PDO::PARAM_STR))); + + //Renvoie le nouveau titre de quote + $queryReponse = 'SELECT s.title FROM Source s, Quote q WHERE id_quote=:idQuote AND s.idSource = q.idSource'; + $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); + $result = $con->getResults(); + return $result; + } + + public function updateNameCharacter(int $id, string $newNameCharacter):array{ + //Update le personnage de l'oeuvre de quote passé en paramètre + $queryUpdate = 'UPDATE Character SET name =:newNameCharacter WHERE idCharacter = (SELECT idCharacter FROM Quote WHERE idQuote =:idQuote)'; + $con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newNameCharacter'=> array($newNameCharacter, PDO::PARAM_STR))); + + //Renvoie le nouveau personnage de quote + $queryReponse = 'SELECT c.title FROM Character c, Quote q WHERE id_quote=:idQuote AND c.idCharacter = q.idCharacter'; + $con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR))); + $result = $con->getResults(); + return $result; + } + +} + +?> diff --git a/src/Gateway/sourceGateway.php b/src/Gateway/sourceGateway.php index a9b1ce1..1b8dd08 100644 --- a/src/Gateway/sourceGateway.php +++ b/src/Gateway/sourceGateway.php @@ -1,108 +1,108 @@ - co = $co; - } - - public function create(sourceEntity $s) : bool - { - $query = " - INSERT INTO Source - VALUES(:id_source, :title, :date) - "; - - return $this -> co -> executeQuery($query, [ - "id_source" => array($s->getIdSource(), PDO::PARAM_INT), - "title" => array($s->getTitle(), PDO::PARAM_STR), - "date" => array($s->getDate(), PDO::PARAM_STR) - ]); - } - - public function findById(int $id) : array - { - $query = "SELECT * FROM Source WHERE id_source = :id"; - - $this -> co -> executeQuery($query, array("id_source" => array($id, PDO::PARAM_INT))); - return $res = $this -> co -> getResults(); - } - - public function findByTitle(string $t) : array - { - $query = "SELECT * FROM Source WHERE title = :t"; - - $this -> co -> executeQuery($query, ["title" => array($t, PDO::PARAM_STR)]); - return $res = $this -> co -> getResults(); - - // if ($res) - // return new sourceEntity( - // $res["id_source"], - // $res["title"], - // $res["date"] - // ); - // return null; - } - - public function findByDate(string $d) : array - { - $query = "SELECT * FROM Source WHERE date = :d"; - - $this -> co -> executeQuery($query, ["date" => array($d, PDO::PARAM_STR)]); - $res = $this -> co -> getResults(); - - if ($res) - return new sourceEntity( - $res["id_source"], - $res["title"], - $res["date"] - ); - return null; - } - - public function findAll() : array - { - $query = "SELECT * FROM Source"; - - $this -> co -> executeQuery($query); - $res = $this -> co -> getResults(); - - $sources = []; - - foreach ($res as $source) { - $sources[] = new sourceEntity( - $source["id_source"], - $source["title"], - $source["date"] - ); - } - return $sources; - } - - public function delete(int $id) : bool - { - $query = "DELETE FROM Source WHERE id_source = :id_s"; - - $this -> co -> executeQuery($query, ["id_s" => array($id, PDO::PARAM_INT)]); - } - - public function update(sourceEntity $s) : bool - { - $query = " - UPDATE Source - SET title = :t, date = :d - WHERE id_source = :id_s - "; - return $this->co->executeQuery($query, [ - "id_s" => array($s -> getIdSource(), PDO::PARAM_INT), - "t" => array($s -> getTitle(), PDO::PARAM_STR), - "d" => array($s -> getDate(), PDO::PARAM_STR) - ]); - } - -} + co = $co; + } + + public function create(sourceEntity $s) : bool + { + $query = " + INSERT INTO Source + VALUES(:id_source, :title, :date) + "; + + return $this -> co -> executeQuery($query, [ + "id_source" => array($s->getIdSource(), PDO::PARAM_INT), + "title" => array($s->getTitle(), PDO::PARAM_STR), + "date" => array($s->getDate(), PDO::PARAM_STR) + ]); + } + + public function findById(int $id) : array + { + $query = "SELECT * FROM Source WHERE id_source = :id"; + + $this -> co -> executeQuery($query, array("id_source" => array($id, PDO::PARAM_INT))); + return $res = $this -> co -> getResults(); + } + + public function findByTitle(string $t) : array + { + $query = "SELECT * FROM Source WHERE title = :t"; + + $this -> co -> executeQuery($query, ["title" => array($t, PDO::PARAM_STR)]); + return $res = $this -> co -> getResults(); + + // if ($res) + // return new sourceEntity( + // $res["id_source"], + // $res["title"], + // $res["date"] + // ); + // return null; + } + + public function findByDate(string $d) : array + { + $query = "SELECT * FROM Source WHERE date = :d"; + + $this -> co -> executeQuery($query, ["date" => array($d, PDO::PARAM_STR)]); + $res = $this -> co -> getResults(); + + if ($res) + return new sourceEntity( + $res["id_source"], + $res["title"], + $res["date"] + ); + return null; + } + + public function findAll() : array + { + $query = "SELECT * FROM Source"; + + $this -> co -> executeQuery($query); + $res = $this -> co -> getResults(); + + $sources = []; + + foreach ($res as $source) { + $sources[] = new sourceEntity( + $source["id_source"], + $source["title"], + $source["date"] + ); + } + return $sources; + } + + public function delete(int $id) : bool + { + $query = "DELETE FROM Source WHERE id_source = :id_s"; + + $this -> co -> executeQuery($query, ["id_s" => array($id, PDO::PARAM_INT)]); + } + + public function update(sourceEntity $s) : bool + { + $query = " + UPDATE Source + SET title = :t, date = :d + WHERE id_source = :id_s + "; + return $this->co->executeQuery($query, [ + "id_s" => array($s -> getIdSource(), PDO::PARAM_INT), + "t" => array($s -> getTitle(), PDO::PARAM_STR), + "d" => array($s -> getDate(), PDO::PARAM_STR) + ]); + } + +} diff --git a/src/Gateway/userGateway.php b/src/Gateway/userGateway.php index 4760260..44f3218 100644 --- a/src/Gateway/userGateway.php +++ b/src/Gateway/userGateway.php @@ -1,105 +1,105 @@ -con=$con; - } - - public function insert(string $username,string $email,string $passwd):string{ - - // récupération id - $query='SELECT id_user FROM Users WHERE id_user >= ALL (SELECT id_user FROM Users);'; - $this->con->executeQuery($query); - $result=$this->con->getResults(); - foreach($result as $row){ - $id=$row['id_user'] + 1; - } - // insertion user - $query='INSERT INTO Users VALUES (:id,:username,:email,:passwd,CURRENT_DATE,false);'; - $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR),':username' => array($u->username,PDO::PARAM_STR),':email' => array($u->email,PDO::PARAM_STR),':passwd' => array($u->passwd,PDO::PARAM_STR))); - return $id; - } - - public function delete(string $id) : bool{ - - // supretion user - $query='DELETE FROM Users WHERE id_user = :id;'; - return $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR))); - } - - public function getFavorite(string $id):array{ - - //obtention favoris d'un user - $query='SELECT * FROM Quote WHERE id_quote IN (SELECT id_quote IN Favorite f JOIN User u ON u.id_user = f.user WHERE id_user = :id);'; - $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR))); - $result=$this->con->getResults(); - return $result; - } - - - //obtenir les information d'un user - public function findDataUser(int $id):array{ - $query = 'SELECT * FROM Users WHERE id_user=:idUser'; - $con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; - } - - // ===================== UPDATE FUNCTION ===================== - - public function updateUsername(int $id, string $newUsername):array{ - //Update le nom du user passé en paramètre - $queryUpdate = 'UPDATE Users SET username=:newUsername WHERE id_user=:idUser'; - $con->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_STR), ':newUsername'=> array($newUsername, PDO::PARAM_STR))); - - //Renvoie le nouveau nom du user - $queryReponse = 'SELECT username FROM Users WHERE id_user=:idUser'; - $con->executeQuery($queryReponse, array($id=>array($newUsername, PDO::PARAM_STR))); - return $result; - } - - public function updateEmail(int $id, string $newEmail):array{ - //Update le email du user passé en paramètre - $queryUpdate = 'UPDATE Users SET email=:newEmail WHERE id_user=:idUser'; - $con->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_STR), ':newEmail'=> array($newEmail, PDO::PARAM_STR))); - - //Renvoie le nouveau email du user - $queryReponse = 'SELECT email FROM Users WHERE id_user=:idUser'; - $con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; - } - - public function updateImg(int $id, int $newImg):array{ - //Update l'image du user passé en paramètre - $query = 'UPDATE Users SET img=:newImg WHERE id_user=:idUser'; - $con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR), ':newImg'=> array($newImg, PDO::PARAM_STR))); - - //Renvoie la nouvelle image du user - $queryReponse = 'SELECT img FROM Users WHERE id_user=:idUser'; - $con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; - } - - public function updatePasswd(int $id, string $newPassWd):array{ - //Update le passwd du user passé en paramètre - $query = 'UPDATE Users SET pssword=:newPassWd WHERE id_user=:idUser'; - $con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR), ':newPassWd'=> array($newPassWd, PDO::PARAM_STR))); - - //Renvoie le nouveau passwd du user - $queryReponse = 'SELECT pssword FROM Users WHERE id_user=:idUser'; - $con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR))); - $result = $con->getResults(); - return $result; - } - -} - -$uG = new UserGateway(new Connection("pgsql:host=londres;dbname=dblebeaulato","lebeaulato","")); - -?> +con=$con; + } + + public function insert(string $username,string $email,string $passwd):string{ + + // récupération id + $query='SELECT id_user FROM Users WHERE id_user >= ALL (SELECT id_user FROM Users);'; + $this->con->executeQuery($query); + $result=$this->con->getResults(); + foreach($result as $row){ + $id=$row['id_user'] + 1; + } + // insertion user + $query='INSERT INTO Users VALUES (:id,:username,:email,:passwd,CURRENT_DATE,false);'; + $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR),':username' => array($u->username,PDO::PARAM_STR),':email' => array($u->email,PDO::PARAM_STR),':passwd' => array($u->passwd,PDO::PARAM_STR))); + return $id; + } + + public function delete(string $id) : bool{ + + // supretion user + $query='DELETE FROM Users WHERE id_user = :id;'; + return $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR))); + } + + public function getFavorite(string $id):array{ + + //obtention favoris d'un user + $query='SELECT * FROM Quote WHERE id_quote IN (SELECT id_quote IN Favorite f JOIN User u ON u.id_user = f.user WHERE id_user = :id);'; + $this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR))); + $result=$this->con->getResults(); + return $result; + } + + + //obtenir les information d'un user + public function findDataUser(int $id):array{ + $query = 'SELECT * FROM Users WHERE id_user=:idUser'; + $con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR))); + $result = $con->getResults(); + return $result; + } + + // ===================== UPDATE FUNCTION ===================== + + public function updateUsername(int $id, string $newUsername):array{ + //Update le nom du user passé en paramètre + $queryUpdate = 'UPDATE Users SET username=:newUsername WHERE id_user=:idUser'; + $con->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_STR), ':newUsername'=> array($newUsername, PDO::PARAM_STR))); + + //Renvoie le nouveau nom du user + $queryReponse = 'SELECT username FROM Users WHERE id_user=:idUser'; + $con->executeQuery($queryReponse, array($id=>array($newUsername, PDO::PARAM_STR))); + return $result; + } + + public function updateEmail(int $id, string $newEmail):array{ + //Update le email du user passé en paramètre + $queryUpdate = 'UPDATE Users SET email=:newEmail WHERE id_user=:idUser'; + $con->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_STR), ':newEmail'=> array($newEmail, PDO::PARAM_STR))); + + //Renvoie le nouveau email du user + $queryReponse = 'SELECT email FROM Users WHERE id_user=:idUser'; + $con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR))); + $result = $con->getResults(); + return $result; + } + + public function updateImg(int $id, int $newImg):array{ + //Update l'image du user passé en paramètre + $query = 'UPDATE Users SET img=:newImg WHERE id_user=:idUser'; + $con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR), ':newImg'=> array($newImg, PDO::PARAM_STR))); + + //Renvoie la nouvelle image du user + $queryReponse = 'SELECT img FROM Users WHERE id_user=:idUser'; + $con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR))); + $result = $con->getResults(); + return $result; + } + + public function updatePasswd(int $id, string $newPassWd):array{ + //Update le passwd du user passé en paramètre + $query = 'UPDATE Users SET pssword=:newPassWd WHERE id_user=:idUser'; + $con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR), ':newPassWd'=> array($newPassWd, PDO::PARAM_STR))); + + //Renvoie le nouveau passwd du user + $queryReponse = 'SELECT pssword FROM Users WHERE id_user=:idUser'; + $con->executeQuery($queryReponse, array(':idUser'=>array($id, PDO::PARAM_STR))); + $result = $con->getResults(); + return $result; + } + +} + +$uG = new UserGateway(new Connection("pgsql:host=londres;dbname=dblebeaulato","lebeaulato","")); + +?> diff --git a/src/Model/CharacterModel.php b/src/Model/CharacterModel.php index ab49d7e..83b12e0 100644 --- a/src/Model/CharacterModel.php +++ b/src/Model/CharacterModel.php @@ -1,74 +1,74 @@ - gateway = $gw; - } - - public function createCharacter(int $id_character, string $name , string $img_char) : bool - { - return $this -> gateway -> create($id_character, $name, $img_char); - } - - public function getCharacterById(int $id_character) : ?CharacterEntity - { - $c = $this -> gateway -> findById($id_character); - if ($c) - return new CharacterEntity( - $c['id_character'], - $c['name'], - $c['img_path'] - ); - return null; - } - - public function getCharacterByName(string $name) : ?CharacterEntity - { - $c = $this -> gateway -> findByName($name); - if ($c) - return new CharacterEntity( - $c[0]['id_character'], - $c[0]['name'], - $c[0]['img_path'] - ); - return null; - } - - public function getAllCharacters() : array - { - $c = $this -> gateway -> findAll(); - - $characters = []; - - foreach ($c as $character) - { - $characters[] = new CharacterEntity( - $character['id_character'], - $character['name'], - $character['img_path'] - ); - } - return $characters; - } - - public function deleteCharacter(int $id_character) : bool - { - return $this -> gateway -> delete($id_character); - } - - public function updateCharacter(int $id_character, string $name, string $img_char) : bool - { - return $this -> gateway -> update($id_character, $name, $img_char); - } - + gateway = $gw; + } + + public function createCharacter(int $id_character, string $name , string $img_char) : bool + { + return $this -> gateway -> create($id_character, $name, $img_char); + } + + public function getCharacterById(int $id_character) : ?CharacterEntity + { + $c = $this -> gateway -> findById($id_character); + if ($c) + return new CharacterEntity( + $c['id_character'], + $c['name'], + $c['img_path'] + ); + return null; + } + + public function getCharacterByName(string $name) : ?CharacterEntity + { + $c = $this -> gateway -> findByName($name); + if ($c) + return new CharacterEntity( + $c[0]['id_character'], + $c[0]['name'], + $c[0]['img_path'] + ); + return null; + } + + public function getAllCharacters() : array + { + $c = $this -> gateway -> findAll(); + + $characters = []; + + foreach ($c as $character) + { + $characters[] = new CharacterEntity( + $character['id_character'], + $character['name'], + $character['img_path'] + ); + } + return $characters; + } + + public function deleteCharacter(int $id_character) : bool + { + return $this -> gateway -> delete($id_character); + } + + public function updateCharacter(int $id_character, string $name, string $img_char) : bool + { + return $this -> gateway -> update($id_character, $name, $img_char); + } + } \ No newline at end of file diff --git a/src/Model/FavoriteModel.php b/src/Model/FavoriteModel.php index f9c2214..789af4f 100644 --- a/src/Model/FavoriteModel.php +++ b/src/Model/FavoriteModel.php @@ -1,71 +1,71 @@ - gw = $gw; - } - - public function createFavoriteModel(int $idUser, int $idQuote) : bool - { - return $this -> gw -> createFavoriteGateway($idUser, $idQuote); - } - - public function getFavoriteById(int $idUser, int $idQuote) : ?FavoriteEntity - { - $res = $this -> gw -> findFavoriteById($idUser, $idQuote); - - if ($res) - { - return new FavoriteEntity ( - $res[0]['user_f'], - $res[0]['quote_f'], - ); - } - return null; - } - - public function getFavoriteByUser(int $idUser) : array - { - $res = $this -> gw -> findFavoriteByUser($idUser); - - $favorites = []; - - foreach ($res as $favorite) - { - $favorites = new FavoriteEntity ( - $favorite['user_f'], - $favorite['quote_f'] - ); - } - return $favorites; - } - - public function getAllFavorite() : array - { - $res = $this -> gw -> findAllFavorite(); - - $favorites = []; - - foreach ($res as $favorite) - { - $favorites = new FavoriteEntity ( - $favorite['user_f'], - $favorite['quote_f'] - ); - } - return $favorites; - } - - public function removeFavorite(int $idUser, int $idQuote) : bool - { - return $this -> gw -> deleteFavoriteGateway($idUser, $idQuote); - } + gw = $gw; + } + + public function createFavoriteModel(int $idUser, int $idQuote) : bool + { + return $this -> gw -> createFavoriteGateway($idUser, $idQuote); + } + + public function getFavoriteById(int $idUser, int $idQuote) : ?FavoriteEntity + { + $res = $this -> gw -> findFavoriteById($idUser, $idQuote); + + if ($res) + { + return new FavoriteEntity ( + $res[0]['user_f'], + $res[0]['quote_f'], + ); + } + return null; + } + + public function getFavoriteByUser(int $idUser) : array + { + $res = $this -> gw -> findFavoriteByUser($idUser); + + $favorites = []; + + foreach ($res as $favorite) + { + $favorites = new FavoriteEntity ( + $favorite['user_f'], + $favorite['quote_f'] + ); + } + return $favorites; + } + + public function getAllFavorite() : array + { + $res = $this -> gw -> findAllFavorite(); + + $favorites = []; + + foreach ($res as $favorite) + { + $favorites = new FavoriteEntity ( + $favorite['user_f'], + $favorite['quote_f'] + ); + } + return $favorites; + } + + public function removeFavorite(int $idUser, int $idQuote) : bool + { + return $this -> gw -> deleteFavoriteGateway($idUser, $idQuote); + } } \ No newline at end of file diff --git a/src/Model/ImageModel.php b/src/Model/ImageModel.php index 8290b4f..59aba54 100644 --- a/src/Model/ImageModel.php +++ b/src/Model/ImageModel.php @@ -1,80 +1,80 @@ - gw = $gw; - } - - public function createImgModel(int $idImg, string $imgPath, bool $isImgProfile) : bool - { - return $this -> gw -> createImgGateway($idImg, $imgPath, $isImgProfile); - } - - public function getImgById(int $idImg) : ?ImageEntity - { - $res = $this -> gw -> findImgById($idImg); - - if ($res) - { - return new ImageEntity( - $res[0]['id_image'], - $res[0]['img_path'], - $res[0]['is_img_prfl'] - ); - } - return null; - } - - public function getAllImg() : array - { - $res = $this -> gw -> findAllImg(); - - $images = []; - - foreach ($res as $img) - { - $images[] = new ImageEntity( - $img['id_image'], - $img['img_path'], - $img['is_img_prfl'] - ); - } - return $images; - } - - public function getAllImgProfile() : array - { - $res = $this -> gw -> findAllImgProfile(); - - $images = []; - - foreach ($res as $img) - { - $images[] = new ImageEntity( - $img['id_image'], - $img['img_path'], - $img['is_img_prfl'] - ); - } - return $images; - } - - public function deleteImgModel(int $idImg) : bool - { - return $this -> gw -> deleteImgGateway($idImg); - } - - public function updateImgModel(int $idImg, string $imgPath) : bool - { - return $this -> gw -> updateImgGateway($idImg, $imgPath); - } + gw = $gw; + } + + public function createImgModel(int $idImg, string $imgPath, bool $isImgProfile) : bool + { + return $this -> gw -> createImgGateway($idImg, $imgPath, $isImgProfile); + } + + public function getImgById(int $idImg) : ?ImageEntity + { + $res = $this -> gw -> findImgById($idImg); + + if ($res) + { + return new ImageEntity( + $res[0]['id_image'], + $res[0]['img_path'], + $res[0]['is_img_prfl'] + ); + } + return null; + } + + public function getAllImg() : array + { + $res = $this -> gw -> findAllImg(); + + $images = []; + + foreach ($res as $img) + { + $images[] = new ImageEntity( + $img['id_image'], + $img['img_path'], + $img['is_img_prfl'] + ); + } + return $images; + } + + public function getAllImgProfile() : array + { + $res = $this -> gw -> findAllImgProfile(); + + $images = []; + + foreach ($res as $img) + { + $images[] = new ImageEntity( + $img['id_image'], + $img['img_path'], + $img['is_img_prfl'] + ); + } + return $images; + } + + public function deleteImgModel(int $idImg) : bool + { + return $this -> gw -> deleteImgGateway($idImg); + } + + public function updateImgModel(int $idImg, string $imgPath) : bool + { + return $this -> gw -> updateImgGateway($idImg, $imgPath); + } } \ No newline at end of file diff --git a/src/Model/QuestionModel.php b/src/Model/QuestionModel.php index cbc8ba0..4aa134c 100644 --- a/src/Model/QuestionModel.php +++ b/src/Model/QuestionModel.php @@ -1,88 +1,88 @@ - gateway = $gw; - } - - public function createQuestion(int $id_question, string $question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer): bool - { - return $this -> gateway -> create($id_question, $question, $answerA, $answerB, $answerC, $answerD, $cAnswer); - - } - - public function getQuestion(int $id_question) : ?QuestionEntity - { - $q = $this -> gateway -> findById($id_question); - if ($q) - return new QuestionEntity( - $q[0]['id_question'], - $q[0]['question'], - $q[0]['answera'], - $q[0]['answerb'], - $q[0]['answerc'], - $q[0]['answerd'], - $q[0]['canswer'] - ); - return null; - } - - public function updateTextQuestion(int $id_question, string $question) : bool - { - return $this -> gateway -> updateText($id_question, $question); - } - - public function updateAnswersQuestion(int $id_question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer): bool - { - return $this -> gateway -> updateAnswers($id_question, $answerA, $answerB, $answerC, $answerD, $cAnswer); - } - - public function deleteQuestion(int $id_question) : bool - { - return $this -> gateway -> delete($id_question); - } - - public function getAllQuestions() : array - { - $q = $this -> gateway -> findAll(); - - $questions = []; - - foreach ($q as $question) { - $questions[] = new QuestionEntity( - $question['id_question'], - $question['question'], - $question['answerA'], - $question['answerB'], - $question['answerC'], - $question['answerD'], - $question['cAnswer'] - ); - } - return $questions; - } - - public function getRdmQuestion() : ?QuestionEntity - { - $q = $this -> gateway -> findRdmQuestion(); - if ($q) - return new QuestionEntity( - $q['id_question'], - $q['question'], - $q['answerA'], - $q['answerB'], - $q['answerC'], - $q['answerD'], - $q['cAnswer'] - ); - return null; - } + gateway = $gw; + } + + public function createQuestion(int $id_question, string $question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer): bool + { + return $this -> gateway -> create($id_question, $question, $answerA, $answerB, $answerC, $answerD, $cAnswer); + + } + + public function getQuestion(int $id_question) : ?QuestionEntity + { + $q = $this -> gateway -> findById($id_question); + if ($q) + return new QuestionEntity( + $q[0]['id_question'], + $q[0]['question'], + $q[0]['answera'], + $q[0]['answerb'], + $q[0]['answerc'], + $q[0]['answerd'], + $q[0]['canswer'] + ); + return null; + } + + public function updateTextQuestion(int $id_question, string $question) : bool + { + return $this -> gateway -> updateText($id_question, $question); + } + + public function updateAnswersQuestion(int $id_question, string $answerA, string $answerB, string $answerC, string $answerD, string $cAnswer): bool + { + return $this -> gateway -> updateAnswers($id_question, $answerA, $answerB, $answerC, $answerD, $cAnswer); + } + + public function deleteQuestion(int $id_question) : bool + { + return $this -> gateway -> delete($id_question); + } + + public function getAllQuestions() : array + { + $q = $this -> gateway -> findAll(); + + $questions = []; + + foreach ($q as $question) { + $questions[] = new QuestionEntity( + $question['id_question'], + $question['question'], + $question['answerA'], + $question['answerB'], + $question['answerC'], + $question['answerD'], + $question['cAnswer'] + ); + } + return $questions; + } + + public function getRdmQuestion() : ?QuestionEntity + { + $q = $this -> gateway -> findRdmQuestion(); + if ($q) + return new QuestionEntity( + $q['id_question'], + $q['question'], + $q['answerA'], + $q['answerB'], + $q['answerC'], + $q['answerD'], + $q['cAnswer'] + ); + return null; + } } \ No newline at end of file diff --git a/src/Model/QuizModel.php b/src/Model/QuizModel.php index 728d516..b643e3e 100644 --- a/src/Model/QuizModel.php +++ b/src/Model/QuizModel.php @@ -1,55 +1,55 @@ - gateway = $gw; - } - - public function createQuiz(int $id_quiz, int $nb_questions) : bool - { - return $this -> gateway -> create($id_quiz, $nb_questions); - } - - public function getQuiz(int $id_quiz): ?quizEntity - { - $q = $this -> gateway -> findQuizById($id_quiz); - if ($q) { - return new quizEntity( - $q['id_quiz'], - $q['nb_questions'], - ); - } - return null; - } - - public function deleteQuiz(int $id_quiz) : bool - { - return $this -> gateway -> delete($id_quiz); - } - - public function getAllQuiz() : array - { - $q = $this -> gateway -> findAll(); - - $quizzes = []; - - foreach ($q as $quiz) { - $quizzes[] = new quizEntity( - $quiz['id_quiz'], - $quiz['nb_questions'] - ); - } - return $quizzes; - - } - + gateway = $gw; + } + + public function createQuiz(int $id_quiz, int $nb_questions) : bool + { + return $this -> gateway -> create($id_quiz, $nb_questions); + } + + public function getQuiz(int $id_quiz): ?quizEntity + { + $q = $this -> gateway -> findQuizById($id_quiz); + if ($q) { + return new quizEntity( + $q['id_quiz'], + $q['nb_questions'], + ); + } + return null; + } + + public function deleteQuiz(int $id_quiz) : bool + { + return $this -> gateway -> delete($id_quiz); + } + + public function getAllQuiz() : array + { + $q = $this -> gateway -> findAll(); + + $quizzes = []; + + foreach ($q as $quiz) { + $quizzes[] = new quizEntity( + $quiz['id_quiz'], + $quiz['nb_questions'] + ); + } + return $quizzes; + + } + } \ No newline at end of file diff --git a/src/Model/QuizQuestionModel.php b/src/Model/QuizQuestionModel.php index 1275a30..915f95b 100644 --- a/src/Model/QuizQuestionModel.php +++ b/src/Model/QuizQuestionModel.php @@ -1,80 +1,80 @@ -gw = $gw; - } - - public function createQuizQuestion(int $idQuiz, int $idQuestion): bool - { - return $this->gw->create($idQuiz,$idQuestion); - } - - public function findQuizQuestionByIdQuiz(int $id): ?QuizQuestionEntity - { - $q = $this ->gw->findQuizQuestionByIdQuiz($id); - if ($q) { - return new QuizQuestionEntity( - $q['idQuiz'], - $q['idQuestion'], - ); - } - return null; - } - - public function getAllQuestionByQuiz(int $id, Connection $co): array - { - $q = $this->gw->findQuestionsFromQuiz($id); - - $questions = []; - $gw = new QuestionGateway($co); - $qmdl = new QuestionModel($gw); - - foreach ($q as $question){ - $questions [] = $qmdl->getQuestion($question[1]); - } - - return $questions; - } - - public function findAll(): array - { - $q = $this -> gw -> findAll(); - - $quizzes = []; - - foreach ($q as $quiz) { - $quizzes[] = new QuizQuestionEntity( - $quiz['idQuiz'], - $quiz['idQuestion'] - ); - } - return $quizzes; - } - - public function deleteQuizQuestion(int $id): bool - { - return $this -> gw -> delete($id); - } - - - - +gw = $gw; + } + + public function createQuizQuestion(int $idQuiz, int $idQuestion): bool + { + return $this->gw->create($idQuiz,$idQuestion); + } + + public function findQuizQuestionByIdQuiz(int $id): ?QuizQuestionEntity + { + $q = $this ->gw->findQuizQuestionByIdQuiz($id); + if ($q) { + return new QuizQuestionEntity( + $q['idQuiz'], + $q['idQuestion'], + ); + } + return null; + } + + public function getAllQuestionByQuiz(int $id, Connection $co): array + { + $q = $this->gw->findQuestionsFromQuiz($id); + + $questions = []; + $gw = new QuestionGateway($co); + $qmdl = new QuestionModel($gw); + + foreach ($q as $question){ + $questions [] = $qmdl->getQuestion($question[1]); + } + + return $questions; + } + + public function findAll(): array + { + $q = $this -> gw -> findAll(); + + $quizzes = []; + + foreach ($q as $quiz) { + $quizzes[] = new QuizQuestionEntity( + $quiz['idQuiz'], + $quiz['idQuestion'] + ); + } + return $quizzes; + } + + public function deleteQuizQuestion(int $id): bool + { + return $this -> gw -> delete($id); + } + + + + } \ No newline at end of file diff --git a/src/Model/ResultsModel.php b/src/Model/ResultsModel.php index c5bf118..3e717f9 100644 --- a/src/Model/ResultsModel.php +++ b/src/Model/ResultsModel.php @@ -1,96 +1,96 @@ - gw = $gw; - } - - public function createResultsModel(int $idQuiz, int $idUser, int $score, int $time) : bool - { - return $this -> gw -> createResultsGateway($idQuiz, $idUser, $score, $time); - } - - public function getResultsByQuiz(int $idQuiz) : array - { - $res = $this -> gw -> findResultsByQuiz($idQuiz); - - $results = []; - - foreach ($res as $result) - { - $results[] = new ResultsEntity ( - $result['user_r'], - $result['quiz_r'], - $result['score'], - $result['time'] - ); - } - return $results; - } - - public function getResultsByUser(int $idUser) : array - { - $res = $this -> gw -> findResultsByUser($idUser); - - $results = []; - - foreach ($res as $result) - { - $results[] = new ResultsEntity ( - $result['user_r'], - $result['quiz_r'], - $result['score'], - $result['time'] - ); - } - return $results; - } - - public function getResultsById(int $idQuiz, int $idUser) : ?ResultsEntity - { - $res = $this -> gw -> findResultsById($idQuiz, $idUser); - - if ($res) - { - return new ResultsEntity ( - $res['user_r'], - $res['quiz_r'], - $res['score'], - $res['time'] - ); - } - return null; - } - - public function getAllResults() : array - { - $res = $this -> gw -> findAllResults(); - - $results = []; - - foreach ($res as $result) - { - $results[] = new ResultsEntity ( - $result['user_r'], - $result['quiz_r'], - $result['score'], - $result['time'] - ); - } - return $results; - } - - public function updateResultsModel(int $idQuiz, int $idUser, ?int $score, ?int $time) : bool - { - return $this -> gw -> updateResults($idQuiz, $idUser, $score, $time); - } + gw = $gw; + } + + public function createResultsModel(int $idQuiz, int $idUser, int $score, int $time) : bool + { + return $this -> gw -> createResultsGateway($idQuiz, $idUser, $score, $time); + } + + public function getResultsByQuiz(int $idQuiz) : array + { + $res = $this -> gw -> findResultsByQuiz($idQuiz); + + $results = []; + + foreach ($res as $result) + { + $results[] = new ResultsEntity ( + $result['user_r'], + $result['quiz_r'], + $result['score'], + $result['time'] + ); + } + return $results; + } + + public function getResultsByUser(int $idUser) : array + { + $res = $this -> gw -> findResultsByUser($idUser); + + $results = []; + + foreach ($res as $result) + { + $results[] = new ResultsEntity ( + $result['user_r'], + $result['quiz_r'], + $result['score'], + $result['time'] + ); + } + return $results; + } + + public function getResultsById(int $idQuiz, int $idUser) : ?ResultsEntity + { + $res = $this -> gw -> findResultsById($idQuiz, $idUser); + + if ($res) + { + return new ResultsEntity ( + $res['user_r'], + $res['quiz_r'], + $res['score'], + $res['time'] + ); + } + return null; + } + + public function getAllResults() : array + { + $res = $this -> gw -> findAllResults(); + + $results = []; + + foreach ($res as $result) + { + $results[] = new ResultsEntity ( + $result['user_r'], + $result['quiz_r'], + $result['score'], + $result['time'] + ); + } + return $results; + } + + public function updateResultsModel(int $idQuiz, int $idUser, ?int $score, ?int $time) : bool + { + return $this -> gw -> updateResults($idQuiz, $idUser, $score, $time); + } } \ No newline at end of file diff --git a/src/Model/commentaryModel.php b/src/Model/commentaryModel.php index acb2156..d43379b 100644 --- a/src/Model/commentaryModel.php +++ b/src/Model/commentaryModel.php @@ -1,50 +1,50 @@ -gw = $gw; - } - - public function createComment(int $id_comment, string $comment, string $date): bool { - - $c = new CommentaryEntity($id_comment, $comment, $date); - return $this->gw->create($c); - } - - public function getComment(int $id_comment): ?commentaryEntity { - $res = $this->gw->findById($id_comment); - if($res){ - return new CommentaryEntity($res[0]["id_comment"], $res[0]["comment"], $res[0]["date"]); - } - } - - public function getComments(): array { - $res = $this->gw->findAll(); - foreach ($res as $comments) { - $com[] = new CommentaryEntity($comments["id_comment"], $comments["comment"], $comments["date"]); - } - return $com; - } - - public function deleteComment(int $id_comment): bool { - return $this -> gw -> delete($id_comment); - } - - public function updateComment(int $id_comment, string $comment): bool { - - $c = $this -> getComment($id_comment); - - if($c){ - $c -> setComment($comment); - return $this->gw -> update($c); - } - return false; - } - -} +gw = $gw; + } + + public function createComment(int $id_comment, string $comment, string $date): bool { + + $c = new CommentaryEntity($id_comment, $comment, $date); + return $this->gw->create($c); + } + + public function getComment(int $id_comment): ?commentaryEntity { + $res = $this->gw->findById($id_comment); + if($res){ + return new CommentaryEntity($res[0]["id_comment"], $res[0]["comment"], $res[0]["date"]); + } + } + + public function getComments(): array { + $res = $this->gw->findAll(); + foreach ($res as $comments) { + $com[] = new CommentaryEntity($comments["id_comment"], $comments["comment"], $comments["date"]); + } + return $com; + } + + public function deleteComment(int $id_comment): bool { + return $this -> gw -> delete($id_comment); + } + + public function updateComment(int $id_comment, string $comment): bool { + + $c = $this -> getComment($id_comment); + + if($c){ + $c -> setComment($comment); + return $this->gw -> update($c); + } + return false; + } + +} diff --git a/src/Model/quoteModel.php b/src/Model/quoteModel.php index 95867a1..2f84e0b 100644 --- a/src/Model/quoteModel.php +++ b/src/Model/quoteModel.php @@ -1,20 +1,20 @@ -gateway = $gate; - } - - public function searchId(int $id): Quote{ - $res = $this->gate->searchId($id)[0]; - return new Quote($res["q.id_quote"],$res["q.content"],$res["c.caracter"],$res["c.img_path"],$res["s.title"],$res["s.date"],$res["q.like"],$res["q.language"]); - } - } - -?> +gateway = $gate; + } + + public function searchId(int $id): Quote{ + $res = $this->gate->searchId($id)[0]; + return new Quote($res["q.id_quote"],$res["q.content"],$res["c.caracter"],$res["c.img_path"],$res["s.title"],$res["s.date"],$res["q.like"],$res["q.language"]); + } + } + +?> diff --git a/src/Model/searchModel.php b/src/Model/searchModel.php new file mode 100644 index 0000000..e69de29 diff --git a/src/Model/sourceModel.php b/src/Model/sourceModel.php index 2fc3e45..4db7509 100644 --- a/src/Model/sourceModel.php +++ b/src/Model/sourceModel.php @@ -1,85 +1,85 @@ - gateway = $gateway; - } - - public function createSource(int $id_source, string $title, string $date) : bool - { - $q = new SourceEntity($id_source , $title, $date); - - return $this -> gateway -> create($q); - } - - public function getSourceById(int $id_source) : ?SourceEntity - { - $res = $this -> gateway -> findById($id_source); - - if ($res) - return new sourceEntity( - $res[0]["id_source"], - $res[0]["title"], - $res[0]["date"] - ); - return null; - } - - public function getSourceByTitle(string $title) : array - { - $res = $this->gateway->findByTitle($title); - foreach ($res as $sources) { - $src[] = new sourceEntity( - $sources["id_source"], - $sources["title"], - $sources["date"] - ); - } - return $src; - } - - public function getSourceByDate(string $date) : array - { - $res = $this->gateway->findByDate($date); - foreach ($res as $sources) { - $src[] = new sourceEntity( - $sources["id_source"], - $sources["title"], - $sources["date"] - ); - } - return $src; - } - - public function getSources() : array - { - return $this -> gateway -> findAll(); - } - - public function deleteSource(int $id_source) : bool - { - return $this -> gateway -> delete($id_source); - } - - public function updateSource(int $id_source, string $title, string $date) : bool - { - $q = $this -> getSourceById($id_source); - - if ($q){ - $q -> setTitle($title); - $q -> setDate($date); - return $this -> gateway -> update($q); - } - return false; - } - -} - + gateway = $gateway; + } + + public function createSource(int $id_source, string $title, string $date) : bool + { + $q = new SourceEntity($id_source , $title, $date); + + return $this -> gateway -> create($q); + } + + public function getSourceById(int $id_source) : ?SourceEntity + { + $res = $this -> gateway -> findById($id_source); + + if ($res) + return new sourceEntity( + $res[0]["id_source"], + $res[0]["title"], + $res[0]["date"] + ); + return null; + } + + public function getSourceByTitle(string $title) : array + { + $res = $this->gateway->findByTitle($title); + foreach ($res as $sources) { + $src[] = new sourceEntity( + $sources["id_source"], + $sources["title"], + $sources["date"] + ); + } + return $src; + } + + public function getSourceByDate(string $date) : array + { + $res = $this->gateway->findByDate($date); + foreach ($res as $sources) { + $src[] = new sourceEntity( + $sources["id_source"], + $sources["title"], + $sources["date"] + ); + } + return $src; + } + + public function getSources() : array + { + return $this -> gateway -> findAll(); + } + + public function deleteSource(int $id_source) : bool + { + return $this -> gateway -> delete($id_source); + } + + public function updateSource(int $id_source, string $title, string $date) : bool + { + $q = $this -> getSourceById($id_source); + + if ($q){ + $q -> setTitle($title); + $q -> setDate($date); + return $this -> gateway -> update($q); + } + return false; + } + +} + diff --git a/src/Model/userModel.php b/src/Model/userModel.php index adc7012..1064b11 100644 --- a/src/Model/userModel.php +++ b/src/Model/userModel.php @@ -1,77 +1,77 @@ -gateway = $gate; - } - - public function insertUser(string $username,string $email,string $passwd) : User{ - global $rep,$image; - $id = $this->gateway->insert($username,$email,$passwd); - $u = new User($id,$usename,$passwd,$rep.$image['default'],$email); - } - - public function deletUser(string $id) : bool{ - return $this->gateway->delete($id); - } - - - // public function getFavoriteUser(string $id) : array{ - // $res = array(); - // $data = $this->gateway->getFavorite($id); - // foreach ($data as $favoris) { - // $res[] = new Quote(); - // } - // } - - public function getDataUser(int $id){ - $res = $this->gateway->findDataUser($id); - foreach($res as $sources){ - $src[] = new User( - $sources['id_user'], - $sources['username'], - $sources['pssword'], - $sources['img'], - $sources['email'] - ); - } - return $src; - } - - - public function setUsername(int $id, string $newUsername){ - $res = $this->gateway->updateUsername($id,$newUsername); - $src[] = $res[0]['username']; - - return $src; - } - - public function setEmail(int $id, string $newEmail){ - $res = $this->gateway->updateEmail($id,$newEmail); - $src[] = $res[0]['email']; - - return $src; - } - - public function setImg(int $id, int $newImg){ - $res = $this->gateway->updateImg($id,$newImg); - $src[] = $res[0]['img']; - - return $src; - } - - public function setPassWd(int $id, string $newPassWd){ - $res = $this->gateway->updatePasswd($id,$newPassWd); - $src[] = $res[0]['pssword']; - - return $src; - } - } - -?> +gateway = $gate; + } + + public function insertUser(string $username,string $email,string $passwd) : User{ + global $rep,$image; + $id = $this->gateway->insert($username,$email,$passwd); + $u = new User($id,$usename,$passwd,$rep.$image['default'],$email); + } + + public function deletUser(string $id) : bool{ + return $this->gateway->delete($id); + } + + + // public function getFavoriteUser(string $id) : array{ + // $res = array(); + // $data = $this->gateway->getFavorite($id); + // foreach ($data as $favoris) { + // $res[] = new Quote(); + // } + // } + + public function getDataUser(int $id){ + $res = $this->gateway->findDataUser($id); + foreach($res as $sources){ + $src[] = new User( + $sources['id_user'], + $sources['username'], + $sources['pssword'], + $sources['img'], + $sources['email'] + ); + } + return $src; + } + + + public function setUsername(int $id, string $newUsername){ + $res = $this->gateway->updateUsername($id,$newUsername); + $src[] = $res[0]['username']; + + return $src; + } + + public function setEmail(int $id, string $newEmail){ + $res = $this->gateway->updateEmail($id,$newEmail); + $src[] = $res[0]['email']; + + return $src; + } + + public function setImg(int $id, int $newImg){ + $res = $this->gateway->updateImg($id,$newImg); + $src[] = $res[0]['img']; + + return $src; + } + + public function setPassWd(int $id, string $newPassWd){ + $res = $this->gateway->updatePasswd($id,$newPassWd); + $src[] = $res[0]['pssword']; + + return $src; + } + } + +?> diff --git a/vendor/altorouter/altorouter/AltoRouter.php b/vendor/altorouter/altorouter/AltoRouter.php index 31aa338..1e4c180 100644 --- a/vendor/altorouter/altorouter/AltoRouter.php +++ b/vendor/altorouter/altorouter/AltoRouter.php @@ -1,302 +1,302 @@ - - -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. -*/ - -class AltoRouter -{ - - /** - * @var array Array of all routes (incl. named routes). - */ - protected $routes = []; - - /** - * @var array Array of all named routes. - */ - protected $namedRoutes = []; - - /** - * @var string Can be used to ignore leading part of the Request URL (if main file lives in subdirectory of host) - */ - protected $basePath = ''; - - /** - * @var array Array of default match types (regex helpers) - */ - protected $matchTypes = [ - 'i' => '[0-9]++', - 'a' => '[0-9A-Za-z]++', - 'h' => '[0-9A-Fa-f]++', - '*' => '.+?', - '**' => '.++', - '' => '[^/\.]++' - ]; - - /** - * Create router in one call from config. - * - * @param array $routes - * @param string $basePath - * @param array $matchTypes - * @throws Exception - */ - public function __construct(array $routes = [], $basePath = '', array $matchTypes = []) - { - $this->addRoutes($routes); - $this->setBasePath($basePath); - $this->addMatchTypes($matchTypes); - } - - /** - * Retrieves all routes. - * Useful if you want to process or display routes. - * @return array All routes. - */ - public function getRoutes() - { - return $this->routes; - } - - /** - * Add multiple routes at once from array in the following format: - * - * $routes = [ - * [$method, $route, $target, $name] - * ]; - * - * @param array $routes - * @return void - * @author Koen Punt - * @throws Exception - */ - public function addRoutes($routes) - { - if (!is_array($routes) && !$routes instanceof Traversable) { - throw new RuntimeException('Routes should be an array or an instance of Traversable'); - } - foreach ($routes as $route) { - call_user_func_array([$this, 'map'], $route); - } - } - - /** - * Set the base path. - * Useful if you are running your application from a subdirectory. - * @param string $basePath - */ - public function setBasePath($basePath) - { - $this->basePath = $basePath; - } - - /** - * Add named match types. It uses array_merge so keys can be overwritten. - * - * @param array $matchTypes The key is the name and the value is the regex. - */ - public function addMatchTypes(array $matchTypes) - { - $this->matchTypes = array_merge($this->matchTypes, $matchTypes); - } - - /** - * Map a route to a target - * - * @param string $method One of 5 HTTP Methods, or a pipe-separated list of multiple HTTP Methods (GET|POST|PATCH|PUT|DELETE) - * @param string $route The route regex, custom regex must start with an @. You can use multiple pre-set regex filters, like [i:id] - * @param mixed $target The target where this route should point to. Can be anything. - * @param string $name Optional name of this route. Supply if you want to reverse route this url in your application. - * @throws Exception - */ - public function map($method, $route, $target, $name = null) - { - - $this->routes[] = [$method, $route, $target, $name]; - - if ($name) { - if (isset($this->namedRoutes[$name])) { - throw new RuntimeException("Can not redeclare route '{$name}'"); - } - $this->namedRoutes[$name] = $route; - } - - return; - } - - /** - * Reversed routing - * - * Generate the URL for a named route. Replace regexes with supplied parameters - * - * @param string $routeName The name of the route. - * @param array @params Associative array of parameters to replace placeholders with. - * @return string The URL of the route with named parameters in place. - * @throws Exception - */ - public function generate($routeName, array $params = []) - { - - // Check if named route exists - if (!isset($this->namedRoutes[$routeName])) { - throw new RuntimeException("Route '{$routeName}' does not exist."); - } - - // Replace named parameters - $route = $this->namedRoutes[$routeName]; - - // prepend base path to route url again - $url = $this->basePath . $route; - - if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) { - foreach ($matches as $index => $match) { - list($block, $pre, $type, $param, $optional) = $match; - - if ($pre) { - $block = substr($block, 1); - } - - if (isset($params[$param])) { - // Part is found, replace for param value - $url = str_replace($block, $params[$param], $url); - } elseif ($optional && $index !== 0) { - // Only strip preceding slash if it's not at the base - $url = str_replace($pre . $block, '', $url); - } else { - // Strip match block - $url = str_replace($block, '', $url); - } - } - } - - return $url; - } - - /** - * Match a given Request Url against stored routes - * @param string $requestUrl - * @param string $requestMethod - * @return array|boolean Array with route information on success, false on failure (no match). - */ - public function match($requestUrl = null, $requestMethod = null) - { - - $params = []; - - // set Request Url if it isn't passed as parameter - if ($requestUrl === null) { - $requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'; - } - - // strip base path from request url - $requestUrl = substr($requestUrl, strlen($this->basePath)); - - // Strip query string (?a=b) from Request Url - if (($strpos = strpos($requestUrl, '?')) !== false) { - $requestUrl = substr($requestUrl, 0, $strpos); - } - - $lastRequestUrlChar = $requestUrl ? $requestUrl[strlen($requestUrl)-1] : ''; - - // set Request Method if it isn't passed as a parameter - if ($requestMethod === null) { - $requestMethod = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; - } - - foreach ($this->routes as $handler) { - list($methods, $route, $target, $name) = $handler; - - $method_match = (stripos($methods, $requestMethod) !== false); - - // Method did not match, continue to next route. - if (!$method_match) { - continue; - } - - if ($route === '*') { - // * wildcard (matches all) - $match = true; - } elseif (isset($route[0]) && $route[0] === '@') { - // @ regex delimiter - $pattern = '`' . substr($route, 1) . '`u'; - $match = preg_match($pattern, $requestUrl, $params) === 1; - } elseif (($position = strpos($route, '[')) === false) { - // No params in url, do string comparison - $match = strcmp($requestUrl, $route) === 0; - } else { - // Compare longest non-param string with url before moving on to regex - // Check if last character before param is a slash, because it could be optional if param is optional too (see https://github.com/dannyvankooten/AltoRouter/issues/241) - if (strncmp($requestUrl, $route, $position) !== 0 && ($lastRequestUrlChar === '/' || $route[$position-1] !== '/')) { - continue; - } - - $regex = $this->compileRoute($route); - $match = preg_match($regex, $requestUrl, $params) === 1; - } - - if ($match) { - if ($params) { - foreach ($params as $key => $value) { - if (is_numeric($key)) { - unset($params[$key]); - } - } - } - - return [ - 'target' => $target, - 'params' => $params, - 'name' => $name - ]; - } - } - - return false; - } - - /** - * Compile the regex for a given route (EXPENSIVE) - * @param $route - * @return string - */ - protected function compileRoute($route) - { - if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) { - $matchTypes = $this->matchTypes; - foreach ($matches as $match) { - list($block, $pre, $type, $param, $optional) = $match; - - if (isset($matchTypes[$type])) { - $type = $matchTypes[$type]; - } - if ($pre === '.') { - $pre = '\.'; - } - - $optional = $optional !== '' ? '?' : null; - - //Older versions of PCRE require the 'P' in (?P) - $pattern = '(?:' - . ($pre !== '' ? $pre : null) - . '(' - . ($param !== '' ? "?P<$param>" : null) - . $type - . ')' - . $optional - . ')' - . $optional; - - $route = str_replace($block, $pattern, $route); - } - } - return "`^$route$`u"; - } -} + + +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. +*/ + +class AltoRouter +{ + + /** + * @var array Array of all routes (incl. named routes). + */ + protected $routes = []; + + /** + * @var array Array of all named routes. + */ + protected $namedRoutes = []; + + /** + * @var string Can be used to ignore leading part of the Request URL (if main file lives in subdirectory of host) + */ + protected $basePath = ''; + + /** + * @var array Array of default match types (regex helpers) + */ + protected $matchTypes = [ + 'i' => '[0-9]++', + 'a' => '[0-9A-Za-z]++', + 'h' => '[0-9A-Fa-f]++', + '*' => '.+?', + '**' => '.++', + '' => '[^/\.]++' + ]; + + /** + * Create router in one call from config. + * + * @param array $routes + * @param string $basePath + * @param array $matchTypes + * @throws Exception + */ + public function __construct(array $routes = [], $basePath = '', array $matchTypes = []) + { + $this->addRoutes($routes); + $this->setBasePath($basePath); + $this->addMatchTypes($matchTypes); + } + + /** + * Retrieves all routes. + * Useful if you want to process or display routes. + * @return array All routes. + */ + public function getRoutes() + { + return $this->routes; + } + + /** + * Add multiple routes at once from array in the following format: + * + * $routes = [ + * [$method, $route, $target, $name] + * ]; + * + * @param array $routes + * @return void + * @author Koen Punt + * @throws Exception + */ + public function addRoutes($routes) + { + if (!is_array($routes) && !$routes instanceof Traversable) { + throw new RuntimeException('Routes should be an array or an instance of Traversable'); + } + foreach ($routes as $route) { + call_user_func_array([$this, 'map'], $route); + } + } + + /** + * Set the base path. + * Useful if you are running your application from a subdirectory. + * @param string $basePath + */ + public function setBasePath($basePath) + { + $this->basePath = $basePath; + } + + /** + * Add named match types. It uses array_merge so keys can be overwritten. + * + * @param array $matchTypes The key is the name and the value is the regex. + */ + public function addMatchTypes(array $matchTypes) + { + $this->matchTypes = array_merge($this->matchTypes, $matchTypes); + } + + /** + * Map a route to a target + * + * @param string $method One of 5 HTTP Methods, or a pipe-separated list of multiple HTTP Methods (GET|POST|PATCH|PUT|DELETE) + * @param string $route The route regex, custom regex must start with an @. You can use multiple pre-set regex filters, like [i:id] + * @param mixed $target The target where this route should point to. Can be anything. + * @param string $name Optional name of this route. Supply if you want to reverse route this url in your application. + * @throws Exception + */ + public function map($method, $route, $target, $name = null) + { + + $this->routes[] = [$method, $route, $target, $name]; + + if ($name) { + if (isset($this->namedRoutes[$name])) { + throw new RuntimeException("Can not redeclare route '{$name}'"); + } + $this->namedRoutes[$name] = $route; + } + + return; + } + + /** + * Reversed routing + * + * Generate the URL for a named route. Replace regexes with supplied parameters + * + * @param string $routeName The name of the route. + * @param array @params Associative array of parameters to replace placeholders with. + * @return string The URL of the route with named parameters in place. + * @throws Exception + */ + public function generate($routeName, array $params = []) + { + + // Check if named route exists + if (!isset($this->namedRoutes[$routeName])) { + throw new RuntimeException("Route '{$routeName}' does not exist."); + } + + // Replace named parameters + $route = $this->namedRoutes[$routeName]; + + // prepend base path to route url again + $url = $this->basePath . $route; + + if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) { + foreach ($matches as $index => $match) { + list($block, $pre, $type, $param, $optional) = $match; + + if ($pre) { + $block = substr($block, 1); + } + + if (isset($params[$param])) { + // Part is found, replace for param value + $url = str_replace($block, $params[$param], $url); + } elseif ($optional && $index !== 0) { + // Only strip preceding slash if it's not at the base + $url = str_replace($pre . $block, '', $url); + } else { + // Strip match block + $url = str_replace($block, '', $url); + } + } + } + + return $url; + } + + /** + * Match a given Request Url against stored routes + * @param string $requestUrl + * @param string $requestMethod + * @return array|boolean Array with route information on success, false on failure (no match). + */ + public function match($requestUrl = null, $requestMethod = null) + { + + $params = []; + + // set Request Url if it isn't passed as parameter + if ($requestUrl === null) { + $requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'; + } + + // strip base path from request url + $requestUrl = substr($requestUrl, strlen($this->basePath)); + + // Strip query string (?a=b) from Request Url + if (($strpos = strpos($requestUrl, '?')) !== false) { + $requestUrl = substr($requestUrl, 0, $strpos); + } + + $lastRequestUrlChar = $requestUrl ? $requestUrl[strlen($requestUrl)-1] : ''; + + // set Request Method if it isn't passed as a parameter + if ($requestMethod === null) { + $requestMethod = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; + } + + foreach ($this->routes as $handler) { + list($methods, $route, $target, $name) = $handler; + + $method_match = (stripos($methods, $requestMethod) !== false); + + // Method did not match, continue to next route. + if (!$method_match) { + continue; + } + + if ($route === '*') { + // * wildcard (matches all) + $match = true; + } elseif (isset($route[0]) && $route[0] === '@') { + // @ regex delimiter + $pattern = '`' . substr($route, 1) . '`u'; + $match = preg_match($pattern, $requestUrl, $params) === 1; + } elseif (($position = strpos($route, '[')) === false) { + // No params in url, do string comparison + $match = strcmp($requestUrl, $route) === 0; + } else { + // Compare longest non-param string with url before moving on to regex + // Check if last character before param is a slash, because it could be optional if param is optional too (see https://github.com/dannyvankooten/AltoRouter/issues/241) + if (strncmp($requestUrl, $route, $position) !== 0 && ($lastRequestUrlChar === '/' || $route[$position-1] !== '/')) { + continue; + } + + $regex = $this->compileRoute($route); + $match = preg_match($regex, $requestUrl, $params) === 1; + } + + if ($match) { + if ($params) { + foreach ($params as $key => $value) { + if (is_numeric($key)) { + unset($params[$key]); + } + } + } + + return [ + 'target' => $target, + 'params' => $params, + 'name' => $name + ]; + } + } + + return false; + } + + /** + * Compile the regex for a given route (EXPENSIVE) + * @param $route + * @return string + */ + protected function compileRoute($route) + { + if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) { + $matchTypes = $this->matchTypes; + foreach ($matches as $match) { + list($block, $pre, $type, $param, $optional) = $match; + + if (isset($matchTypes[$type])) { + $type = $matchTypes[$type]; + } + if ($pre === '.') { + $pre = '\.'; + } + + $optional = $optional !== '' ? '?' : null; + + //Older versions of PCRE require the 'P' in (?P) + $pattern = '(?:' + . ($pre !== '' ? $pre : null) + . '(' + . ($param !== '' ? "?P<$param>" : null) + . $type + . ')' + . $optional + . ')' + . $optional; + + $route = str_replace($block, $pattern, $route); + } + } + return "`^$route$`u"; + } +} diff --git a/vendor/altorouter/altorouter/LICENSE.md b/vendor/altorouter/altorouter/LICENSE.md index a1130bb..c4ca54a 100644 --- a/vendor/altorouter/altorouter/LICENSE.md +++ b/vendor/altorouter/altorouter/LICENSE.md @@ -1,9 +1,9 @@ -MIT License - -Copyright (c) 2012 Danny van Kooten - -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. - +MIT License + +Copyright (c) 2012 Danny van Kooten + +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. \ No newline at end of file diff --git a/vendor/altorouter/altorouter/README.md b/vendor/altorouter/altorouter/README.md index e985840..72c6940 100644 --- a/vendor/altorouter/altorouter/README.md +++ b/vendor/altorouter/altorouter/README.md @@ -1,56 +1,56 @@ -# AltoRouter [![Build Status](https://img.shields.io/travis/dannyvankooten/AltoRouter/master)](https://travis-ci.org/dannyvankooten/AltoRouter) [![Latest Stable Version](https://poser.pugx.org/altorouter/altorouter/v/stable.svg)](https://packagist.org/packages/altorouter/altorouter) [![License](https://poser.pugx.org/altorouter/altorouter/license.svg)](https://packagist.org/packages/altorouter/altorouter) [![Code Climate](https://codeclimate.com/github/dannyvankooten/AltoRouter/badges/gpa.svg)](https://codeclimate.com/github/dannyvankooten/AltoRouter) [![Test Coverage](https://codeclimate.com/github/dannyvankooten/AltoRouter/badges/coverage.svg)](https://codeclimate.com/github/dannyvankooten/AltoRouter) -AltoRouter is a small but powerful routing class, heavily inspired by [klein.php](https://github.com/chriso/klein.php/). - -```php -$router = new AltoRouter(); - -// map homepage -$router->map('GET', '/', function() { - require __DIR__ . '/views/home.php'; -}); - -// dynamic named route -$router->map('GET|POST', '/users/[i:id]/', function($id) { - $user = ..... - require __DIR__ . '/views/user/details.php'; -}, 'user-details'); - -// echo URL to user-details page for ID 5 -echo $router->generate('user-details', ['id' => 5]); // Output: "/users/5" -``` - -## Features - -* Can be used with all HTTP Methods -* Dynamic routing with named route parameters -* Reversed routing -* Flexible regular expression routing (inspired by [Sinatra](http://www.sinatrarb.com/)) -* Custom regexes - -## Getting started - -You need PHP >= 5.6 to use AltoRouter, although we highly recommend you [use an officially supported PHP version](https://secure.php.net/supported-versions.php) that is not EOL. - -- [Install AltoRouter](http://altorouter.com/usage/install.html) -- [Rewrite all requests to AltoRouter](http://altorouter.com/usage/rewrite-requests.html) -- [Map your routes](http://altorouter.com/usage/mapping-routes.html) -- [Match requests](http://altorouter.com/usage/matching-requests.html) -- [Process the request your preferred way](http://altorouter.com/usage/processing-requests.html) - -## Contributors -- [Danny van Kooten](https://github.com/dannyvankooten) -- [Koen Punt](https://github.com/koenpunt) -- [John Long](https://github.com/adduc) -- [Niahoo Osef](https://github.com/niahoo) - -## License - -MIT License - -Copyright (c) 2012 Danny van Kooten - -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. +# AltoRouter [![Build Status](https://img.shields.io/travis/dannyvankooten/AltoRouter/master)](https://travis-ci.org/dannyvankooten/AltoRouter) [![Latest Stable Version](https://poser.pugx.org/altorouter/altorouter/v/stable.svg)](https://packagist.org/packages/altorouter/altorouter) [![License](https://poser.pugx.org/altorouter/altorouter/license.svg)](https://packagist.org/packages/altorouter/altorouter) [![Code Climate](https://codeclimate.com/github/dannyvankooten/AltoRouter/badges/gpa.svg)](https://codeclimate.com/github/dannyvankooten/AltoRouter) [![Test Coverage](https://codeclimate.com/github/dannyvankooten/AltoRouter/badges/coverage.svg)](https://codeclimate.com/github/dannyvankooten/AltoRouter) +AltoRouter is a small but powerful routing class, heavily inspired by [klein.php](https://github.com/chriso/klein.php/). + +```php +$router = new AltoRouter(); + +// map homepage +$router->map('GET', '/', function() { + require __DIR__ . '/views/home.php'; +}); + +// dynamic named route +$router->map('GET|POST', '/users/[i:id]/', function($id) { + $user = ..... + require __DIR__ . '/views/user/details.php'; +}, 'user-details'); + +// echo URL to user-details page for ID 5 +echo $router->generate('user-details', ['id' => 5]); // Output: "/users/5" +``` + +## Features + +* Can be used with all HTTP Methods +* Dynamic routing with named route parameters +* Reversed routing +* Flexible regular expression routing (inspired by [Sinatra](http://www.sinatrarb.com/)) +* Custom regexes + +## Getting started + +You need PHP >= 5.6 to use AltoRouter, although we highly recommend you [use an officially supported PHP version](https://secure.php.net/supported-versions.php) that is not EOL. + +- [Install AltoRouter](http://altorouter.com/usage/install.html) +- [Rewrite all requests to AltoRouter](http://altorouter.com/usage/rewrite-requests.html) +- [Map your routes](http://altorouter.com/usage/mapping-routes.html) +- [Match requests](http://altorouter.com/usage/matching-requests.html) +- [Process the request your preferred way](http://altorouter.com/usage/processing-requests.html) + +## Contributors +- [Danny van Kooten](https://github.com/dannyvankooten) +- [Koen Punt](https://github.com/koenpunt) +- [John Long](https://github.com/adduc) +- [Niahoo Osef](https://github.com/niahoo) + +## License + +MIT License + +Copyright (c) 2012 Danny van Kooten + +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/altorouter/altorouter/composer.json b/vendor/altorouter/altorouter/composer.json index 285aeaf..48fea05 100644 --- a/vendor/altorouter/altorouter/composer.json +++ b/vendor/altorouter/altorouter/composer.json @@ -1,36 +1,36 @@ -{ - "name": "altorouter/altorouter", - "description": "A lightning fast router for PHP", - "keywords": ["router", "routing", "lightweight"], - "homepage": "https://github.com/dannyvankooten/AltoRouter", - "license": "MIT", - "authors": [ - { - "name": "Danny van Kooten", - "email": "dannyvankooten@gmail.com", - "homepage": "http://dannyvankooten.com/" - }, - { - "name": "Koen Punt", - "homepage": "https://github.com/koenpunt" - }, - { - "name": "niahoo", - "homepage": "https://github.com/niahoo" - } - ], - "require": { - "php": ">=5.6.0" - }, - "require-dev": { - "phpunit/phpunit": "5.7.*", - "codeclimate/php-test-reporter": "dev-master", - "squizlabs/php_codesniffer": "3.4.2" - }, - "autoload": { - "classmap": ["AltoRouter.php"] - }, - "scripts": { - "test": "vendor/bin/phpunit" - } -} +{ + "name": "altorouter/altorouter", + "description": "A lightning fast router for PHP", + "keywords": ["router", "routing", "lightweight"], + "homepage": "https://github.com/dannyvankooten/AltoRouter", + "license": "MIT", + "authors": [ + { + "name": "Danny van Kooten", + "email": "dannyvankooten@gmail.com", + "homepage": "http://dannyvankooten.com/" + }, + { + "name": "Koen Punt", + "homepage": "https://github.com/koenpunt" + }, + { + "name": "niahoo", + "homepage": "https://github.com/niahoo" + } + ], + "require": { + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "5.7.*", + "codeclimate/php-test-reporter": "dev-master", + "squizlabs/php_codesniffer": "3.4.2" + }, + "autoload": { + "classmap": ["AltoRouter.php"] + }, + "scripts": { + "test": "vendor/bin/phpunit" + } +} diff --git a/vendor/altorouter/altorouter/phpcs.xml b/vendor/altorouter/altorouter/phpcs.xml index d59cccf..34d9de5 100644 --- a/vendor/altorouter/altorouter/phpcs.xml +++ b/vendor/altorouter/altorouter/phpcs.xml @@ -1,10 +1,10 @@ - - - rules - - - tests - AltoRouter.php - examples/ - - + + + rules + + + tests + AltoRouter.php + examples/ + + diff --git a/vendor/autoload.php b/vendor/autoload.php index 8890569..d1915e7 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -1,25 +1,25 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - * @see https://www.php-fig.org/psr/psr-0/ - * @see https://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - /** @var \Closure(string):void */ - private static $includeFile; - - /** @var string|null */ - private $vendorDir; - - // PSR-4 - /** - * @var array> - */ - private $prefixLengthsPsr4 = array(); - /** - * @var array> - */ - private $prefixDirsPsr4 = array(); - /** - * @var list - */ - private $fallbackDirsPsr4 = array(); - - // PSR-0 - /** - * List of PSR-0 prefixes - * - * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) - * - * @var array>> - */ - private $prefixesPsr0 = array(); - /** - * @var list - */ - private $fallbackDirsPsr0 = array(); - - /** @var bool */ - private $useIncludePath = false; - - /** - * @var array - */ - private $classMap = array(); - - /** @var bool */ - private $classMapAuthoritative = false; - - /** - * @var array - */ - private $missingClasses = array(); - - /** @var string|null */ - private $apcuPrefix; - - /** - * @var array - */ - private static $registeredLoaders = array(); - - /** - * @param string|null $vendorDir - */ - public function __construct($vendorDir = null) - { - $this->vendorDir = $vendorDir; - self::initializeIncludeClosure(); - } - - /** - * @return array> - */ - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); - } - - return array(); - } - - /** - * @return array> - */ - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - /** - * @return list - */ - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - /** - * @return list - */ - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - /** - * @return array Array of classname => path - */ - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - * - * @return void - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param list|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - * - * @return void - */ - public function add($prefix, $paths, $prepend = false) - { - $paths = (array) $paths; - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param list|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - * - * @return void - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - $paths = (array) $paths; - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param list|string $paths The PSR-0 base directories - * - * @return void - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param list|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - * - * @return void - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - * - * @return void - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - * - * @return void - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - * - * @return void - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - * - * @return void - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - - if (null === $this->vendorDir) { - return; - } - - if ($prepend) { - self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; - } else { - unset(self::$registeredLoaders[$this->vendorDir]); - self::$registeredLoaders[$this->vendorDir] = $this; - } - } - - /** - * Unregisters this instance as an autoloader. - * - * @return void - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - - if (null !== $this->vendorDir) { - unset(self::$registeredLoaders[$this->vendorDir]); - } - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return true|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - $includeFile = self::$includeFile; - $includeFile($file); - - return true; - } - - return null; - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - /** - * Returns the currently registered loaders keyed by their corresponding vendor directories. - * - * @return array - */ - public static function getRegisteredLoaders() - { - return self::$registeredLoaders; - } - - /** - * @param string $class - * @param string $ext - * @return string|false - */ - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } - - /** - * @return void - */ - private static function initializeIncludeClosure() - { - if (self::$includeFile !== null) { - return; - } - - /** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - */ - self::$includeFile = \Closure::bind(static function($file) { - include $file; - }, null, null); - } -} + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + + // PSR-4 + /** + * @var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var list + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ + private $prefixesPsr0 = array(); + /** + * @var list + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var array + */ + private $missingClasses = array(); + + /** @var string|null */ + private $apcuPrefix; + + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return list + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return list + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return array Array of classname => path + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + $includeFile = self::$includeFile; + $includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } + + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } +} diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index 51e734a..c158fb4 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -1,359 +1,359 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer; - -use Composer\Autoload\ClassLoader; -use Composer\Semver\VersionParser; - -/** - * This class is copied in every Composer installed project and available to all - * - * See also https://getcomposer.org/doc/07-runtime.md#installed-versions - * - * To require its presence, you can require `composer-runtime-api ^2.0` - * - * @final - */ -class InstalledVersions -{ - /** - * @var mixed[]|null - * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null - */ - private static $installed; - - /** - * @var bool|null - */ - private static $canGetVendors; - - /** - * @var array[] - * @psalm-var array}> - */ - private static $installedByVendor = array(); - - /** - * Returns a list of all package names which are present, either by being installed, replaced or provided - * - * @return string[] - * @psalm-return list - */ - public static function getInstalledPackages() - { - $packages = array(); - foreach (self::getInstalled() as $installed) { - $packages[] = array_keys($installed['versions']); - } - - if (1 === \count($packages)) { - return $packages[0]; - } - - return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); - } - - /** - * Returns a list of all package names with a specific type e.g. 'library' - * - * @param string $type - * @return string[] - * @psalm-return list - */ - public static function getInstalledPackagesByType($type) - { - $packagesByType = array(); - - foreach (self::getInstalled() as $installed) { - foreach ($installed['versions'] as $name => $package) { - if (isset($package['type']) && $package['type'] === $type) { - $packagesByType[] = $name; - } - } - } - - return $packagesByType; - } - - /** - * Checks whether the given package is installed - * - * This also returns true if the package name is provided or replaced by another package - * - * @param string $packageName - * @param bool $includeDevRequirements - * @return bool - */ - public static function isInstalled($packageName, $includeDevRequirements = true) - { - foreach (self::getInstalled() as $installed) { - if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; - } - } - - return false; - } - - /** - * Checks whether the given package satisfies a version constraint - * - * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: - * - * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') - * - * @param VersionParser $parser Install composer/semver to have access to this class and functionality - * @param string $packageName - * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package - * @return bool - */ - public static function satisfies(VersionParser $parser, $packageName, $constraint) - { - $constraint = $parser->parseConstraints((string) $constraint); - $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); - - return $provided->matches($constraint); - } - - /** - * Returns a version constraint representing all the range(s) which are installed for a given package - * - * It is easier to use this via isInstalled() with the $constraint argument if you need to check - * whether a given version of a package is installed, and not just whether it exists - * - * @param string $packageName - * @return string Version constraint usable with composer/semver - */ - public static function getVersionRanges($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - $ranges = array(); - if (isset($installed['versions'][$packageName]['pretty_version'])) { - $ranges[] = $installed['versions'][$packageName]['pretty_version']; - } - if (array_key_exists('aliases', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); - } - if (array_key_exists('replaced', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); - } - if (array_key_exists('provided', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); - } - - return implode(' || ', $ranges); - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present - */ - public static function getVersion($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['version'])) { - return null; - } - - return $installed['versions'][$packageName]['version']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present - */ - public static function getPrettyVersion($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['pretty_version'])) { - return null; - } - - return $installed['versions'][$packageName]['pretty_version']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference - */ - public static function getReference($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['reference'])) { - return null; - } - - return $installed['versions'][$packageName]['reference']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. - */ - public static function getInstallPath($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @return array - * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} - */ - public static function getRootPackage() - { - $installed = self::getInstalled(); - - return $installed[0]['root']; - } - - /** - * Returns the raw installed.php data for custom implementations - * - * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. - * @return array[] - * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} - */ - public static function getRawData() - { - @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); - - if (null === self::$installed) { - // only require the installed.php file if this file is loaded from its dumped location, - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 - if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = include __DIR__ . '/installed.php'; - } else { - self::$installed = array(); - } - } - - return self::$installed; - } - - /** - * Returns the raw data of all installed.php which are currently loaded for custom implementations - * - * @return array[] - * @psalm-return list}> - */ - public static function getAllRawData() - { - return self::getInstalled(); - } - - /** - * Lets you reload the static array from another file - * - * This is only useful for complex integrations in which a project needs to use - * this class but then also needs to execute another project's autoloader in process, - * and wants to ensure both projects have access to their version of installed.php. - * - * A typical case would be PHPUnit, where it would need to make sure it reads all - * the data it needs from this class, then call reload() with - * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure - * the project in which it runs can then also use this class safely, without - * interference between PHPUnit's dependencies and the project's dependencies. - * - * @param array[] $data A vendor/composer/installed.php data set - * @return void - * - * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data - */ - public static function reload($data) - { - self::$installed = $data; - self::$installedByVendor = array(); - } - - /** - * @return array[] - * @psalm-return list}> - */ - private static function getInstalled() - { - if (null === self::$canGetVendors) { - self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); - } - - $installed = array(); - - if (self::$canGetVendors) { - foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { - if (isset(self::$installedByVendor[$vendorDir])) { - $installed[] = self::$installedByVendor[$vendorDir]; - } elseif (is_file($vendorDir.'/composer/installed.php')) { - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ - $required = require $vendorDir.'/composer/installed.php'; - $installed[] = self::$installedByVendor[$vendorDir] = $required; - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { - self::$installed = $installed[count($installed) - 1]; - } - } - } - } - - if (null === self::$installed) { - // only require the installed.php file if this file is loaded from its dumped location, - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 - if (substr(__DIR__, -8, 1) !== 'C') { - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ - $required = require __DIR__ . '/installed.php'; - self::$installed = $required; - } else { - self::$installed = array(); - } - } - - if (self::$installed !== array()) { - $installed[] = self::$installed; - } - - return $installed; - } -} + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints((string) $constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; + } else { + self::$installed = array(); + } + } + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } + + return $installed; + } +} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index f27399a..6256709 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,21 +1,21 @@ - -Copyright (c) Nils Adermann, Jordi Boggiano - -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. - + +Copyright (c) Nils Adermann, Jordi Boggiano + +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/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index f135834..18f62d5 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -1,13 +1,13 @@ - $vendorDir . '/altorouter/altorouter/AltoRouter.php', - 'CURLStringFile' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', - 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', - 'ReturnTypeWillChange' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', -); + $vendorDir . '/altorouter/altorouter/AltoRouter.php', + 'CURLStringFile' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', + 'ReturnTypeWillChange' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', +); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 7498c74..57f11ef 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -1,17 +1,17 @@ - $vendorDir . '/symfony/deprecation-contracts/function.php', - '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', - '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php', - '89efb1254ef2d1c5d80096acd12c4098' => $vendorDir . '/twig/twig/src/Resources/core.php', - 'ffecb95d45175fd40f75be8a23b34f90' => $vendorDir . '/twig/twig/src/Resources/debug.php', - 'c7baa00073ee9c61edf148c51917cfb4' => $vendorDir . '/twig/twig/src/Resources/escaper.php', - 'f844ccf1d25df8663951193c3fc307c8' => $vendorDir . '/twig/twig/src/Resources/string_loader.php', -); + $vendorDir . '/symfony/deprecation-contracts/function.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php', + '89efb1254ef2d1c5d80096acd12c4098' => $vendorDir . '/twig/twig/src/Resources/core.php', + 'ffecb95d45175fd40f75be8a23b34f90' => $vendorDir . '/twig/twig/src/Resources/debug.php', + 'c7baa00073ee9c61edf148c51917cfb4' => $vendorDir . '/twig/twig/src/Resources/escaper.php', + 'f844ccf1d25df8663951193c3fc307c8' => $vendorDir . '/twig/twig/src/Resources/string_loader.php', +); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index 15a2ff3..ff5488f 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -1,9 +1,9 @@ - array($vendorDir . '/twig/twig/src'), - 'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'), - 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), - 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), - 'Model\\' => array($baseDir . '/src/Model'), - 'Gateway\\' => array($baseDir . '/src/Gateway'), - 'Entity\\' => array($baseDir . '/src/Entity'), - 'Controleur\\' => array($baseDir . '/src/Controleur'), -); + array($vendorDir . '/twig/twig/src'), + 'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'), + 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), + 'Model\\' => array($baseDir . '/src/Model'), + 'Gateway\\' => array($baseDir . '/src/Gateway'), + 'Entity\\' => array($baseDir . '/src/Entity'), + 'Controleur\\' => array($baseDir . '/src/Controleur'), +); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index fd08c64..605d150 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -1,50 +1,50 @@ -register(true); - - $filesToLoad = \Composer\Autoload\ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$files; - $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - - require $file; - } - }, null, null); - foreach ($filesToLoad as $fileIdentifier => $file) { - $requireFile($fileIdentifier, $file); - } - - return $loader; - } -} +register(true); + + $filesToLoad = \Composer\Autoload\ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } + }, null, null); + foreach ($filesToLoad as $fileIdentifier => $file) { + $requireFile($fileIdentifier, $file); + } + + return $loader; + } +} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 269c6ef..c1bdb2a 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -1,100 +1,100 @@ - __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', - '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', - '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php', - '89efb1254ef2d1c5d80096acd12c4098' => __DIR__ . '/..' . '/twig/twig/src/Resources/core.php', - 'ffecb95d45175fd40f75be8a23b34f90' => __DIR__ . '/..' . '/twig/twig/src/Resources/debug.php', - 'c7baa00073ee9c61edf148c51917cfb4' => __DIR__ . '/..' . '/twig/twig/src/Resources/escaper.php', - 'f844ccf1d25df8663951193c3fc307c8' => __DIR__ . '/..' . '/twig/twig/src/Resources/string_loader.php', - ); - - public static $prefixLengthsPsr4 = array ( - 'T' => - array ( - 'Twig\\' => 5, - ), - 'S' => - array ( - 'Symfony\\Polyfill\\Php81\\' => 23, - 'Symfony\\Polyfill\\Mbstring\\' => 26, - 'Symfony\\Polyfill\\Ctype\\' => 23, - ), - 'M' => - array ( - 'Model\\' => 6, - ), - 'G' => - array ( - 'Gateway\\' => 8, - ), - 'E' => - array ( - 'Entity\\' => 7, - ), - 'C' => - array ( - 'Controleur\\' => 11, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'Twig\\' => - array ( - 0 => __DIR__ . '/..' . '/twig/twig/src', - ), - 'Symfony\\Polyfill\\Php81\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-php81', - ), - 'Symfony\\Polyfill\\Mbstring\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', - ), - 'Symfony\\Polyfill\\Ctype\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', - ), - 'Model\\' => - array ( - 0 => __DIR__ . '/../..' . '/src/Model', - ), - 'Gateway\\' => - array ( - 0 => __DIR__ . '/../..' . '/src/Gateway', - ), - 'Entity\\' => - array ( - 0 => __DIR__ . '/../..' . '/src/Entity', - ), - 'Controleur\\' => - array ( - 0 => __DIR__ . '/../..' . '/src/Controleur', - ), - ); - - public static $classMap = array ( - 'AltoRouter' => __DIR__ . '/..' . '/altorouter/altorouter/AltoRouter.php', - 'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', - 'ReturnTypeWillChange' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$classMap; - - }, null, ClassLoader::class); - } -} + __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php', + '89efb1254ef2d1c5d80096acd12c4098' => __DIR__ . '/..' . '/twig/twig/src/Resources/core.php', + 'ffecb95d45175fd40f75be8a23b34f90' => __DIR__ . '/..' . '/twig/twig/src/Resources/debug.php', + 'c7baa00073ee9c61edf148c51917cfb4' => __DIR__ . '/..' . '/twig/twig/src/Resources/escaper.php', + 'f844ccf1d25df8663951193c3fc307c8' => __DIR__ . '/..' . '/twig/twig/src/Resources/string_loader.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'T' => + array ( + 'Twig\\' => 5, + ), + 'S' => + array ( + 'Symfony\\Polyfill\\Php81\\' => 23, + 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Polyfill\\Ctype\\' => 23, + ), + 'M' => + array ( + 'Model\\' => 6, + ), + 'G' => + array ( + 'Gateway\\' => 8, + ), + 'E' => + array ( + 'Entity\\' => 7, + ), + 'C' => + array ( + 'Controleur\\' => 11, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Twig\\' => + array ( + 0 => __DIR__ . '/..' . '/twig/twig/src', + ), + 'Symfony\\Polyfill\\Php81\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php81', + ), + 'Symfony\\Polyfill\\Mbstring\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', + ), + 'Symfony\\Polyfill\\Ctype\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', + ), + 'Model\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Model', + ), + 'Gateway\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Gateway', + ), + 'Entity\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Entity', + ), + 'Controleur\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Controleur', + ), + ); + + public static $classMap = array ( + 'AltoRouter' => __DIR__ . '/..' . '/altorouter/altorouter/AltoRouter.php', + 'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php', + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'ReturnTypeWillChange' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit68804b2111cb6b8bf6edf66cb2b4669c::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 22903a0..cf42319 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,465 +1,465 @@ -{ - "packages": [ - { - "name": "altorouter/altorouter", - "version": "2.0.2", - "version_normalized": "2.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/dannyvankooten/AltoRouter.git", - "reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2", - "reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "require-dev": { - "codeclimate/php-test-reporter": "dev-master", - "phpunit/phpunit": "5.7.*", - "squizlabs/php_codesniffer": "3.4.2" - }, - "time": "2020-03-09T08:34:59+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "AltoRouter.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Danny van Kooten", - "email": "dannyvankooten@gmail.com", - "homepage": "http://dannyvankooten.com/" - }, - { - "name": "Koen Punt", - "homepage": "https://github.com/koenpunt" - }, - { - "name": "niahoo", - "homepage": "https://github.com/niahoo" - } - ], - "description": "A lightning fast router for PHP", - "homepage": "https://github.com/dannyvankooten/AltoRouter", - "keywords": [ - "lightweight", - "router", - "routing" - ], - "support": { - "issues": "https://github.com/dannyvankooten/AltoRouter/issues", - "source": "https://github.com/dannyvankooten/AltoRouter/tree/2.0.2" - }, - "install-path": "../altorouter/altorouter" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.5.0", - "version_normalized": "3.5.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "time": "2024-04-18T09:32:20+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "function.php" - ] - }, - "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": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.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/deprecation-contracts" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.31.0", - "version_normalized": "1.31.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "time": "2024-09-09T11:45:10+00:00", - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.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-ctype" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.31.0", - "version_normalized": "1.31.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "time": "2024-09-09T11:45:10+00:00", - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "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 the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.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-mbstring" - }, - { - "name": "symfony/polyfill-php81", - "version": "v1.31.0", - "version_normalized": "1.31.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", - "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "time": "2024-09-09T11:45:10+00:00", - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.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-php81" - }, - { - "name": "twig/twig", - "version": "v3.14.0", - "version_normalized": "3.14.0.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72", - "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72", - "shasum": "" - }, - "require": { - "php": ">=8.0.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php81": "^1.29" - }, - "require-dev": { - "psr/container": "^1.0|^2.0", - "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" - }, - "time": "2024-09-09T17:55:12+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "src/Resources/core.php", - "src/Resources/debug.php", - "src/Resources/escaper.php", - "src/Resources/string_loader.php" - ], - "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.14.0" - }, - "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, - "dev-package-names": [] -} +{ + "packages": [ + { + "name": "altorouter/altorouter", + "version": "2.0.2", + "version_normalized": "2.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/dannyvankooten/AltoRouter.git", + "reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2", + "reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "require-dev": { + "codeclimate/php-test-reporter": "dev-master", + "phpunit/phpunit": "5.7.*", + "squizlabs/php_codesniffer": "3.4.2" + }, + "time": "2020-03-09T08:34:59+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "AltoRouter.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Danny van Kooten", + "email": "dannyvankooten@gmail.com", + "homepage": "http://dannyvankooten.com/" + }, + { + "name": "Koen Punt", + "homepage": "https://github.com/koenpunt" + }, + { + "name": "niahoo", + "homepage": "https://github.com/niahoo" + } + ], + "description": "A lightning fast router for PHP", + "homepage": "https://github.com/dannyvankooten/AltoRouter", + "keywords": [ + "lightweight", + "router", + "routing" + ], + "support": { + "issues": "https://github.com/dannyvankooten/AltoRouter/issues", + "source": "https://github.com/dannyvankooten/AltoRouter/tree/2.0.2" + }, + "install-path": "../altorouter/altorouter" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.5.0", + "version_normalized": "3.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "time": "2024-04-18T09:32:20+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "function.php" + ] + }, + "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": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.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/deprecation-contracts" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.31.0", + "version_normalized": "1.31.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2024-09-09T11:45:10+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.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-ctype" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.31.0", + "version_normalized": "1.31.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2024-09-09T11:45:10+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "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 the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.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-mbstring" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.31.0", + "version_normalized": "1.31.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "time": "2024-09-09T11:45:10+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.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-php81" + }, + { + "name": "twig/twig", + "version": "v3.14.0", + "version_normalized": "3.14.0.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72", + "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php81": "^1.29" + }, + "require-dev": { + "psr/container": "^1.0|^2.0", + "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" + }, + "time": "2024-09-09T17:55:12+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/Resources/core.php", + "src/Resources/debug.php", + "src/Resources/escaper.php", + "src/Resources/string_loader.php" + ], + "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.14.0" + }, + "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, + "dev-package-names": [] +} diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index ec00410..c39e83e 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,77 +1,77 @@ - array( - 'name' => '__root__', - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', - 'reference' => '346396cf05c3a9b427a671ceaa1ed20740fa3ef6', - 'type' => 'library', - 'install_path' => __DIR__ . '/../../', - 'aliases' => array(), - 'dev' => true, - ), - 'versions' => array( - '__root__' => array( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', - 'reference' => '346396cf05c3a9b427a671ceaa1ed20740fa3ef6', - 'type' => 'library', - 'install_path' => __DIR__ . '/../../', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'altorouter/altorouter' => array( - 'pretty_version' => '2.0.2', - 'version' => '2.0.2.0', - 'reference' => 'f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2', - 'type' => 'library', - 'install_path' => __DIR__ . '/../altorouter/altorouter', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'symfony/deprecation-contracts' => array( - 'pretty_version' => 'v3.5.0', - 'version' => '3.5.0.0', - 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', - 'type' => 'library', - 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'symfony/polyfill-ctype' => array( - 'pretty_version' => 'v1.31.0', - 'version' => '1.31.0.0', - 'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638', - 'type' => 'library', - 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'symfony/polyfill-mbstring' => array( - 'pretty_version' => 'v1.31.0', - 'version' => '1.31.0.0', - 'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341', - 'type' => 'library', - 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'symfony/polyfill-php81' => array( - 'pretty_version' => 'v1.31.0', - 'version' => '1.31.0.0', - 'reference' => '4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c', - 'type' => 'library', - 'install_path' => __DIR__ . '/../symfony/polyfill-php81', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'twig/twig' => array( - 'pretty_version' => 'v3.14.0', - 'version' => '3.14.0.0', - 'reference' => '126b2c97818dbff0cdf3fbfc881aedb3d40aae72', - 'type' => 'library', - 'install_path' => __DIR__ . '/../twig/twig', - 'aliases' => array(), - 'dev_requirement' => false, - ), - ), -); + array( + 'name' => '__root__', + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'reference' => '346396cf05c3a9b427a671ceaa1ed20740fa3ef6', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => true, + ), + 'versions' => array( + '__root__' => array( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'reference' => '346396cf05c3a9b427a671ceaa1ed20740fa3ef6', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'altorouter/altorouter' => array( + 'pretty_version' => '2.0.2', + 'version' => '2.0.2.0', + 'reference' => 'f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2', + 'type' => 'library', + 'install_path' => __DIR__ . '/../altorouter/altorouter', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/deprecation-contracts' => array( + 'pretty_version' => 'v3.5.0', + 'version' => '3.5.0.0', + 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/polyfill-ctype' => array( + 'pretty_version' => 'v1.31.0', + 'version' => '1.31.0.0', + 'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/polyfill-mbstring' => array( + 'pretty_version' => 'v1.31.0', + 'version' => '1.31.0.0', + 'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/polyfill-php81' => array( + 'pretty_version' => 'v1.31.0', + 'version' => '1.31.0.0', + 'reference' => '4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-php81', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'twig/twig' => array( + 'pretty_version' => 'v3.14.0', + 'version' => '3.14.0.0', + 'reference' => '126b2c97818dbff0cdf3fbfc881aedb3d40aae72', + 'type' => 'library', + 'install_path' => __DIR__ . '/../twig/twig', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +); diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index 4c3a5d6..5ffde28 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -1,26 +1,26 @@ -= 80100)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.'; -} - -if ($issues) { - if (!headers_sent()) { - header('HTTP/1.1 500 Internal Server Error'); - } - if (!ini_get('display_errors')) { - if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { - fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); - } elseif (!headers_sent()) { - echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; - } - } - trigger_error( - 'Composer detected issues in your platform: ' . implode(' ', $issues), - E_USER_ERROR - ); -} += 80100)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/vendor/symfony/deprecation-contracts/CHANGELOG.md b/vendor/symfony/deprecation-contracts/CHANGELOG.md index 7932e26..95e92e7 100644 --- a/vendor/symfony/deprecation-contracts/CHANGELOG.md +++ b/vendor/symfony/deprecation-contracts/CHANGELOG.md @@ -1,5 +1,5 @@ -CHANGELOG -========= - -The changelog is maintained for all Symfony contracts at the following URL: -https://github.com/symfony/contracts/blob/main/CHANGELOG.md +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/deprecation-contracts/LICENSE b/vendor/symfony/deprecation-contracts/LICENSE index 0ed3a24..c0d70a9 100644 --- a/vendor/symfony/deprecation-contracts/LICENSE +++ b/vendor/symfony/deprecation-contracts/LICENSE @@ -1,19 +1,19 @@ -Copyright (c) 2020-present 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. +Copyright (c) 2020-present 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/deprecation-contracts/README.md b/vendor/symfony/deprecation-contracts/README.md index 9814864..1ca04e2 100644 --- a/vendor/symfony/deprecation-contracts/README.md +++ b/vendor/symfony/deprecation-contracts/README.md @@ -1,26 +1,26 @@ -Symfony Deprecation Contracts -============================= - -A generic function and convention to trigger deprecation notices. - -This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices. - -By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component, -the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments. - -The function requires at least 3 arguments: - - the name of the Composer package that is triggering the deprecation - - the version of the package that introduced the deprecation - - the message of the deprecation - - more arguments can be provided: they will be inserted in the message using `printf()` formatting - -Example: -```php -trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin'); -``` - -This will generate the following message: -`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` - -While not recommended, the deprecation notices can be completely ignored by declaring an empty -`function trigger_deprecation() {}` in your application. +Symfony Deprecation Contracts +============================= + +A generic function and convention to trigger deprecation notices. + +This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices. + +By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component, +the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments. + +The function requires at least 3 arguments: + - the name of the Composer package that is triggering the deprecation + - the version of the package that introduced the deprecation + - the message of the deprecation + - more arguments can be provided: they will be inserted in the message using `printf()` formatting + +Example: +```php +trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin'); +``` + +This will generate the following message: +`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` + +While not recommended, the deprecation notices can be completely ignored by declaring an empty +`function trigger_deprecation() {}` in your application. diff --git a/vendor/symfony/deprecation-contracts/composer.json b/vendor/symfony/deprecation-contracts/composer.json index ceb6c07..a665e61 100644 --- a/vendor/symfony/deprecation-contracts/composer.json +++ b/vendor/symfony/deprecation-contracts/composer.json @@ -1,35 +1,35 @@ -{ - "name": "symfony/deprecation-contracts", - "type": "library", - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.1" - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - } -} +{ + "name": "symfony/deprecation-contracts", + "type": "library", + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=8.1" + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + } +} diff --git a/vendor/symfony/deprecation-contracts/function.php b/vendor/symfony/deprecation-contracts/function.php index 2d56512..a818abf 100644 --- a/vendor/symfony/deprecation-contracts/function.php +++ b/vendor/symfony/deprecation-contracts/function.php @@ -1,27 +1,27 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (!function_exists('trigger_deprecation')) { - /** - * Triggers a silenced deprecation notice. - * - * @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 $message The message of the deprecation - * @param mixed ...$args Values to insert in the message using printf() formatting - * - * @author Nicolas Grekas - */ - function trigger_deprecation(string $package, string $version, string $message, mixed ...$args): void - { - @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); - } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (!function_exists('trigger_deprecation')) { + /** + * Triggers a silenced deprecation notice. + * + * @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 $message The message of the deprecation + * @param mixed ...$args Values to insert in the message using printf() formatting + * + * @author Nicolas Grekas + */ + function trigger_deprecation(string $package, string $version, string $message, mixed ...$args): void + { + @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); + } +} diff --git a/vendor/symfony/polyfill-ctype/Ctype.php b/vendor/symfony/polyfill-ctype/Ctype.php index ba75a2c..19c4ef3 100644 --- a/vendor/symfony/polyfill-ctype/Ctype.php +++ b/vendor/symfony/polyfill-ctype/Ctype.php @@ -1,232 +1,232 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Ctype; - -/** - * Ctype implementation through regex. - * - * @internal - * - * @author Gert de Pagter - */ -final class Ctype -{ - /** - * Returns TRUE if every character in text is either a letter or a digit, FALSE otherwise. - * - * @see https://php.net/ctype-alnum - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_alnum($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text); - } - - /** - * Returns TRUE if every character in text is a letter, FALSE otherwise. - * - * @see https://php.net/ctype-alpha - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_alpha($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text); - } - - /** - * Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise. - * - * @see https://php.net/ctype-cntrl - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_cntrl($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text); - } - - /** - * Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise. - * - * @see https://php.net/ctype-digit - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_digit($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text); - } - - /** - * Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise. - * - * @see https://php.net/ctype-graph - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_graph($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text); - } - - /** - * Returns TRUE if every character in text is a lowercase letter. - * - * @see https://php.net/ctype-lower - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_lower($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text); - } - - /** - * Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all. - * - * @see https://php.net/ctype-print - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_print($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text); - } - - /** - * Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise. - * - * @see https://php.net/ctype-punct - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_punct($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text); - } - - /** - * Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters. - * - * @see https://php.net/ctype-space - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_space($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text); - } - - /** - * Returns TRUE if every character in text is an uppercase letter. - * - * @see https://php.net/ctype-upper - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_upper($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text); - } - - /** - * Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise. - * - * @see https://php.net/ctype-xdigit - * - * @param mixed $text - * - * @return bool - */ - public static function ctype_xdigit($text) - { - $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); - - return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text); - } - - /** - * Converts integers to their char versions according to normal ctype behaviour, if needed. - * - * If an integer between -128 and 255 inclusive is provided, - * it is interpreted as the ASCII value of a single character - * (negative values have 256 added in order to allow characters in the Extended ASCII range). - * Any other integer is interpreted as a string containing the decimal digits of the integer. - * - * @param mixed $int - * @param string $function - * - * @return mixed - */ - private static function convert_int_to_char_for_ctype($int, $function) - { - if (!\is_int($int)) { - return $int; - } - - if ($int < -128 || $int > 255) { - return (string) $int; - } - - if (\PHP_VERSION_ID >= 80100) { - @trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED); - } - - if ($int < 0) { - $int += 256; - } - - return \chr($int); - } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Ctype; + +/** + * Ctype implementation through regex. + * + * @internal + * + * @author Gert de Pagter + */ +final class Ctype +{ + /** + * Returns TRUE if every character in text is either a letter or a digit, FALSE otherwise. + * + * @see https://php.net/ctype-alnum + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_alnum($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text); + } + + /** + * Returns TRUE if every character in text is a letter, FALSE otherwise. + * + * @see https://php.net/ctype-alpha + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_alpha($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text); + } + + /** + * Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise. + * + * @see https://php.net/ctype-cntrl + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_cntrl($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text); + } + + /** + * Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise. + * + * @see https://php.net/ctype-digit + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_digit($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text); + } + + /** + * Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise. + * + * @see https://php.net/ctype-graph + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_graph($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text); + } + + /** + * Returns TRUE if every character in text is a lowercase letter. + * + * @see https://php.net/ctype-lower + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_lower($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text); + } + + /** + * Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all. + * + * @see https://php.net/ctype-print + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_print($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text); + } + + /** + * Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise. + * + * @see https://php.net/ctype-punct + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_punct($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text); + } + + /** + * Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters. + * + * @see https://php.net/ctype-space + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_space($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text); + } + + /** + * Returns TRUE if every character in text is an uppercase letter. + * + * @see https://php.net/ctype-upper + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_upper($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text); + } + + /** + * Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise. + * + * @see https://php.net/ctype-xdigit + * + * @param mixed $text + * + * @return bool + */ + public static function ctype_xdigit($text) + { + $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__); + + return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text); + } + + /** + * Converts integers to their char versions according to normal ctype behaviour, if needed. + * + * If an integer between -128 and 255 inclusive is provided, + * it is interpreted as the ASCII value of a single character + * (negative values have 256 added in order to allow characters in the Extended ASCII range). + * Any other integer is interpreted as a string containing the decimal digits of the integer. + * + * @param mixed $int + * @param string $function + * + * @return mixed + */ + private static function convert_int_to_char_for_ctype($int, $function) + { + if (!\is_int($int)) { + return $int; + } + + if ($int < -128 || $int > 255) { + return (string) $int; + } + + if (\PHP_VERSION_ID >= 80100) { + @trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED); + } + + if ($int < 0) { + $int += 256; + } + + return \chr($int); + } +} diff --git a/vendor/symfony/polyfill-ctype/LICENSE b/vendor/symfony/polyfill-ctype/LICENSE index 7536cae..54df147 100644 --- a/vendor/symfony/polyfill-ctype/LICENSE +++ b/vendor/symfony/polyfill-ctype/LICENSE @@ -1,19 +1,19 @@ -Copyright (c) 2018-present 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. +Copyright (c) 2018-present 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-ctype/README.md b/vendor/symfony/polyfill-ctype/README.md index b144d03..a902d2b 100644 --- a/vendor/symfony/polyfill-ctype/README.md +++ b/vendor/symfony/polyfill-ctype/README.md @@ -1,12 +1,12 @@ -Symfony Polyfill / Ctype -======================== - -This component provides `ctype_*` functions to users who run php versions without the ctype extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). +Symfony Polyfill / Ctype +======================== + +This component provides `ctype_*` functions to users who run php versions without the ctype extension. + +More information can be found in the +[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). + +License +======= + +This library is released under the [MIT license](LICENSE). diff --git a/vendor/symfony/polyfill-ctype/bootstrap.php b/vendor/symfony/polyfill-ctype/bootstrap.php index d54524b..8acf4af 100644 --- a/vendor/symfony/polyfill-ctype/bootstrap.php +++ b/vendor/symfony/polyfill-ctype/bootstrap.php @@ -1,50 +1,50 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Ctype as p; - -if (\PHP_VERSION_ID >= 80000) { - return require __DIR__.'/bootstrap80.php'; -} - -if (!function_exists('ctype_alnum')) { - function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); } -} -if (!function_exists('ctype_alpha')) { - function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); } -} -if (!function_exists('ctype_cntrl')) { - function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); } -} -if (!function_exists('ctype_digit')) { - function ctype_digit($text) { return p\Ctype::ctype_digit($text); } -} -if (!function_exists('ctype_graph')) { - function ctype_graph($text) { return p\Ctype::ctype_graph($text); } -} -if (!function_exists('ctype_lower')) { - function ctype_lower($text) { return p\Ctype::ctype_lower($text); } -} -if (!function_exists('ctype_print')) { - function ctype_print($text) { return p\Ctype::ctype_print($text); } -} -if (!function_exists('ctype_punct')) { - function ctype_punct($text) { return p\Ctype::ctype_punct($text); } -} -if (!function_exists('ctype_space')) { - function ctype_space($text) { return p\Ctype::ctype_space($text); } -} -if (!function_exists('ctype_upper')) { - function ctype_upper($text) { return p\Ctype::ctype_upper($text); } -} -if (!function_exists('ctype_xdigit')) { - function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Ctype as p; + +if (\PHP_VERSION_ID >= 80000) { + return require __DIR__.'/bootstrap80.php'; +} + +if (!function_exists('ctype_alnum')) { + function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); } +} +if (!function_exists('ctype_alpha')) { + function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); } +} +if (!function_exists('ctype_cntrl')) { + function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); } +} +if (!function_exists('ctype_digit')) { + function ctype_digit($text) { return p\Ctype::ctype_digit($text); } +} +if (!function_exists('ctype_graph')) { + function ctype_graph($text) { return p\Ctype::ctype_graph($text); } +} +if (!function_exists('ctype_lower')) { + function ctype_lower($text) { return p\Ctype::ctype_lower($text); } +} +if (!function_exists('ctype_print')) { + function ctype_print($text) { return p\Ctype::ctype_print($text); } +} +if (!function_exists('ctype_punct')) { + function ctype_punct($text) { return p\Ctype::ctype_punct($text); } +} +if (!function_exists('ctype_space')) { + function ctype_space($text) { return p\Ctype::ctype_space($text); } +} +if (!function_exists('ctype_upper')) { + function ctype_upper($text) { return p\Ctype::ctype_upper($text); } +} +if (!function_exists('ctype_xdigit')) { + function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); } +} diff --git a/vendor/symfony/polyfill-ctype/bootstrap80.php b/vendor/symfony/polyfill-ctype/bootstrap80.php index ab2f861..cdf649c 100644 --- a/vendor/symfony/polyfill-ctype/bootstrap80.php +++ b/vendor/symfony/polyfill-ctype/bootstrap80.php @@ -1,46 +1,46 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Ctype as p; - -if (!function_exists('ctype_alnum')) { - function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); } -} -if (!function_exists('ctype_alpha')) { - function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); } -} -if (!function_exists('ctype_cntrl')) { - function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); } -} -if (!function_exists('ctype_digit')) { - function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); } -} -if (!function_exists('ctype_graph')) { - function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); } -} -if (!function_exists('ctype_lower')) { - function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); } -} -if (!function_exists('ctype_print')) { - function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); } -} -if (!function_exists('ctype_punct')) { - function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); } -} -if (!function_exists('ctype_space')) { - function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); } -} -if (!function_exists('ctype_upper')) { - function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); } -} -if (!function_exists('ctype_xdigit')) { - function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Ctype as p; + +if (!function_exists('ctype_alnum')) { + function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); } +} +if (!function_exists('ctype_alpha')) { + function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); } +} +if (!function_exists('ctype_cntrl')) { + function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); } +} +if (!function_exists('ctype_digit')) { + function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); } +} +if (!function_exists('ctype_graph')) { + function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); } +} +if (!function_exists('ctype_lower')) { + function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); } +} +if (!function_exists('ctype_print')) { + function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); } +} +if (!function_exists('ctype_punct')) { + function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); } +} +if (!function_exists('ctype_space')) { + function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); } +} +if (!function_exists('ctype_upper')) { + function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); } +} +if (!function_exists('ctype_xdigit')) { + function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); } +} diff --git a/vendor/symfony/polyfill-ctype/composer.json b/vendor/symfony/polyfill-ctype/composer.json index 131ca7a..0258984 100644 --- a/vendor/symfony/polyfill-ctype/composer.json +++ b/vendor/symfony/polyfill-ctype/composer.json @@ -1,38 +1,38 @@ -{ - "name": "symfony/polyfill-ctype", - "type": "library", - "description": "Symfony polyfill for ctype functions", - "keywords": ["polyfill", "compatibility", "portable", "ctype"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-ctype": "*" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} +{ + "name": "symfony/polyfill-ctype", + "type": "library", + "description": "Symfony polyfill for ctype functions", + "keywords": ["polyfill", "compatibility", "portable", "ctype"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" }, + "files": [ "bootstrap.php" ] + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "minimum-stability": "dev", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + } +} diff --git a/vendor/symfony/polyfill-mbstring/LICENSE b/vendor/symfony/polyfill-mbstring/LICENSE index 6e3afce..7359d02 100644 --- a/vendor/symfony/polyfill-mbstring/LICENSE +++ b/vendor/symfony/polyfill-mbstring/LICENSE @@ -1,19 +1,19 @@ -Copyright (c) 2015-present 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. +Copyright (c) 2015-present 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-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php index 3d45c9d..7064fad 100644 --- a/vendor/symfony/polyfill-mbstring/Mbstring.php +++ b/vendor/symfony/polyfill-mbstring/Mbstring.php @@ -1,1045 +1,1045 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Mbstring; - -/** - * Partial mbstring implementation in PHP, iconv based, UTF-8 centric. - * - * Implemented: - * - mb_chr - Returns a specific character from its Unicode code point - * - mb_convert_encoding - Convert character encoding - * - mb_convert_variables - Convert character code in variable(s) - * - mb_decode_mimeheader - Decode string in MIME header field - * - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED - * - mb_decode_numericentity - Decode HTML numeric string reference to character - * - mb_encode_numericentity - Encode character to HTML numeric string reference - * - mb_convert_case - Perform case folding on a string - * - mb_detect_encoding - Detect character encoding - * - mb_get_info - Get internal settings of mbstring - * - mb_http_input - Detect HTTP input character encoding - * - mb_http_output - Set/Get HTTP output character encoding - * - mb_internal_encoding - Set/Get internal character encoding - * - mb_list_encodings - Returns an array of all supported encodings - * - mb_ord - Returns the Unicode code point of a character - * - mb_output_handler - Callback function converts character encoding in output buffer - * - mb_scrub - Replaces ill-formed byte sequences with substitute characters - * - mb_strlen - Get string length - * - mb_strpos - Find position of first occurrence of string in a string - * - mb_strrpos - Find position of last occurrence of a string in a string - * - mb_str_split - Convert a string to an array - * - mb_strtolower - Make a string lowercase - * - mb_strtoupper - Make a string uppercase - * - mb_substitute_character - Set/Get substitution character - * - mb_substr - Get part of string - * - mb_stripos - Finds position of first occurrence of a string within another, case insensitive - * - mb_stristr - Finds first occurrence of a string within another, case insensitive - * - mb_strrchr - Finds the last occurrence of a character in a string within another - * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive - * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive - * - mb_strstr - Finds first occurrence of a string within another - * - mb_strwidth - Return width of string - * - mb_substr_count - Count the number of substring occurrences - * - mb_ucfirst - Make a string's first character uppercase - * - mb_lcfirst - Make a string's first character lowercase - * - mb_trim - Strip whitespace (or other characters) from the beginning and end of a string - * - mb_ltrim - Strip whitespace (or other characters) from the beginning of a string - * - mb_rtrim - Strip whitespace (or other characters) from the end of a string - * - * Not implemented: - * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more) - * - mb_ereg_* - Regular expression with multibyte support - * - mb_parse_str - Parse GET/POST/COOKIE data and set global variable - * - mb_preferred_mime_name - Get MIME charset string - * - mb_regex_encoding - Returns current encoding for multibyte regex as string - * - mb_regex_set_options - Set/Get the default options for mbregex functions - * - mb_send_mail - Send encoded mail - * - mb_split - Split multibyte string using regular expression - * - mb_strcut - Get part of string - * - mb_strimwidth - Get truncated string with specified width - * - * @author Nicolas Grekas - * - * @internal - */ -final class Mbstring -{ - public const MB_CASE_FOLD = \PHP_INT_MAX; - - private const SIMPLE_CASE_FOLD = [ - ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"], - ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], - ]; - - private static $encodingList = ['ASCII', 'UTF-8']; - private static $language = 'neutral'; - private static $internalEncoding = 'UTF-8'; - - public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) - { - if (\is_array($s)) { - $r = []; - foreach ($s as $str) { - $r[] = self::mb_convert_encoding($str, $toEncoding, $fromEncoding); - } - - return $r; - } - - if (\is_array($fromEncoding) || (null !== $fromEncoding && false !== strpos($fromEncoding, ','))) { - $fromEncoding = self::mb_detect_encoding($s, $fromEncoding); - } else { - $fromEncoding = self::getEncoding($fromEncoding); - } - - $toEncoding = self::getEncoding($toEncoding); - - if ('BASE64' === $fromEncoding) { - $s = base64_decode($s); - $fromEncoding = $toEncoding; - } - - if ('BASE64' === $toEncoding) { - return base64_encode($s); - } - - if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) { - if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) { - $fromEncoding = 'Windows-1252'; - } - if ('UTF-8' !== $fromEncoding) { - $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s); - } - - return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s); - } - - if ('HTML-ENTITIES' === $fromEncoding) { - $s = html_entity_decode($s, \ENT_COMPAT, 'UTF-8'); - $fromEncoding = 'UTF-8'; - } - - return iconv($fromEncoding, $toEncoding.'//IGNORE', $s); - } - - public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars) - { - $ok = true; - array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { - if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { - $ok = false; - } - }); - - return $ok ? $fromEncoding : false; - } - - public static function mb_decode_mimeheader($s) - { - return iconv_mime_decode($s, 2, self::$internalEncoding); - } - - public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null) - { - trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING); - } - - public static function mb_decode_numericentity($s, $convmap, $encoding = null) - { - if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { - trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); - - return null; - } - - if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) { - return false; - } - - if (null !== $encoding && !\is_scalar($encoding)) { - trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); - - return ''; // Instead of null (cf. mb_encode_numericentity). - } - - $s = (string) $s; - if ('' === $s) { - return ''; - } - - $encoding = self::getEncoding($encoding); - - if ('UTF-8' === $encoding) { - $encoding = null; - if (!preg_match('//u', $s)) { - $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); - } - } else { - $s = iconv($encoding, 'UTF-8//IGNORE', $s); - } - - $cnt = floor(\count($convmap) / 4) * 4; - - for ($i = 0; $i < $cnt; $i += 4) { - // collector_decode_htmlnumericentity ignores $convmap[$i + 3] - $convmap[$i] += $convmap[$i + 2]; - $convmap[$i + 1] += $convmap[$i + 2]; - } - - $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) { - $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1]; - for ($i = 0; $i < $cnt; $i += 4) { - if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) { - return self::mb_chr($c - $convmap[$i + 2]); - } - } - - return $m[0]; - }, $s); - - if (null === $encoding) { - return $s; - } - - return iconv('UTF-8', $encoding.'//IGNORE', $s); - } - - public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) - { - if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { - trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); - - return null; - } - - if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) { - return false; - } - - if (null !== $encoding && !\is_scalar($encoding)) { - trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); - - return null; // Instead of '' (cf. mb_decode_numericentity). - } - - if (null !== $is_hex && !\is_scalar($is_hex)) { - trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING); - - return null; - } - - $s = (string) $s; - if ('' === $s) { - return ''; - } - - $encoding = self::getEncoding($encoding); - - if ('UTF-8' === $encoding) { - $encoding = null; - if (!preg_match('//u', $s)) { - $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); - } - } else { - $s = iconv($encoding, 'UTF-8//IGNORE', $s); - } - - static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; - - $cnt = floor(\count($convmap) / 4) * 4; - $i = 0; - $len = \strlen($s); - $result = ''; - - while ($i < $len) { - $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"]; - $uchr = substr($s, $i, $ulen); - $i += $ulen; - $c = self::mb_ord($uchr); - - for ($j = 0; $j < $cnt; $j += 4) { - if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) { - $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3]; - $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';'; - continue 2; - } - } - $result .= $uchr; - } - - if (null === $encoding) { - return $result; - } - - return iconv('UTF-8', $encoding.'//IGNORE', $result); - } - - public static function mb_convert_case($s, $mode, $encoding = null) - { - $s = (string) $s; - if ('' === $s) { - return ''; - } - - $encoding = self::getEncoding($encoding); - - if ('UTF-8' === $encoding) { - $encoding = null; - if (!preg_match('//u', $s)) { - $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); - } - } else { - $s = iconv($encoding, 'UTF-8//IGNORE', $s); - } - - if (\MB_CASE_TITLE == $mode) { - static $titleRegexp = null; - if (null === $titleRegexp) { - $titleRegexp = self::getData('titleCaseRegexp'); - } - $s = preg_replace_callback($titleRegexp, [__CLASS__, 'title_case'], $s); - } else { - if (\MB_CASE_UPPER == $mode) { - static $upper = null; - if (null === $upper) { - $upper = self::getData('upperCase'); - } - $map = $upper; - } else { - if (self::MB_CASE_FOLD === $mode) { - static $caseFolding = null; - if (null === $caseFolding) { - $caseFolding = self::getData('caseFolding'); - } - $s = strtr($s, $caseFolding); - } - - static $lower = null; - if (null === $lower) { - $lower = self::getData('lowerCase'); - } - $map = $lower; - } - - static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; - - $i = 0; - $len = \strlen($s); - - while ($i < $len) { - $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"]; - $uchr = substr($s, $i, $ulen); - $i += $ulen; - - if (isset($map[$uchr])) { - $uchr = $map[$uchr]; - $nlen = \strlen($uchr); - - if ($nlen == $ulen) { - $nlen = $i; - do { - $s[--$nlen] = $uchr[--$ulen]; - } while ($ulen); - } else { - $s = substr_replace($s, $uchr, $i - $ulen, $ulen); - $len += $nlen - $ulen; - $i += $nlen - $ulen; - } - } - } - } - - if (null === $encoding) { - return $s; - } - - return iconv('UTF-8', $encoding.'//IGNORE', $s); - } - - public static function mb_internal_encoding($encoding = null) - { - if (null === $encoding) { - return self::$internalEncoding; - } - - $normalizedEncoding = self::getEncoding($encoding); - - if ('UTF-8' === $normalizedEncoding || false !== @iconv($normalizedEncoding, $normalizedEncoding, ' ')) { - self::$internalEncoding = $normalizedEncoding; - - return true; - } - - if (80000 > \PHP_VERSION_ID) { - return false; - } - - throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding)); - } - - public static function mb_language($lang = null) - { - if (null === $lang) { - return self::$language; - } - - switch ($normalizedLang = strtolower($lang)) { - case 'uni': - case 'neutral': - self::$language = $normalizedLang; - - return true; - } - - if (80000 > \PHP_VERSION_ID) { - return false; - } - - throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang)); - } - - public static function mb_list_encodings() - { - return ['UTF-8']; - } - - public static function mb_encoding_aliases($encoding) - { - switch (strtoupper($encoding)) { - case 'UTF8': - case 'UTF-8': - return ['utf8']; - } - - return false; - } - - public static function mb_check_encoding($var = null, $encoding = null) - { - if (null === $encoding) { - if (null === $var) { - return false; - } - $encoding = self::$internalEncoding; - } - - if (!\is_array($var)) { - return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var); - } - - foreach ($var as $key => $value) { - if (!self::mb_check_encoding($key, $encoding)) { - return false; - } - if (!self::mb_check_encoding($value, $encoding)) { - return false; - } - } - - return true; - } - - public static function mb_detect_encoding($str, $encodingList = null, $strict = false) - { - if (null === $encodingList) { - $encodingList = self::$encodingList; - } else { - if (!\is_array($encodingList)) { - $encodingList = array_map('trim', explode(',', $encodingList)); - } - $encodingList = array_map('strtoupper', $encodingList); - } - - foreach ($encodingList as $enc) { - switch ($enc) { - case 'ASCII': - if (!preg_match('/[\x80-\xFF]/', $str)) { - return $enc; - } - break; - - case 'UTF8': - case 'UTF-8': - if (preg_match('//u', $str)) { - return 'UTF-8'; - } - break; - - default: - if (0 === strncmp($enc, 'ISO-8859-', 9)) { - return $enc; - } - } - } - - return false; - } - - public static function mb_detect_order($encodingList = null) - { - if (null === $encodingList) { - return self::$encodingList; - } - - if (!\is_array($encodingList)) { - $encodingList = array_map('trim', explode(',', $encodingList)); - } - $encodingList = array_map('strtoupper', $encodingList); - - foreach ($encodingList as $enc) { - switch ($enc) { - default: - if (strncmp($enc, 'ISO-8859-', 9)) { - return false; - } - // no break - case 'ASCII': - case 'UTF8': - case 'UTF-8': - } - } - - self::$encodingList = $encodingList; - - return true; - } - - public static function mb_strlen($s, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return \strlen($s); - } - - return @iconv_strlen($s, $encoding); - } - - public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return strpos($haystack, $needle, $offset); - } - - $needle = (string) $needle; - if ('' === $needle) { - if (80000 > \PHP_VERSION_ID) { - trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING); - - return false; - } - - return 0; - } - - return iconv_strpos($haystack, $needle, $offset, $encoding); - } - - public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return strrpos($haystack, $needle, $offset); - } - - if ($offset != (int) $offset) { - $offset = 0; - } elseif ($offset = (int) $offset) { - if ($offset < 0) { - if (0 > $offset += self::mb_strlen($needle)) { - $haystack = self::mb_substr($haystack, 0, $offset, $encoding); - } - $offset = 0; - } else { - $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding); - } - } - - $pos = '' !== $needle || 80000 > \PHP_VERSION_ID - ? iconv_strrpos($haystack, $needle, $encoding) - : self::mb_strlen($haystack, $encoding); - - return false !== $pos ? $offset + $pos : false; - } - - public static function mb_str_split($string, $split_length = 1, $encoding = null) - { - if (null !== $string && !\is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) { - trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING); - - return null; - } - - if (1 > $split_length = (int) $split_length) { - if (80000 > \PHP_VERSION_ID) { - trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING); - - return false; - } - - throw new \ValueError('Argument #2 ($length) must be greater than 0'); - } - - if (null === $encoding) { - $encoding = mb_internal_encoding(); - } - - if ('UTF-8' === $encoding = self::getEncoding($encoding)) { - $rx = '/('; - while (65535 < $split_length) { - $rx .= '.{65535}'; - $split_length -= 65535; - } - $rx .= '.{'.$split_length.'})/us'; - - return preg_split($rx, $string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); - } - - $result = []; - $length = mb_strlen($string, $encoding); - - for ($i = 0; $i < $length; $i += $split_length) { - $result[] = mb_substr($string, $i, $split_length, $encoding); - } - - return $result; - } - - public static function mb_strtolower($s, $encoding = null) - { - return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding); - } - - public static function mb_strtoupper($s, $encoding = null) - { - return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding); - } - - public static function mb_substitute_character($c = null) - { - if (null === $c) { - return 'none'; - } - if (0 === strcasecmp($c, 'none')) { - return true; - } - if (80000 > \PHP_VERSION_ID) { - return false; - } - if (\is_int($c) || 'long' === $c || 'entity' === $c) { - return false; - } - - throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint'); - } - - public static function mb_substr($s, $start, $length = null, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return (string) substr($s, $start, null === $length ? 2147483647 : $length); - } - - if ($start < 0) { - $start = iconv_strlen($s, $encoding) + $start; - if ($start < 0) { - $start = 0; - } - } - - if (null === $length) { - $length = 2147483647; - } elseif ($length < 0) { - $length = iconv_strlen($s, $encoding) + $length - $start; - if ($length < 0) { - return ''; - } - } - - return (string) iconv_substr($s, $start, $length, $encoding); - } - - public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) - { - [$haystack, $needle] = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], [ - self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding), - self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding), - ]); - - return self::mb_strpos($haystack, $needle, $offset, $encoding); - } - - public static function mb_stristr($haystack, $needle, $part = false, $encoding = null) - { - $pos = self::mb_stripos($haystack, $needle, 0, $encoding); - - return self::getSubpart($pos, $part, $haystack, $encoding); - } - - public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - $pos = strrpos($haystack, $needle); - } else { - $needle = self::mb_substr($needle, 0, 1, $encoding); - $pos = iconv_strrpos($haystack, $needle, $encoding); - } - - return self::getSubpart($pos, $part, $haystack, $encoding); - } - - public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null) - { - $needle = self::mb_substr($needle, 0, 1, $encoding); - $pos = self::mb_strripos($haystack, $needle, $encoding); - - return self::getSubpart($pos, $part, $haystack, $encoding); - } - - public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) - { - $haystack = self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding); - $needle = self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding); - - $haystack = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $haystack); - $needle = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $needle); - - return self::mb_strrpos($haystack, $needle, $offset, $encoding); - } - - public static function mb_strstr($haystack, $needle, $part = false, $encoding = null) - { - $pos = strpos($haystack, $needle); - if (false === $pos) { - return false; - } - if ($part) { - return substr($haystack, 0, $pos); - } - - return substr($haystack, $pos); - } - - public static function mb_get_info($type = 'all') - { - $info = [ - 'internal_encoding' => self::$internalEncoding, - 'http_output' => 'pass', - 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)', - 'func_overload' => 0, - 'func_overload_list' => 'no overload', - 'mail_charset' => 'UTF-8', - 'mail_header_encoding' => 'BASE64', - 'mail_body_encoding' => 'BASE64', - 'illegal_chars' => 0, - 'encoding_translation' => 'Off', - 'language' => self::$language, - 'detect_order' => self::$encodingList, - 'substitute_character' => 'none', - 'strict_detection' => 'Off', - ]; - - if ('all' === $type) { - return $info; - } - if (isset($info[$type])) { - return $info[$type]; - } - - return false; - } - - public static function mb_http_input($type = '') - { - return false; - } - - public static function mb_http_output($encoding = null) - { - return null !== $encoding ? 'pass' === $encoding : 'pass'; - } - - public static function mb_strwidth($s, $encoding = null) - { - $encoding = self::getEncoding($encoding); - - if ('UTF-8' !== $encoding) { - $s = iconv($encoding, 'UTF-8//IGNORE', $s); - } - - $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide); - - return ($wide << 1) + iconv_strlen($s, 'UTF-8'); - } - - public static function mb_substr_count($haystack, $needle, $encoding = null) - { - return substr_count($haystack, $needle); - } - - public static function mb_output_handler($contents, $status) - { - return $contents; - } - - public static function mb_chr($code, $encoding = null) - { - if (0x80 > $code %= 0x200000) { - $s = \chr($code); - } elseif (0x800 > $code) { - $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F); - } elseif (0x10000 > $code) { - $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); - } else { - $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); - } - - if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { - $s = mb_convert_encoding($s, $encoding, 'UTF-8'); - } - - return $s; - } - - public static function mb_ord($s, $encoding = null) - { - if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { - $s = mb_convert_encoding($s, 'UTF-8', $encoding); - } - - if (1 === \strlen($s)) { - return \ord($s); - } - - $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; - if (0xF0 <= $code) { - return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80; - } - if (0xE0 <= $code) { - return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80; - } - if (0xC0 <= $code) { - return (($code - 0xC0) << 6) + $s[2] - 0x80; - } - - return $code; - } - - public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null): string - { - if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) { - throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH'); - } - - if (null === $encoding) { - $encoding = self::mb_internal_encoding(); - } else { - self::assertEncoding($encoding, 'mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given'); - } - - if (self::mb_strlen($pad_string, $encoding) <= 0) { - throw new \ValueError('mb_str_pad(): Argument #3 ($pad_string) must be a non-empty string'); - } - - $paddingRequired = $length - self::mb_strlen($string, $encoding); - - if ($paddingRequired < 1) { - return $string; - } - - switch ($pad_type) { - case \STR_PAD_LEFT: - return self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding).$string; - case \STR_PAD_RIGHT: - return $string.self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding); - default: - $leftPaddingLength = floor($paddingRequired / 2); - $rightPaddingLength = $paddingRequired - $leftPaddingLength; - - return self::mb_substr(str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding).$string.self::mb_substr(str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding); - } - } - - public static function mb_ucfirst(string $string, ?string $encoding = null): string - { - if (null === $encoding) { - $encoding = self::mb_internal_encoding(); - } else { - self::assertEncoding($encoding, 'mb_ucfirst(): Argument #2 ($encoding) must be a valid encoding, "%s" given'); - } - - $firstChar = mb_substr($string, 0, 1, $encoding); - $firstChar = mb_convert_case($firstChar, \MB_CASE_TITLE, $encoding); - - return $firstChar.mb_substr($string, 1, null, $encoding); - } - - public static function mb_lcfirst(string $string, ?string $encoding = null): string - { - if (null === $encoding) { - $encoding = self::mb_internal_encoding(); - } else { - self::assertEncoding($encoding, 'mb_lcfirst(): Argument #2 ($encoding) must be a valid encoding, "%s" given'); - } - - $firstChar = mb_substr($string, 0, 1, $encoding); - $firstChar = mb_convert_case($firstChar, \MB_CASE_LOWER, $encoding); - - return $firstChar.mb_substr($string, 1, null, $encoding); - } - - private static function getSubpart($pos, $part, $haystack, $encoding) - { - if (false === $pos) { - return false; - } - if ($part) { - return self::mb_substr($haystack, 0, $pos, $encoding); - } - - return self::mb_substr($haystack, $pos, null, $encoding); - } - - private static function html_encoding_callback(array $m) - { - $i = 1; - $entities = ''; - $m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8')); - - while (isset($m[$i])) { - if (0x80 > $m[$i]) { - $entities .= \chr($m[$i++]); - continue; - } - if (0xF0 <= $m[$i]) { - $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; - } elseif (0xE0 <= $m[$i]) { - $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; - } else { - $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80; - } - - $entities .= '&#'.$c.';'; - } - - return $entities; - } - - private static function title_case(array $s) - { - return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); - } - - private static function getData($file) - { - if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { - return require $file; - } - - return false; - } - - private static function getEncoding($encoding) - { - if (null === $encoding) { - return self::$internalEncoding; - } - - if ('UTF-8' === $encoding) { - return 'UTF-8'; - } - - $encoding = strtoupper($encoding); - - if ('8BIT' === $encoding || 'BINARY' === $encoding) { - return 'CP850'; - } - - if ('UTF8' === $encoding) { - return 'UTF-8'; - } - - return $encoding; - } - - public static function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string - { - return self::mb_internal_trim('{^[%s]+|[%1$s]+$}Du', $string, $characters, $encoding, __FUNCTION__); - } - - public static function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string - { - return self::mb_internal_trim('{^[%s]+}Du', $string, $characters, $encoding, __FUNCTION__); - } - - public static function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string - { - return self::mb_internal_trim('{[%s]+$}D', $string, $characters, $encoding, __FUNCTION__); - } - - private static function mb_internal_trim(string $regex, string $string, ?string $characters, ?string $encoding, string $function): string - { - if (null === $encoding) { - $encoding = self::mb_internal_encoding(); - } else { - self::assertEncoding($encoding, $function.'(): Argument #3 ($encoding) must be a valid encoding, "%s" given'); - } - - if ('' === $characters) { - return null === $encoding ? $string : self::mb_convert_encoding($string, $encoding); - } - - if ('UTF-8' === $encoding) { - $encoding = null; - if (!preg_match('//u', $string)) { - $string = @iconv('UTF-8', 'UTF-8//IGNORE', $string); - } - if (null !== $characters && !preg_match('//u', $characters)) { - $characters = @iconv('UTF-8', 'UTF-8//IGNORE', $characters); - } - } else { - $string = iconv($encoding, 'UTF-8//IGNORE', $string); - - if (null !== $characters) { - $characters = iconv($encoding, 'UTF-8//IGNORE', $characters); - } - } - - if (null === $characters) { - $characters = "\\0 \f\n\r\t\v\u{00A0}\u{1680}\u{2000}\u{2001}\u{2002}\u{2003}\u{2004}\u{2005}\u{2006}\u{2007}\u{2008}\u{2009}\u{200A}\u{2028}\u{2029}\u{202F}\u{205F}\u{3000}\u{0085}\u{180E}"; - } else { - $characters = preg_quote($characters); - } - - $string = preg_replace(sprintf($regex, $characters), '', $string); - - if (null === $encoding) { - return $string; - } - - return iconv('UTF-8', $encoding.'//IGNORE', $string); - } - - private static function assertEncoding(string $encoding, string $errorFormat): void - { - try { - $validEncoding = @self::mb_check_encoding('', $encoding); - } catch (\ValueError $e) { - throw new \ValueError(sprintf($errorFormat, $encoding)); - } - - // BC for PHP 7.3 and lower - if (!$validEncoding) { - throw new \ValueError(sprintf($errorFormat, $encoding)); - } - } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Mbstring; + +/** + * Partial mbstring implementation in PHP, iconv based, UTF-8 centric. + * + * Implemented: + * - mb_chr - Returns a specific character from its Unicode code point + * - mb_convert_encoding - Convert character encoding + * - mb_convert_variables - Convert character code in variable(s) + * - mb_decode_mimeheader - Decode string in MIME header field + * - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED + * - mb_decode_numericentity - Decode HTML numeric string reference to character + * - mb_encode_numericentity - Encode character to HTML numeric string reference + * - mb_convert_case - Perform case folding on a string + * - mb_detect_encoding - Detect character encoding + * - mb_get_info - Get internal settings of mbstring + * - mb_http_input - Detect HTTP input character encoding + * - mb_http_output - Set/Get HTTP output character encoding + * - mb_internal_encoding - Set/Get internal character encoding + * - mb_list_encodings - Returns an array of all supported encodings + * - mb_ord - Returns the Unicode code point of a character + * - mb_output_handler - Callback function converts character encoding in output buffer + * - mb_scrub - Replaces ill-formed byte sequences with substitute characters + * - mb_strlen - Get string length + * - mb_strpos - Find position of first occurrence of string in a string + * - mb_strrpos - Find position of last occurrence of a string in a string + * - mb_str_split - Convert a string to an array + * - mb_strtolower - Make a string lowercase + * - mb_strtoupper - Make a string uppercase + * - mb_substitute_character - Set/Get substitution character + * - mb_substr - Get part of string + * - mb_stripos - Finds position of first occurrence of a string within another, case insensitive + * - mb_stristr - Finds first occurrence of a string within another, case insensitive + * - mb_strrchr - Finds the last occurrence of a character in a string within another + * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive + * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive + * - mb_strstr - Finds first occurrence of a string within another + * - mb_strwidth - Return width of string + * - mb_substr_count - Count the number of substring occurrences + * - mb_ucfirst - Make a string's first character uppercase + * - mb_lcfirst - Make a string's first character lowercase + * - mb_trim - Strip whitespace (or other characters) from the beginning and end of a string + * - mb_ltrim - Strip whitespace (or other characters) from the beginning of a string + * - mb_rtrim - Strip whitespace (or other characters) from the end of a string + * + * Not implemented: + * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more) + * - mb_ereg_* - Regular expression with multibyte support + * - mb_parse_str - Parse GET/POST/COOKIE data and set global variable + * - mb_preferred_mime_name - Get MIME charset string + * - mb_regex_encoding - Returns current encoding for multibyte regex as string + * - mb_regex_set_options - Set/Get the default options for mbregex functions + * - mb_send_mail - Send encoded mail + * - mb_split - Split multibyte string using regular expression + * - mb_strcut - Get part of string + * - mb_strimwidth - Get truncated string with specified width + * + * @author Nicolas Grekas + * + * @internal + */ +final class Mbstring +{ + public const MB_CASE_FOLD = \PHP_INT_MAX; + + private const SIMPLE_CASE_FOLD = [ + ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"], + ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], + ]; + + private static $encodingList = ['ASCII', 'UTF-8']; + private static $language = 'neutral'; + private static $internalEncoding = 'UTF-8'; + + public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) + { + if (\is_array($s)) { + $r = []; + foreach ($s as $str) { + $r[] = self::mb_convert_encoding($str, $toEncoding, $fromEncoding); + } + + return $r; + } + + if (\is_array($fromEncoding) || (null !== $fromEncoding && false !== strpos($fromEncoding, ','))) { + $fromEncoding = self::mb_detect_encoding($s, $fromEncoding); + } else { + $fromEncoding = self::getEncoding($fromEncoding); + } + + $toEncoding = self::getEncoding($toEncoding); + + if ('BASE64' === $fromEncoding) { + $s = base64_decode($s); + $fromEncoding = $toEncoding; + } + + if ('BASE64' === $toEncoding) { + return base64_encode($s); + } + + if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) { + if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) { + $fromEncoding = 'Windows-1252'; + } + if ('UTF-8' !== $fromEncoding) { + $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s); + } + + return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s); + } + + if ('HTML-ENTITIES' === $fromEncoding) { + $s = html_entity_decode($s, \ENT_COMPAT, 'UTF-8'); + $fromEncoding = 'UTF-8'; + } + + return iconv($fromEncoding, $toEncoding.'//IGNORE', $s); + } + + public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars) + { + $ok = true; + array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { + if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { + $ok = false; + } + }); + + return $ok ? $fromEncoding : false; + } + + public static function mb_decode_mimeheader($s) + { + return iconv_mime_decode($s, 2, self::$internalEncoding); + } + + public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null) + { + trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING); + } + + public static function mb_decode_numericentity($s, $convmap, $encoding = null) + { + if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { + trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); + + return null; + } + + if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) { + return false; + } + + if (null !== $encoding && !\is_scalar($encoding)) { + trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); + + return ''; // Instead of null (cf. mb_encode_numericentity). + } + + $s = (string) $s; + if ('' === $s) { + return ''; + } + + $encoding = self::getEncoding($encoding); + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); + } + } else { + $s = iconv($encoding, 'UTF-8//IGNORE', $s); + } + + $cnt = floor(\count($convmap) / 4) * 4; + + for ($i = 0; $i < $cnt; $i += 4) { + // collector_decode_htmlnumericentity ignores $convmap[$i + 3] + $convmap[$i] += $convmap[$i + 2]; + $convmap[$i + 1] += $convmap[$i + 2]; + } + + $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) { + $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1]; + for ($i = 0; $i < $cnt; $i += 4) { + if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) { + return self::mb_chr($c - $convmap[$i + 2]); + } + } + + return $m[0]; + }, $s); + + if (null === $encoding) { + return $s; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $s); + } + + public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) + { + if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { + trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); + + return null; + } + + if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) { + return false; + } + + if (null !== $encoding && !\is_scalar($encoding)) { + trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); + + return null; // Instead of '' (cf. mb_decode_numericentity). + } + + if (null !== $is_hex && !\is_scalar($is_hex)) { + trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING); + + return null; + } + + $s = (string) $s; + if ('' === $s) { + return ''; + } + + $encoding = self::getEncoding($encoding); + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); + } + } else { + $s = iconv($encoding, 'UTF-8//IGNORE', $s); + } + + static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; + + $cnt = floor(\count($convmap) / 4) * 4; + $i = 0; + $len = \strlen($s); + $result = ''; + + while ($i < $len) { + $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"]; + $uchr = substr($s, $i, $ulen); + $i += $ulen; + $c = self::mb_ord($uchr); + + for ($j = 0; $j < $cnt; $j += 4) { + if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) { + $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3]; + $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';'; + continue 2; + } + } + $result .= $uchr; + } + + if (null === $encoding) { + return $result; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $result); + } + + public static function mb_convert_case($s, $mode, $encoding = null) + { + $s = (string) $s; + if ('' === $s) { + return ''; + } + + $encoding = self::getEncoding($encoding); + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); + } + } else { + $s = iconv($encoding, 'UTF-8//IGNORE', $s); + } + + if (\MB_CASE_TITLE == $mode) { + static $titleRegexp = null; + if (null === $titleRegexp) { + $titleRegexp = self::getData('titleCaseRegexp'); + } + $s = preg_replace_callback($titleRegexp, [__CLASS__, 'title_case'], $s); + } else { + if (\MB_CASE_UPPER == $mode) { + static $upper = null; + if (null === $upper) { + $upper = self::getData('upperCase'); + } + $map = $upper; + } else { + if (self::MB_CASE_FOLD === $mode) { + static $caseFolding = null; + if (null === $caseFolding) { + $caseFolding = self::getData('caseFolding'); + } + $s = strtr($s, $caseFolding); + } + + static $lower = null; + if (null === $lower) { + $lower = self::getData('lowerCase'); + } + $map = $lower; + } + + static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; + + $i = 0; + $len = \strlen($s); + + while ($i < $len) { + $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"]; + $uchr = substr($s, $i, $ulen); + $i += $ulen; + + if (isset($map[$uchr])) { + $uchr = $map[$uchr]; + $nlen = \strlen($uchr); + + if ($nlen == $ulen) { + $nlen = $i; + do { + $s[--$nlen] = $uchr[--$ulen]; + } while ($ulen); + } else { + $s = substr_replace($s, $uchr, $i - $ulen, $ulen); + $len += $nlen - $ulen; + $i += $nlen - $ulen; + } + } + } + } + + if (null === $encoding) { + return $s; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $s); + } + + public static function mb_internal_encoding($encoding = null) + { + if (null === $encoding) { + return self::$internalEncoding; + } + + $normalizedEncoding = self::getEncoding($encoding); + + if ('UTF-8' === $normalizedEncoding || false !== @iconv($normalizedEncoding, $normalizedEncoding, ' ')) { + self::$internalEncoding = $normalizedEncoding; + + return true; + } + + if (80000 > \PHP_VERSION_ID) { + return false; + } + + throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding)); + } + + public static function mb_language($lang = null) + { + if (null === $lang) { + return self::$language; + } + + switch ($normalizedLang = strtolower($lang)) { + case 'uni': + case 'neutral': + self::$language = $normalizedLang; + + return true; + } + + if (80000 > \PHP_VERSION_ID) { + return false; + } + + throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang)); + } + + public static function mb_list_encodings() + { + return ['UTF-8']; + } + + public static function mb_encoding_aliases($encoding) + { + switch (strtoupper($encoding)) { + case 'UTF8': + case 'UTF-8': + return ['utf8']; + } + + return false; + } + + public static function mb_check_encoding($var = null, $encoding = null) + { + if (null === $encoding) { + if (null === $var) { + return false; + } + $encoding = self::$internalEncoding; + } + + if (!\is_array($var)) { + return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var); + } + + foreach ($var as $key => $value) { + if (!self::mb_check_encoding($key, $encoding)) { + return false; + } + if (!self::mb_check_encoding($value, $encoding)) { + return false; + } + } + + return true; + } + + public static function mb_detect_encoding($str, $encodingList = null, $strict = false) + { + if (null === $encodingList) { + $encodingList = self::$encodingList; + } else { + if (!\is_array($encodingList)) { + $encodingList = array_map('trim', explode(',', $encodingList)); + } + $encodingList = array_map('strtoupper', $encodingList); + } + + foreach ($encodingList as $enc) { + switch ($enc) { + case 'ASCII': + if (!preg_match('/[\x80-\xFF]/', $str)) { + return $enc; + } + break; + + case 'UTF8': + case 'UTF-8': + if (preg_match('//u', $str)) { + return 'UTF-8'; + } + break; + + default: + if (0 === strncmp($enc, 'ISO-8859-', 9)) { + return $enc; + } + } + } + + return false; + } + + public static function mb_detect_order($encodingList = null) + { + if (null === $encodingList) { + return self::$encodingList; + } + + if (!\is_array($encodingList)) { + $encodingList = array_map('trim', explode(',', $encodingList)); + } + $encodingList = array_map('strtoupper', $encodingList); + + foreach ($encodingList as $enc) { + switch ($enc) { + default: + if (strncmp($enc, 'ISO-8859-', 9)) { + return false; + } + // no break + case 'ASCII': + case 'UTF8': + case 'UTF-8': + } + } + + self::$encodingList = $encodingList; + + return true; + } + + public static function mb_strlen($s, $encoding = null) + { + $encoding = self::getEncoding($encoding); + if ('CP850' === $encoding || 'ASCII' === $encoding) { + return \strlen($s); + } + + return @iconv_strlen($s, $encoding); + } + + public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) + { + $encoding = self::getEncoding($encoding); + if ('CP850' === $encoding || 'ASCII' === $encoding) { + return strpos($haystack, $needle, $offset); + } + + $needle = (string) $needle; + if ('' === $needle) { + if (80000 > \PHP_VERSION_ID) { + trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING); + + return false; + } + + return 0; + } + + return iconv_strpos($haystack, $needle, $offset, $encoding); + } + + public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) + { + $encoding = self::getEncoding($encoding); + if ('CP850' === $encoding || 'ASCII' === $encoding) { + return strrpos($haystack, $needle, $offset); + } + + if ($offset != (int) $offset) { + $offset = 0; + } elseif ($offset = (int) $offset) { + if ($offset < 0) { + if (0 > $offset += self::mb_strlen($needle)) { + $haystack = self::mb_substr($haystack, 0, $offset, $encoding); + } + $offset = 0; + } else { + $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding); + } + } + + $pos = '' !== $needle || 80000 > \PHP_VERSION_ID + ? iconv_strrpos($haystack, $needle, $encoding) + : self::mb_strlen($haystack, $encoding); + + return false !== $pos ? $offset + $pos : false; + } + + public static function mb_str_split($string, $split_length = 1, $encoding = null) + { + if (null !== $string && !\is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) { + trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING); + + return null; + } + + if (1 > $split_length = (int) $split_length) { + if (80000 > \PHP_VERSION_ID) { + trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING); + + return false; + } + + throw new \ValueError('Argument #2 ($length) must be greater than 0'); + } + + if (null === $encoding) { + $encoding = mb_internal_encoding(); + } + + if ('UTF-8' === $encoding = self::getEncoding($encoding)) { + $rx = '/('; + while (65535 < $split_length) { + $rx .= '.{65535}'; + $split_length -= 65535; + } + $rx .= '.{'.$split_length.'})/us'; + + return preg_split($rx, $string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); + } + + $result = []; + $length = mb_strlen($string, $encoding); + + for ($i = 0; $i < $length; $i += $split_length) { + $result[] = mb_substr($string, $i, $split_length, $encoding); + } + + return $result; + } + + public static function mb_strtolower($s, $encoding = null) + { + return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding); + } + + public static function mb_strtoupper($s, $encoding = null) + { + return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding); + } + + public static function mb_substitute_character($c = null) + { + if (null === $c) { + return 'none'; + } + if (0 === strcasecmp($c, 'none')) { + return true; + } + if (80000 > \PHP_VERSION_ID) { + return false; + } + if (\is_int($c) || 'long' === $c || 'entity' === $c) { + return false; + } + + throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint'); + } + + public static function mb_substr($s, $start, $length = null, $encoding = null) + { + $encoding = self::getEncoding($encoding); + if ('CP850' === $encoding || 'ASCII' === $encoding) { + return (string) substr($s, $start, null === $length ? 2147483647 : $length); + } + + if ($start < 0) { + $start = iconv_strlen($s, $encoding) + $start; + if ($start < 0) { + $start = 0; + } + } + + if (null === $length) { + $length = 2147483647; + } elseif ($length < 0) { + $length = iconv_strlen($s, $encoding) + $length - $start; + if ($length < 0) { + return ''; + } + } + + return (string) iconv_substr($s, $start, $length, $encoding); + } + + public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) + { + [$haystack, $needle] = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], [ + self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding), + self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding), + ]); + + return self::mb_strpos($haystack, $needle, $offset, $encoding); + } + + public static function mb_stristr($haystack, $needle, $part = false, $encoding = null) + { + $pos = self::mb_stripos($haystack, $needle, 0, $encoding); + + return self::getSubpart($pos, $part, $haystack, $encoding); + } + + public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null) + { + $encoding = self::getEncoding($encoding); + if ('CP850' === $encoding || 'ASCII' === $encoding) { + $pos = strrpos($haystack, $needle); + } else { + $needle = self::mb_substr($needle, 0, 1, $encoding); + $pos = iconv_strrpos($haystack, $needle, $encoding); + } + + return self::getSubpart($pos, $part, $haystack, $encoding); + } + + public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null) + { + $needle = self::mb_substr($needle, 0, 1, $encoding); + $pos = self::mb_strripos($haystack, $needle, $encoding); + + return self::getSubpart($pos, $part, $haystack, $encoding); + } + + public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) + { + $haystack = self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding); + $needle = self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding); + + $haystack = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $haystack); + $needle = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $needle); + + return self::mb_strrpos($haystack, $needle, $offset, $encoding); + } + + public static function mb_strstr($haystack, $needle, $part = false, $encoding = null) + { + $pos = strpos($haystack, $needle); + if (false === $pos) { + return false; + } + if ($part) { + return substr($haystack, 0, $pos); + } + + return substr($haystack, $pos); + } + + public static function mb_get_info($type = 'all') + { + $info = [ + 'internal_encoding' => self::$internalEncoding, + 'http_output' => 'pass', + 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)', + 'func_overload' => 0, + 'func_overload_list' => 'no overload', + 'mail_charset' => 'UTF-8', + 'mail_header_encoding' => 'BASE64', + 'mail_body_encoding' => 'BASE64', + 'illegal_chars' => 0, + 'encoding_translation' => 'Off', + 'language' => self::$language, + 'detect_order' => self::$encodingList, + 'substitute_character' => 'none', + 'strict_detection' => 'Off', + ]; + + if ('all' === $type) { + return $info; + } + if (isset($info[$type])) { + return $info[$type]; + } + + return false; + } + + public static function mb_http_input($type = '') + { + return false; + } + + public static function mb_http_output($encoding = null) + { + return null !== $encoding ? 'pass' === $encoding : 'pass'; + } + + public static function mb_strwidth($s, $encoding = null) + { + $encoding = self::getEncoding($encoding); + + if ('UTF-8' !== $encoding) { + $s = iconv($encoding, 'UTF-8//IGNORE', $s); + } + + $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide); + + return ($wide << 1) + iconv_strlen($s, 'UTF-8'); + } + + public static function mb_substr_count($haystack, $needle, $encoding = null) + { + return substr_count($haystack, $needle); + } + + public static function mb_output_handler($contents, $status) + { + return $contents; + } + + public static function mb_chr($code, $encoding = null) + { + if (0x80 > $code %= 0x200000) { + $s = \chr($code); + } elseif (0x800 > $code) { + $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F); + } elseif (0x10000 > $code) { + $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); + } else { + $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); + } + + if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { + $s = mb_convert_encoding($s, $encoding, 'UTF-8'); + } + + return $s; + } + + public static function mb_ord($s, $encoding = null) + { + if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { + $s = mb_convert_encoding($s, 'UTF-8', $encoding); + } + + if (1 === \strlen($s)) { + return \ord($s); + } + + $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; + if (0xF0 <= $code) { + return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80; + } + if (0xE0 <= $code) { + return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80; + } + if (0xC0 <= $code) { + return (($code - 0xC0) << 6) + $s[2] - 0x80; + } + + return $code; + } + + public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null): string + { + if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) { + throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH'); + } + + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, 'mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given'); + } + + if (self::mb_strlen($pad_string, $encoding) <= 0) { + throw new \ValueError('mb_str_pad(): Argument #3 ($pad_string) must be a non-empty string'); + } + + $paddingRequired = $length - self::mb_strlen($string, $encoding); + + if ($paddingRequired < 1) { + return $string; + } + + switch ($pad_type) { + case \STR_PAD_LEFT: + return self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding).$string; + case \STR_PAD_RIGHT: + return $string.self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding); + default: + $leftPaddingLength = floor($paddingRequired / 2); + $rightPaddingLength = $paddingRequired - $leftPaddingLength; + + return self::mb_substr(str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding).$string.self::mb_substr(str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding); + } + } + + public static function mb_ucfirst(string $string, ?string $encoding = null): string + { + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, 'mb_ucfirst(): Argument #2 ($encoding) must be a valid encoding, "%s" given'); + } + + $firstChar = mb_substr($string, 0, 1, $encoding); + $firstChar = mb_convert_case($firstChar, \MB_CASE_TITLE, $encoding); + + return $firstChar.mb_substr($string, 1, null, $encoding); + } + + public static function mb_lcfirst(string $string, ?string $encoding = null): string + { + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, 'mb_lcfirst(): Argument #2 ($encoding) must be a valid encoding, "%s" given'); + } + + $firstChar = mb_substr($string, 0, 1, $encoding); + $firstChar = mb_convert_case($firstChar, \MB_CASE_LOWER, $encoding); + + return $firstChar.mb_substr($string, 1, null, $encoding); + } + + private static function getSubpart($pos, $part, $haystack, $encoding) + { + if (false === $pos) { + return false; + } + if ($part) { + return self::mb_substr($haystack, 0, $pos, $encoding); + } + + return self::mb_substr($haystack, $pos, null, $encoding); + } + + private static function html_encoding_callback(array $m) + { + $i = 1; + $entities = ''; + $m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8')); + + while (isset($m[$i])) { + if (0x80 > $m[$i]) { + $entities .= \chr($m[$i++]); + continue; + } + if (0xF0 <= $m[$i]) { + $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; + } elseif (0xE0 <= $m[$i]) { + $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; + } else { + $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80; + } + + $entities .= '&#'.$c.';'; + } + + return $entities; + } + + private static function title_case(array $s) + { + return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); + } + + private static function getData($file) + { + if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { + return require $file; + } + + return false; + } + + private static function getEncoding($encoding) + { + if (null === $encoding) { + return self::$internalEncoding; + } + + if ('UTF-8' === $encoding) { + return 'UTF-8'; + } + + $encoding = strtoupper($encoding); + + if ('8BIT' === $encoding || 'BINARY' === $encoding) { + return 'CP850'; + } + + if ('UTF8' === $encoding) { + return 'UTF-8'; + } + + return $encoding; + } + + public static function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string + { + return self::mb_internal_trim('{^[%s]+|[%1$s]+$}Du', $string, $characters, $encoding, __FUNCTION__); + } + + public static function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string + { + return self::mb_internal_trim('{^[%s]+}Du', $string, $characters, $encoding, __FUNCTION__); + } + + public static function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string + { + return self::mb_internal_trim('{[%s]+$}D', $string, $characters, $encoding, __FUNCTION__); + } + + private static function mb_internal_trim(string $regex, string $string, ?string $characters, ?string $encoding, string $function): string + { + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, $function.'(): Argument #3 ($encoding) must be a valid encoding, "%s" given'); + } + + if ('' === $characters) { + return null === $encoding ? $string : self::mb_convert_encoding($string, $encoding); + } + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $string)) { + $string = @iconv('UTF-8', 'UTF-8//IGNORE', $string); + } + if (null !== $characters && !preg_match('//u', $characters)) { + $characters = @iconv('UTF-8', 'UTF-8//IGNORE', $characters); + } + } else { + $string = iconv($encoding, 'UTF-8//IGNORE', $string); + + if (null !== $characters) { + $characters = iconv($encoding, 'UTF-8//IGNORE', $characters); + } + } + + if (null === $characters) { + $characters = "\\0 \f\n\r\t\v\u{00A0}\u{1680}\u{2000}\u{2001}\u{2002}\u{2003}\u{2004}\u{2005}\u{2006}\u{2007}\u{2008}\u{2009}\u{200A}\u{2028}\u{2029}\u{202F}\u{205F}\u{3000}\u{0085}\u{180E}"; + } else { + $characters = preg_quote($characters); + } + + $string = preg_replace(sprintf($regex, $characters), '', $string); + + if (null === $encoding) { + return $string; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $string); + } + + private static function assertEncoding(string $encoding, string $errorFormat): void + { + try { + $validEncoding = @self::mb_check_encoding('', $encoding); + } catch (\ValueError $e) { + throw new \ValueError(sprintf($errorFormat, $encoding)); + } + + // BC for PHP 7.3 and lower + if (!$validEncoding) { + throw new \ValueError(sprintf($errorFormat, $encoding)); + } + } +} diff --git a/vendor/symfony/polyfill-mbstring/README.md b/vendor/symfony/polyfill-mbstring/README.md index 478b40d..a0f8d13 100644 --- a/vendor/symfony/polyfill-mbstring/README.md +++ b/vendor/symfony/polyfill-mbstring/README.md @@ -1,13 +1,13 @@ -Symfony Polyfill / Mbstring -=========================== - -This component provides a partial, native PHP implementation for the -[Mbstring](https://php.net/mbstring) extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). +Symfony Polyfill / Mbstring +=========================== + +This component provides a partial, native PHP implementation for the +[Mbstring](https://php.net/mbstring) extension. + +More information can be found in the +[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). + +License +======= + +This library is released under the [MIT license](LICENSE). diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php index 512bba0..99da3a1 100644 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php @@ -1,119 +1,119 @@ - 'i̇', - 'µ' => 'μ', - 'ſ' => 's', - 'ͅ' => 'ι', - 'ς' => 'σ', - 'ϐ' => 'β', - 'ϑ' => 'θ', - 'ϕ' => 'φ', - 'ϖ' => 'π', - 'ϰ' => 'κ', - 'ϱ' => 'ρ', - 'ϵ' => 'ε', - 'ẛ' => 'ṡ', - 'ι' => 'ι', - 'ß' => 'ss', - 'ʼn' => 'ʼn', - 'ǰ' => 'ǰ', - 'ΐ' => 'ΐ', - 'ΰ' => 'ΰ', - 'և' => 'եւ', - 'ẖ' => 'ẖ', - 'ẗ' => 'ẗ', - 'ẘ' => 'ẘ', - 'ẙ' => 'ẙ', - 'ẚ' => 'aʾ', - 'ẞ' => 'ss', - 'ὐ' => 'ὐ', - 'ὒ' => 'ὒ', - 'ὔ' => 'ὔ', - 'ὖ' => 'ὖ', - 'ᾀ' => 'ἀι', - 'ᾁ' => 'ἁι', - 'ᾂ' => 'ἂι', - 'ᾃ' => 'ἃι', - 'ᾄ' => 'ἄι', - 'ᾅ' => 'ἅι', - 'ᾆ' => 'ἆι', - 'ᾇ' => 'ἇι', - 'ᾈ' => 'ἀι', - 'ᾉ' => 'ἁι', - 'ᾊ' => 'ἂι', - 'ᾋ' => 'ἃι', - 'ᾌ' => 'ἄι', - 'ᾍ' => 'ἅι', - 'ᾎ' => 'ἆι', - 'ᾏ' => 'ἇι', - 'ᾐ' => 'ἠι', - 'ᾑ' => 'ἡι', - 'ᾒ' => 'ἢι', - 'ᾓ' => 'ἣι', - 'ᾔ' => 'ἤι', - 'ᾕ' => 'ἥι', - 'ᾖ' => 'ἦι', - 'ᾗ' => 'ἧι', - 'ᾘ' => 'ἠι', - 'ᾙ' => 'ἡι', - 'ᾚ' => 'ἢι', - 'ᾛ' => 'ἣι', - 'ᾜ' => 'ἤι', - 'ᾝ' => 'ἥι', - 'ᾞ' => 'ἦι', - 'ᾟ' => 'ἧι', - 'ᾠ' => 'ὠι', - 'ᾡ' => 'ὡι', - 'ᾢ' => 'ὢι', - 'ᾣ' => 'ὣι', - 'ᾤ' => 'ὤι', - 'ᾥ' => 'ὥι', - 'ᾦ' => 'ὦι', - 'ᾧ' => 'ὧι', - 'ᾨ' => 'ὠι', - 'ᾩ' => 'ὡι', - 'ᾪ' => 'ὢι', - 'ᾫ' => 'ὣι', - 'ᾬ' => 'ὤι', - 'ᾭ' => 'ὥι', - 'ᾮ' => 'ὦι', - 'ᾯ' => 'ὧι', - 'ᾲ' => 'ὰι', - 'ᾳ' => 'αι', - 'ᾴ' => 'άι', - 'ᾶ' => 'ᾶ', - 'ᾷ' => 'ᾶι', - 'ᾼ' => 'αι', - 'ῂ' => 'ὴι', - 'ῃ' => 'ηι', - 'ῄ' => 'ήι', - 'ῆ' => 'ῆ', - 'ῇ' => 'ῆι', - 'ῌ' => 'ηι', - 'ῒ' => 'ῒ', - 'ῖ' => 'ῖ', - 'ῗ' => 'ῗ', - 'ῢ' => 'ῢ', - 'ῤ' => 'ῤ', - 'ῦ' => 'ῦ', - 'ῧ' => 'ῧ', - 'ῲ' => 'ὼι', - 'ῳ' => 'ωι', - 'ῴ' => 'ώι', - 'ῶ' => 'ῶ', - 'ῷ' => 'ῶι', - 'ῼ' => 'ωι', - 'ff' => 'ff', - 'fi' => 'fi', - 'fl' => 'fl', - 'ffi' => 'ffi', - 'ffl' => 'ffl', - 'ſt' => 'st', - 'st' => 'st', - 'ﬓ' => 'մն', - 'ﬔ' => 'մե', - 'ﬕ' => 'մի', - 'ﬖ' => 'վն', - 'ﬗ' => 'մխ', -]; + 'i̇', + 'µ' => 'μ', + 'ſ' => 's', + 'ͅ' => 'ι', + 'ς' => 'σ', + 'ϐ' => 'β', + 'ϑ' => 'θ', + 'ϕ' => 'φ', + 'ϖ' => 'π', + 'ϰ' => 'κ', + 'ϱ' => 'ρ', + 'ϵ' => 'ε', + 'ẛ' => 'ṡ', + 'ι' => 'ι', + 'ß' => 'ss', + 'ʼn' => 'ʼn', + 'ǰ' => 'ǰ', + 'ΐ' => 'ΐ', + 'ΰ' => 'ΰ', + 'և' => 'եւ', + 'ẖ' => 'ẖ', + 'ẗ' => 'ẗ', + 'ẘ' => 'ẘ', + 'ẙ' => 'ẙ', + 'ẚ' => 'aʾ', + 'ẞ' => 'ss', + 'ὐ' => 'ὐ', + 'ὒ' => 'ὒ', + 'ὔ' => 'ὔ', + 'ὖ' => 'ὖ', + 'ᾀ' => 'ἀι', + 'ᾁ' => 'ἁι', + 'ᾂ' => 'ἂι', + 'ᾃ' => 'ἃι', + 'ᾄ' => 'ἄι', + 'ᾅ' => 'ἅι', + 'ᾆ' => 'ἆι', + 'ᾇ' => 'ἇι', + 'ᾈ' => 'ἀι', + 'ᾉ' => 'ἁι', + 'ᾊ' => 'ἂι', + 'ᾋ' => 'ἃι', + 'ᾌ' => 'ἄι', + 'ᾍ' => 'ἅι', + 'ᾎ' => 'ἆι', + 'ᾏ' => 'ἇι', + 'ᾐ' => 'ἠι', + 'ᾑ' => 'ἡι', + 'ᾒ' => 'ἢι', + 'ᾓ' => 'ἣι', + 'ᾔ' => 'ἤι', + 'ᾕ' => 'ἥι', + 'ᾖ' => 'ἦι', + 'ᾗ' => 'ἧι', + 'ᾘ' => 'ἠι', + 'ᾙ' => 'ἡι', + 'ᾚ' => 'ἢι', + 'ᾛ' => 'ἣι', + 'ᾜ' => 'ἤι', + 'ᾝ' => 'ἥι', + 'ᾞ' => 'ἦι', + 'ᾟ' => 'ἧι', + 'ᾠ' => 'ὠι', + 'ᾡ' => 'ὡι', + 'ᾢ' => 'ὢι', + 'ᾣ' => 'ὣι', + 'ᾤ' => 'ὤι', + 'ᾥ' => 'ὥι', + 'ᾦ' => 'ὦι', + 'ᾧ' => 'ὧι', + 'ᾨ' => 'ὠι', + 'ᾩ' => 'ὡι', + 'ᾪ' => 'ὢι', + 'ᾫ' => 'ὣι', + 'ᾬ' => 'ὤι', + 'ᾭ' => 'ὥι', + 'ᾮ' => 'ὦι', + 'ᾯ' => 'ὧι', + 'ᾲ' => 'ὰι', + 'ᾳ' => 'αι', + 'ᾴ' => 'άι', + 'ᾶ' => 'ᾶ', + 'ᾷ' => 'ᾶι', + 'ᾼ' => 'αι', + 'ῂ' => 'ὴι', + 'ῃ' => 'ηι', + 'ῄ' => 'ήι', + 'ῆ' => 'ῆ', + 'ῇ' => 'ῆι', + 'ῌ' => 'ηι', + 'ῒ' => 'ῒ', + 'ῖ' => 'ῖ', + 'ῗ' => 'ῗ', + 'ῢ' => 'ῢ', + 'ῤ' => 'ῤ', + 'ῦ' => 'ῦ', + 'ῧ' => 'ῧ', + 'ῲ' => 'ὼι', + 'ῳ' => 'ωι', + 'ῴ' => 'ώι', + 'ῶ' => 'ῶ', + 'ῷ' => 'ῶι', + 'ῼ' => 'ωι', + 'ff' => 'ff', + 'fi' => 'fi', + 'fl' => 'fl', + 'ffi' => 'ffi', + 'ffl' => 'ffl', + 'ſt' => 'st', + 'st' => 'st', + 'ﬓ' => 'մն', + 'ﬔ' => 'մե', + 'ﬕ' => 'մի', + 'ﬖ' => 'վն', + 'ﬗ' => 'մխ', +]; diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php index fac60b0..3bd03d8 100644 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php @@ -1,1397 +1,1397 @@ - 'a', - 'B' => 'b', - 'C' => 'c', - 'D' => 'd', - 'E' => 'e', - 'F' => 'f', - 'G' => 'g', - 'H' => 'h', - 'I' => 'i', - 'J' => 'j', - 'K' => 'k', - 'L' => 'l', - 'M' => 'm', - 'N' => 'n', - 'O' => 'o', - 'P' => 'p', - 'Q' => 'q', - 'R' => 'r', - 'S' => 's', - 'T' => 't', - 'U' => 'u', - 'V' => 'v', - 'W' => 'w', - 'X' => 'x', - 'Y' => 'y', - 'Z' => 'z', - 'À' => 'à', - 'Á' => 'á', - 'Â' => 'â', - 'Ã' => 'ã', - 'Ä' => 'ä', - 'Å' => 'å', - 'Æ' => 'æ', - 'Ç' => 'ç', - 'È' => 'è', - 'É' => 'é', - 'Ê' => 'ê', - 'Ë' => 'ë', - 'Ì' => 'ì', - 'Í' => 'í', - 'Î' => 'î', - 'Ï' => 'ï', - 'Ð' => 'ð', - 'Ñ' => 'ñ', - 'Ò' => 'ò', - 'Ó' => 'ó', - 'Ô' => 'ô', - 'Õ' => 'õ', - 'Ö' => 'ö', - 'Ø' => 'ø', - 'Ù' => 'ù', - 'Ú' => 'ú', - 'Û' => 'û', - 'Ü' => 'ü', - 'Ý' => 'ý', - 'Þ' => 'þ', - 'Ā' => 'ā', - 'Ă' => 'ă', - 'Ą' => 'ą', - 'Ć' => 'ć', - 'Ĉ' => 'ĉ', - 'Ċ' => 'ċ', - 'Č' => 'č', - 'Ď' => 'ď', - 'Đ' => 'đ', - 'Ē' => 'ē', - 'Ĕ' => 'ĕ', - 'Ė' => 'ė', - 'Ę' => 'ę', - 'Ě' => 'ě', - 'Ĝ' => 'ĝ', - 'Ğ' => 'ğ', - 'Ġ' => 'ġ', - 'Ģ' => 'ģ', - 'Ĥ' => 'ĥ', - 'Ħ' => 'ħ', - 'Ĩ' => 'ĩ', - 'Ī' => 'ī', - 'Ĭ' => 'ĭ', - 'Į' => 'į', - 'İ' => 'i̇', - 'IJ' => 'ij', - 'Ĵ' => 'ĵ', - 'Ķ' => 'ķ', - 'Ĺ' => 'ĺ', - 'Ļ' => 'ļ', - 'Ľ' => 'ľ', - 'Ŀ' => 'ŀ', - 'Ł' => 'ł', - 'Ń' => 'ń', - 'Ņ' => 'ņ', - 'Ň' => 'ň', - 'Ŋ' => 'ŋ', - 'Ō' => 'ō', - 'Ŏ' => 'ŏ', - 'Ő' => 'ő', - 'Œ' => 'œ', - 'Ŕ' => 'ŕ', - 'Ŗ' => 'ŗ', - 'Ř' => 'ř', - 'Ś' => 'ś', - 'Ŝ' => 'ŝ', - 'Ş' => 'ş', - 'Š' => 'š', - 'Ţ' => 'ţ', - 'Ť' => 'ť', - 'Ŧ' => 'ŧ', - 'Ũ' => 'ũ', - 'Ū' => 'ū', - 'Ŭ' => 'ŭ', - 'Ů' => 'ů', - 'Ű' => 'ű', - 'Ų' => 'ų', - 'Ŵ' => 'ŵ', - 'Ŷ' => 'ŷ', - 'Ÿ' => 'ÿ', - 'Ź' => 'ź', - 'Ż' => 'ż', - 'Ž' => 'ž', - 'Ɓ' => 'ɓ', - 'Ƃ' => 'ƃ', - 'Ƅ' => 'ƅ', - 'Ɔ' => 'ɔ', - 'Ƈ' => 'ƈ', - 'Ɖ' => 'ɖ', - 'Ɗ' => 'ɗ', - 'Ƌ' => 'ƌ', - 'Ǝ' => 'ǝ', - 'Ə' => 'ə', - 'Ɛ' => 'ɛ', - 'Ƒ' => 'ƒ', - 'Ɠ' => 'ɠ', - 'Ɣ' => 'ɣ', - 'Ɩ' => 'ɩ', - 'Ɨ' => 'ɨ', - 'Ƙ' => 'ƙ', - 'Ɯ' => 'ɯ', - 'Ɲ' => 'ɲ', - 'Ɵ' => 'ɵ', - 'Ơ' => 'ơ', - 'Ƣ' => 'ƣ', - 'Ƥ' => 'ƥ', - 'Ʀ' => 'ʀ', - 'Ƨ' => 'ƨ', - 'Ʃ' => 'ʃ', - 'Ƭ' => 'ƭ', - 'Ʈ' => 'ʈ', - 'Ư' => 'ư', - 'Ʊ' => 'ʊ', - 'Ʋ' => 'ʋ', - 'Ƴ' => 'ƴ', - 'Ƶ' => 'ƶ', - 'Ʒ' => 'ʒ', - 'Ƹ' => 'ƹ', - 'Ƽ' => 'ƽ', - 'DŽ' => 'dž', - 'Dž' => 'dž', - 'LJ' => 'lj', - 'Lj' => 'lj', - 'NJ' => 'nj', - 'Nj' => 'nj', - 'Ǎ' => 'ǎ', - 'Ǐ' => 'ǐ', - 'Ǒ' => 'ǒ', - 'Ǔ' => 'ǔ', - 'Ǖ' => 'ǖ', - 'Ǘ' => 'ǘ', - 'Ǚ' => 'ǚ', - 'Ǜ' => 'ǜ', - 'Ǟ' => 'ǟ', - 'Ǡ' => 'ǡ', - 'Ǣ' => 'ǣ', - 'Ǥ' => 'ǥ', - 'Ǧ' => 'ǧ', - 'Ǩ' => 'ǩ', - 'Ǫ' => 'ǫ', - 'Ǭ' => 'ǭ', - 'Ǯ' => 'ǯ', - 'DZ' => 'dz', - 'Dz' => 'dz', - 'Ǵ' => 'ǵ', - 'Ƕ' => 'ƕ', - 'Ƿ' => 'ƿ', - 'Ǹ' => 'ǹ', - 'Ǻ' => 'ǻ', - 'Ǽ' => 'ǽ', - 'Ǿ' => 'ǿ', - 'Ȁ' => 'ȁ', - 'Ȃ' => 'ȃ', - 'Ȅ' => 'ȅ', - 'Ȇ' => 'ȇ', - 'Ȉ' => 'ȉ', - 'Ȋ' => 'ȋ', - 'Ȍ' => 'ȍ', - 'Ȏ' => 'ȏ', - 'Ȑ' => 'ȑ', - 'Ȓ' => 'ȓ', - 'Ȕ' => 'ȕ', - 'Ȗ' => 'ȗ', - 'Ș' => 'ș', - 'Ț' => 'ț', - 'Ȝ' => 'ȝ', - 'Ȟ' => 'ȟ', - 'Ƞ' => 'ƞ', - 'Ȣ' => 'ȣ', - 'Ȥ' => 'ȥ', - 'Ȧ' => 'ȧ', - 'Ȩ' => 'ȩ', - 'Ȫ' => 'ȫ', - 'Ȭ' => 'ȭ', - 'Ȯ' => 'ȯ', - 'Ȱ' => 'ȱ', - 'Ȳ' => 'ȳ', - 'Ⱥ' => 'ⱥ', - 'Ȼ' => 'ȼ', - 'Ƚ' => 'ƚ', - 'Ⱦ' => 'ⱦ', - 'Ɂ' => 'ɂ', - 'Ƀ' => 'ƀ', - 'Ʉ' => 'ʉ', - 'Ʌ' => 'ʌ', - 'Ɇ' => 'ɇ', - 'Ɉ' => 'ɉ', - 'Ɋ' => 'ɋ', - 'Ɍ' => 'ɍ', - 'Ɏ' => 'ɏ', - 'Ͱ' => 'ͱ', - 'Ͳ' => 'ͳ', - 'Ͷ' => 'ͷ', - 'Ϳ' => 'ϳ', - 'Ά' => 'ά', - 'Έ' => 'έ', - 'Ή' => 'ή', - 'Ί' => 'ί', - 'Ό' => 'ό', - 'Ύ' => 'ύ', - 'Ώ' => 'ώ', - 'Α' => 'α', - 'Β' => 'β', - 'Γ' => 'γ', - 'Δ' => 'δ', - 'Ε' => 'ε', - 'Ζ' => 'ζ', - 'Η' => 'η', - 'Θ' => 'θ', - 'Ι' => 'ι', - 'Κ' => 'κ', - 'Λ' => 'λ', - 'Μ' => 'μ', - 'Ν' => 'ν', - 'Ξ' => 'ξ', - 'Ο' => 'ο', - 'Π' => 'π', - 'Ρ' => 'ρ', - 'Σ' => 'σ', - 'Τ' => 'τ', - 'Υ' => 'υ', - 'Φ' => 'φ', - 'Χ' => 'χ', - 'Ψ' => 'ψ', - 'Ω' => 'ω', - 'Ϊ' => 'ϊ', - 'Ϋ' => 'ϋ', - 'Ϗ' => 'ϗ', - 'Ϙ' => 'ϙ', - 'Ϛ' => 'ϛ', - 'Ϝ' => 'ϝ', - 'Ϟ' => 'ϟ', - 'Ϡ' => 'ϡ', - 'Ϣ' => 'ϣ', - 'Ϥ' => 'ϥ', - 'Ϧ' => 'ϧ', - 'Ϩ' => 'ϩ', - 'Ϫ' => 'ϫ', - 'Ϭ' => 'ϭ', - 'Ϯ' => 'ϯ', - 'ϴ' => 'θ', - 'Ϸ' => 'ϸ', - 'Ϲ' => 'ϲ', - 'Ϻ' => 'ϻ', - 'Ͻ' => 'ͻ', - 'Ͼ' => 'ͼ', - 'Ͽ' => 'ͽ', - 'Ѐ' => 'ѐ', - 'Ё' => 'ё', - 'Ђ' => 'ђ', - 'Ѓ' => 'ѓ', - 'Є' => 'є', - 'Ѕ' => 'ѕ', - 'І' => 'і', - 'Ї' => 'ї', - 'Ј' => 'ј', - 'Љ' => 'љ', - 'Њ' => 'њ', - 'Ћ' => 'ћ', - 'Ќ' => 'ќ', - 'Ѝ' => 'ѝ', - 'Ў' => 'ў', - 'Џ' => 'џ', - 'А' => 'а', - 'Б' => 'б', - 'В' => 'в', - 'Г' => 'г', - 'Д' => 'д', - 'Е' => 'е', - 'Ж' => 'ж', - 'З' => 'з', - 'И' => 'и', - 'Й' => 'й', - 'К' => 'к', - 'Л' => 'л', - 'М' => 'м', - 'Н' => 'н', - 'О' => 'о', - 'П' => 'п', - 'Р' => 'р', - 'С' => 'с', - 'Т' => 'т', - 'У' => 'у', - 'Ф' => 'ф', - 'Х' => 'х', - 'Ц' => 'ц', - 'Ч' => 'ч', - 'Ш' => 'ш', - 'Щ' => 'щ', - 'Ъ' => 'ъ', - 'Ы' => 'ы', - 'Ь' => 'ь', - 'Э' => 'э', - 'Ю' => 'ю', - 'Я' => 'я', - 'Ѡ' => 'ѡ', - 'Ѣ' => 'ѣ', - 'Ѥ' => 'ѥ', - 'Ѧ' => 'ѧ', - 'Ѩ' => 'ѩ', - 'Ѫ' => 'ѫ', - 'Ѭ' => 'ѭ', - 'Ѯ' => 'ѯ', - 'Ѱ' => 'ѱ', - 'Ѳ' => 'ѳ', - 'Ѵ' => 'ѵ', - 'Ѷ' => 'ѷ', - 'Ѹ' => 'ѹ', - 'Ѻ' => 'ѻ', - 'Ѽ' => 'ѽ', - 'Ѿ' => 'ѿ', - 'Ҁ' => 'ҁ', - 'Ҋ' => 'ҋ', - 'Ҍ' => 'ҍ', - 'Ҏ' => 'ҏ', - 'Ґ' => 'ґ', - 'Ғ' => 'ғ', - 'Ҕ' => 'ҕ', - 'Җ' => 'җ', - 'Ҙ' => 'ҙ', - 'Қ' => 'қ', - 'Ҝ' => 'ҝ', - 'Ҟ' => 'ҟ', - 'Ҡ' => 'ҡ', - 'Ң' => 'ң', - 'Ҥ' => 'ҥ', - 'Ҧ' => 'ҧ', - 'Ҩ' => 'ҩ', - 'Ҫ' => 'ҫ', - 'Ҭ' => 'ҭ', - 'Ү' => 'ү', - 'Ұ' => 'ұ', - 'Ҳ' => 'ҳ', - 'Ҵ' => 'ҵ', - 'Ҷ' => 'ҷ', - 'Ҹ' => 'ҹ', - 'Һ' => 'һ', - 'Ҽ' => 'ҽ', - 'Ҿ' => 'ҿ', - 'Ӏ' => 'ӏ', - 'Ӂ' => 'ӂ', - 'Ӄ' => 'ӄ', - 'Ӆ' => 'ӆ', - 'Ӈ' => 'ӈ', - 'Ӊ' => 'ӊ', - 'Ӌ' => 'ӌ', - 'Ӎ' => 'ӎ', - 'Ӑ' => 'ӑ', - 'Ӓ' => 'ӓ', - 'Ӕ' => 'ӕ', - 'Ӗ' => 'ӗ', - 'Ә' => 'ә', - 'Ӛ' => 'ӛ', - 'Ӝ' => 'ӝ', - 'Ӟ' => 'ӟ', - 'Ӡ' => 'ӡ', - 'Ӣ' => 'ӣ', - 'Ӥ' => 'ӥ', - 'Ӧ' => 'ӧ', - 'Ө' => 'ө', - 'Ӫ' => 'ӫ', - 'Ӭ' => 'ӭ', - 'Ӯ' => 'ӯ', - 'Ӱ' => 'ӱ', - 'Ӳ' => 'ӳ', - 'Ӵ' => 'ӵ', - 'Ӷ' => 'ӷ', - 'Ӹ' => 'ӹ', - 'Ӻ' => 'ӻ', - 'Ӽ' => 'ӽ', - 'Ӿ' => 'ӿ', - 'Ԁ' => 'ԁ', - 'Ԃ' => 'ԃ', - 'Ԅ' => 'ԅ', - 'Ԇ' => 'ԇ', - 'Ԉ' => 'ԉ', - 'Ԋ' => 'ԋ', - 'Ԍ' => 'ԍ', - 'Ԏ' => 'ԏ', - 'Ԑ' => 'ԑ', - 'Ԓ' => 'ԓ', - 'Ԕ' => 'ԕ', - 'Ԗ' => 'ԗ', - 'Ԙ' => 'ԙ', - 'Ԛ' => 'ԛ', - 'Ԝ' => 'ԝ', - 'Ԟ' => 'ԟ', - 'Ԡ' => 'ԡ', - 'Ԣ' => 'ԣ', - 'Ԥ' => 'ԥ', - 'Ԧ' => 'ԧ', - 'Ԩ' => 'ԩ', - 'Ԫ' => 'ԫ', - 'Ԭ' => 'ԭ', - 'Ԯ' => 'ԯ', - 'Ա' => 'ա', - 'Բ' => 'բ', - 'Գ' => 'գ', - 'Դ' => 'դ', - 'Ե' => 'ե', - 'Զ' => 'զ', - 'Է' => 'է', - 'Ը' => 'ը', - 'Թ' => 'թ', - 'Ժ' => 'ժ', - 'Ի' => 'ի', - 'Լ' => 'լ', - 'Խ' => 'խ', - 'Ծ' => 'ծ', - 'Կ' => 'կ', - 'Հ' => 'հ', - 'Ձ' => 'ձ', - 'Ղ' => 'ղ', - 'Ճ' => 'ճ', - 'Մ' => 'մ', - 'Յ' => 'յ', - 'Ն' => 'ն', - 'Շ' => 'շ', - 'Ո' => 'ո', - 'Չ' => 'չ', - 'Պ' => 'պ', - 'Ջ' => 'ջ', - 'Ռ' => 'ռ', - 'Ս' => 'ս', - 'Վ' => 'վ', - 'Տ' => 'տ', - 'Ր' => 'ր', - 'Ց' => 'ց', - 'Ւ' => 'ւ', - 'Փ' => 'փ', - 'Ք' => 'ք', - 'Օ' => 'օ', - 'Ֆ' => 'ֆ', - 'Ⴀ' => 'ⴀ', - 'Ⴁ' => 'ⴁ', - 'Ⴂ' => 'ⴂ', - 'Ⴃ' => 'ⴃ', - 'Ⴄ' => 'ⴄ', - 'Ⴅ' => 'ⴅ', - 'Ⴆ' => 'ⴆ', - 'Ⴇ' => 'ⴇ', - 'Ⴈ' => 'ⴈ', - 'Ⴉ' => 'ⴉ', - 'Ⴊ' => 'ⴊ', - 'Ⴋ' => 'ⴋ', - 'Ⴌ' => 'ⴌ', - 'Ⴍ' => 'ⴍ', - 'Ⴎ' => 'ⴎ', - 'Ⴏ' => 'ⴏ', - 'Ⴐ' => 'ⴐ', - 'Ⴑ' => 'ⴑ', - 'Ⴒ' => 'ⴒ', - 'Ⴓ' => 'ⴓ', - 'Ⴔ' => 'ⴔ', - 'Ⴕ' => 'ⴕ', - 'Ⴖ' => 'ⴖ', - 'Ⴗ' => 'ⴗ', - 'Ⴘ' => 'ⴘ', - 'Ⴙ' => 'ⴙ', - 'Ⴚ' => 'ⴚ', - 'Ⴛ' => 'ⴛ', - 'Ⴜ' => 'ⴜ', - 'Ⴝ' => 'ⴝ', - 'Ⴞ' => 'ⴞ', - 'Ⴟ' => 'ⴟ', - 'Ⴠ' => 'ⴠ', - 'Ⴡ' => 'ⴡ', - 'Ⴢ' => 'ⴢ', - 'Ⴣ' => 'ⴣ', - 'Ⴤ' => 'ⴤ', - 'Ⴥ' => 'ⴥ', - 'Ⴧ' => 'ⴧ', - 'Ⴭ' => 'ⴭ', - 'Ꭰ' => 'ꭰ', - 'Ꭱ' => 'ꭱ', - 'Ꭲ' => 'ꭲ', - 'Ꭳ' => 'ꭳ', - 'Ꭴ' => 'ꭴ', - 'Ꭵ' => 'ꭵ', - 'Ꭶ' => 'ꭶ', - 'Ꭷ' => 'ꭷ', - 'Ꭸ' => 'ꭸ', - 'Ꭹ' => 'ꭹ', - 'Ꭺ' => 'ꭺ', - 'Ꭻ' => 'ꭻ', - 'Ꭼ' => 'ꭼ', - 'Ꭽ' => 'ꭽ', - 'Ꭾ' => 'ꭾ', - 'Ꭿ' => 'ꭿ', - 'Ꮀ' => 'ꮀ', - 'Ꮁ' => 'ꮁ', - 'Ꮂ' => 'ꮂ', - 'Ꮃ' => 'ꮃ', - 'Ꮄ' => 'ꮄ', - 'Ꮅ' => 'ꮅ', - 'Ꮆ' => 'ꮆ', - 'Ꮇ' => 'ꮇ', - 'Ꮈ' => 'ꮈ', - 'Ꮉ' => 'ꮉ', - 'Ꮊ' => 'ꮊ', - 'Ꮋ' => 'ꮋ', - 'Ꮌ' => 'ꮌ', - 'Ꮍ' => 'ꮍ', - 'Ꮎ' => 'ꮎ', - 'Ꮏ' => 'ꮏ', - 'Ꮐ' => 'ꮐ', - 'Ꮑ' => 'ꮑ', - 'Ꮒ' => 'ꮒ', - 'Ꮓ' => 'ꮓ', - 'Ꮔ' => 'ꮔ', - 'Ꮕ' => 'ꮕ', - 'Ꮖ' => 'ꮖ', - 'Ꮗ' => 'ꮗ', - 'Ꮘ' => 'ꮘ', - 'Ꮙ' => 'ꮙ', - 'Ꮚ' => 'ꮚ', - 'Ꮛ' => 'ꮛ', - 'Ꮜ' => 'ꮜ', - 'Ꮝ' => 'ꮝ', - 'Ꮞ' => 'ꮞ', - 'Ꮟ' => 'ꮟ', - 'Ꮠ' => 'ꮠ', - 'Ꮡ' => 'ꮡ', - 'Ꮢ' => 'ꮢ', - 'Ꮣ' => 'ꮣ', - 'Ꮤ' => 'ꮤ', - 'Ꮥ' => 'ꮥ', - 'Ꮦ' => 'ꮦ', - 'Ꮧ' => 'ꮧ', - 'Ꮨ' => 'ꮨ', - 'Ꮩ' => 'ꮩ', - 'Ꮪ' => 'ꮪ', - 'Ꮫ' => 'ꮫ', - 'Ꮬ' => 'ꮬ', - 'Ꮭ' => 'ꮭ', - 'Ꮮ' => 'ꮮ', - 'Ꮯ' => 'ꮯ', - 'Ꮰ' => 'ꮰ', - 'Ꮱ' => 'ꮱ', - 'Ꮲ' => 'ꮲ', - 'Ꮳ' => 'ꮳ', - 'Ꮴ' => 'ꮴ', - 'Ꮵ' => 'ꮵ', - 'Ꮶ' => 'ꮶ', - 'Ꮷ' => 'ꮷ', - 'Ꮸ' => 'ꮸ', - 'Ꮹ' => 'ꮹ', - 'Ꮺ' => 'ꮺ', - 'Ꮻ' => 'ꮻ', - 'Ꮼ' => 'ꮼ', - 'Ꮽ' => 'ꮽ', - 'Ꮾ' => 'ꮾ', - 'Ꮿ' => 'ꮿ', - 'Ᏸ' => 'ᏸ', - 'Ᏹ' => 'ᏹ', - 'Ᏺ' => 'ᏺ', - 'Ᏻ' => 'ᏻ', - 'Ᏼ' => 'ᏼ', - 'Ᏽ' => 'ᏽ', - 'Ა' => 'ა', - 'Ბ' => 'ბ', - 'Გ' => 'გ', - 'Დ' => 'დ', - 'Ე' => 'ე', - 'Ვ' => 'ვ', - 'Ზ' => 'ზ', - 'Თ' => 'თ', - 'Ი' => 'ი', - 'Კ' => 'კ', - 'Ლ' => 'ლ', - 'Მ' => 'მ', - 'Ნ' => 'ნ', - 'Ო' => 'ო', - 'Პ' => 'პ', - 'Ჟ' => 'ჟ', - 'Რ' => 'რ', - 'Ს' => 'ს', - 'Ტ' => 'ტ', - 'Უ' => 'უ', - 'Ფ' => 'ფ', - 'Ქ' => 'ქ', - 'Ღ' => 'ღ', - 'Ყ' => 'ყ', - 'Შ' => 'შ', - 'Ჩ' => 'ჩ', - 'Ც' => 'ც', - 'Ძ' => 'ძ', - 'Წ' => 'წ', - 'Ჭ' => 'ჭ', - 'Ხ' => 'ხ', - 'Ჯ' => 'ჯ', - 'Ჰ' => 'ჰ', - 'Ჱ' => 'ჱ', - 'Ჲ' => 'ჲ', - 'Ჳ' => 'ჳ', - 'Ჴ' => 'ჴ', - 'Ჵ' => 'ჵ', - 'Ჶ' => 'ჶ', - 'Ჷ' => 'ჷ', - 'Ჸ' => 'ჸ', - 'Ჹ' => 'ჹ', - 'Ჺ' => 'ჺ', - 'Ჽ' => 'ჽ', - 'Ჾ' => 'ჾ', - 'Ჿ' => 'ჿ', - 'Ḁ' => 'ḁ', - 'Ḃ' => 'ḃ', - 'Ḅ' => 'ḅ', - 'Ḇ' => 'ḇ', - 'Ḉ' => 'ḉ', - 'Ḋ' => 'ḋ', - 'Ḍ' => 'ḍ', - 'Ḏ' => 'ḏ', - 'Ḑ' => 'ḑ', - 'Ḓ' => 'ḓ', - 'Ḕ' => 'ḕ', - 'Ḗ' => 'ḗ', - 'Ḙ' => 'ḙ', - 'Ḛ' => 'ḛ', - 'Ḝ' => 'ḝ', - 'Ḟ' => 'ḟ', - 'Ḡ' => 'ḡ', - 'Ḣ' => 'ḣ', - 'Ḥ' => 'ḥ', - 'Ḧ' => 'ḧ', - 'Ḩ' => 'ḩ', - 'Ḫ' => 'ḫ', - 'Ḭ' => 'ḭ', - 'Ḯ' => 'ḯ', - 'Ḱ' => 'ḱ', - 'Ḳ' => 'ḳ', - 'Ḵ' => 'ḵ', - 'Ḷ' => 'ḷ', - 'Ḹ' => 'ḹ', - 'Ḻ' => 'ḻ', - 'Ḽ' => 'ḽ', - 'Ḿ' => 'ḿ', - 'Ṁ' => 'ṁ', - 'Ṃ' => 'ṃ', - 'Ṅ' => 'ṅ', - 'Ṇ' => 'ṇ', - 'Ṉ' => 'ṉ', - 'Ṋ' => 'ṋ', - 'Ṍ' => 'ṍ', - 'Ṏ' => 'ṏ', - 'Ṑ' => 'ṑ', - 'Ṓ' => 'ṓ', - 'Ṕ' => 'ṕ', - 'Ṗ' => 'ṗ', - 'Ṙ' => 'ṙ', - 'Ṛ' => 'ṛ', - 'Ṝ' => 'ṝ', - 'Ṟ' => 'ṟ', - 'Ṡ' => 'ṡ', - 'Ṣ' => 'ṣ', - 'Ṥ' => 'ṥ', - 'Ṧ' => 'ṧ', - 'Ṩ' => 'ṩ', - 'Ṫ' => 'ṫ', - 'Ṭ' => 'ṭ', - 'Ṯ' => 'ṯ', - 'Ṱ' => 'ṱ', - 'Ṳ' => 'ṳ', - 'Ṵ' => 'ṵ', - 'Ṷ' => 'ṷ', - 'Ṹ' => 'ṹ', - 'Ṻ' => 'ṻ', - 'Ṽ' => 'ṽ', - 'Ṿ' => 'ṿ', - 'Ẁ' => 'ẁ', - 'Ẃ' => 'ẃ', - 'Ẅ' => 'ẅ', - 'Ẇ' => 'ẇ', - 'Ẉ' => 'ẉ', - 'Ẋ' => 'ẋ', - 'Ẍ' => 'ẍ', - 'Ẏ' => 'ẏ', - 'Ẑ' => 'ẑ', - 'Ẓ' => 'ẓ', - 'Ẕ' => 'ẕ', - 'ẞ' => 'ß', - 'Ạ' => 'ạ', - 'Ả' => 'ả', - 'Ấ' => 'ấ', - 'Ầ' => 'ầ', - 'Ẩ' => 'ẩ', - 'Ẫ' => 'ẫ', - 'Ậ' => 'ậ', - 'Ắ' => 'ắ', - 'Ằ' => 'ằ', - 'Ẳ' => 'ẳ', - 'Ẵ' => 'ẵ', - 'Ặ' => 'ặ', - 'Ẹ' => 'ẹ', - 'Ẻ' => 'ẻ', - 'Ẽ' => 'ẽ', - 'Ế' => 'ế', - 'Ề' => 'ề', - 'Ể' => 'ể', - 'Ễ' => 'ễ', - 'Ệ' => 'ệ', - 'Ỉ' => 'ỉ', - 'Ị' => 'ị', - 'Ọ' => 'ọ', - 'Ỏ' => 'ỏ', - 'Ố' => 'ố', - 'Ồ' => 'ồ', - 'Ổ' => 'ổ', - 'Ỗ' => 'ỗ', - 'Ộ' => 'ộ', - 'Ớ' => 'ớ', - 'Ờ' => 'ờ', - 'Ở' => 'ở', - 'Ỡ' => 'ỡ', - 'Ợ' => 'ợ', - 'Ụ' => 'ụ', - 'Ủ' => 'ủ', - 'Ứ' => 'ứ', - 'Ừ' => 'ừ', - 'Ử' => 'ử', - 'Ữ' => 'ữ', - 'Ự' => 'ự', - 'Ỳ' => 'ỳ', - 'Ỵ' => 'ỵ', - 'Ỷ' => 'ỷ', - 'Ỹ' => 'ỹ', - 'Ỻ' => 'ỻ', - 'Ỽ' => 'ỽ', - 'Ỿ' => 'ỿ', - 'Ἀ' => 'ἀ', - 'Ἁ' => 'ἁ', - 'Ἂ' => 'ἂ', - 'Ἃ' => 'ἃ', - 'Ἄ' => 'ἄ', - 'Ἅ' => 'ἅ', - 'Ἆ' => 'ἆ', - 'Ἇ' => 'ἇ', - 'Ἐ' => 'ἐ', - 'Ἑ' => 'ἑ', - 'Ἒ' => 'ἒ', - 'Ἓ' => 'ἓ', - 'Ἔ' => 'ἔ', - 'Ἕ' => 'ἕ', - 'Ἠ' => 'ἠ', - 'Ἡ' => 'ἡ', - 'Ἢ' => 'ἢ', - 'Ἣ' => 'ἣ', - 'Ἤ' => 'ἤ', - 'Ἥ' => 'ἥ', - 'Ἦ' => 'ἦ', - 'Ἧ' => 'ἧ', - 'Ἰ' => 'ἰ', - 'Ἱ' => 'ἱ', - 'Ἲ' => 'ἲ', - 'Ἳ' => 'ἳ', - 'Ἴ' => 'ἴ', - 'Ἵ' => 'ἵ', - 'Ἶ' => 'ἶ', - 'Ἷ' => 'ἷ', - 'Ὀ' => 'ὀ', - 'Ὁ' => 'ὁ', - 'Ὂ' => 'ὂ', - 'Ὃ' => 'ὃ', - 'Ὄ' => 'ὄ', - 'Ὅ' => 'ὅ', - 'Ὑ' => 'ὑ', - 'Ὓ' => 'ὓ', - 'Ὕ' => 'ὕ', - 'Ὗ' => 'ὗ', - 'Ὠ' => 'ὠ', - 'Ὡ' => 'ὡ', - 'Ὢ' => 'ὢ', - 'Ὣ' => 'ὣ', - 'Ὤ' => 'ὤ', - 'Ὥ' => 'ὥ', - 'Ὦ' => 'ὦ', - 'Ὧ' => 'ὧ', - 'ᾈ' => 'ᾀ', - 'ᾉ' => 'ᾁ', - 'ᾊ' => 'ᾂ', - 'ᾋ' => 'ᾃ', - 'ᾌ' => 'ᾄ', - 'ᾍ' => 'ᾅ', - 'ᾎ' => 'ᾆ', - 'ᾏ' => 'ᾇ', - 'ᾘ' => 'ᾐ', - 'ᾙ' => 'ᾑ', - 'ᾚ' => 'ᾒ', - 'ᾛ' => 'ᾓ', - 'ᾜ' => 'ᾔ', - 'ᾝ' => 'ᾕ', - 'ᾞ' => 'ᾖ', - 'ᾟ' => 'ᾗ', - 'ᾨ' => 'ᾠ', - 'ᾩ' => 'ᾡ', - 'ᾪ' => 'ᾢ', - 'ᾫ' => 'ᾣ', - 'ᾬ' => 'ᾤ', - 'ᾭ' => 'ᾥ', - 'ᾮ' => 'ᾦ', - 'ᾯ' => 'ᾧ', - 'Ᾰ' => 'ᾰ', - 'Ᾱ' => 'ᾱ', - 'Ὰ' => 'ὰ', - 'Ά' => 'ά', - 'ᾼ' => 'ᾳ', - 'Ὲ' => 'ὲ', - 'Έ' => 'έ', - 'Ὴ' => 'ὴ', - 'Ή' => 'ή', - 'ῌ' => 'ῃ', - 'Ῐ' => 'ῐ', - 'Ῑ' => 'ῑ', - 'Ὶ' => 'ὶ', - 'Ί' => 'ί', - 'Ῠ' => 'ῠ', - 'Ῡ' => 'ῡ', - 'Ὺ' => 'ὺ', - 'Ύ' => 'ύ', - 'Ῥ' => 'ῥ', - 'Ὸ' => 'ὸ', - 'Ό' => 'ό', - 'Ὼ' => 'ὼ', - 'Ώ' => 'ώ', - 'ῼ' => 'ῳ', - 'Ω' => 'ω', - 'K' => 'k', - 'Å' => 'å', - 'Ⅎ' => 'ⅎ', - 'Ⅰ' => 'ⅰ', - 'Ⅱ' => 'ⅱ', - 'Ⅲ' => 'ⅲ', - 'Ⅳ' => 'ⅳ', - 'Ⅴ' => 'ⅴ', - 'Ⅵ' => 'ⅵ', - 'Ⅶ' => 'ⅶ', - 'Ⅷ' => 'ⅷ', - 'Ⅸ' => 'ⅸ', - 'Ⅹ' => 'ⅹ', - 'Ⅺ' => 'ⅺ', - 'Ⅻ' => 'ⅻ', - 'Ⅼ' => 'ⅼ', - 'Ⅽ' => 'ⅽ', - 'Ⅾ' => 'ⅾ', - 'Ⅿ' => 'ⅿ', - 'Ↄ' => 'ↄ', - 'Ⓐ' => 'ⓐ', - 'Ⓑ' => 'ⓑ', - 'Ⓒ' => 'ⓒ', - 'Ⓓ' => 'ⓓ', - 'Ⓔ' => 'ⓔ', - 'Ⓕ' => 'ⓕ', - 'Ⓖ' => 'ⓖ', - 'Ⓗ' => 'ⓗ', - 'Ⓘ' => 'ⓘ', - 'Ⓙ' => 'ⓙ', - 'Ⓚ' => 'ⓚ', - 'Ⓛ' => 'ⓛ', - 'Ⓜ' => 'ⓜ', - 'Ⓝ' => 'ⓝ', - 'Ⓞ' => 'ⓞ', - 'Ⓟ' => 'ⓟ', - 'Ⓠ' => 'ⓠ', - 'Ⓡ' => 'ⓡ', - 'Ⓢ' => 'ⓢ', - 'Ⓣ' => 'ⓣ', - 'Ⓤ' => 'ⓤ', - 'Ⓥ' => 'ⓥ', - 'Ⓦ' => 'ⓦ', - 'Ⓧ' => 'ⓧ', - 'Ⓨ' => 'ⓨ', - 'Ⓩ' => 'ⓩ', - 'Ⰰ' => 'ⰰ', - 'Ⰱ' => 'ⰱ', - 'Ⰲ' => 'ⰲ', - 'Ⰳ' => 'ⰳ', - 'Ⰴ' => 'ⰴ', - 'Ⰵ' => 'ⰵ', - 'Ⰶ' => 'ⰶ', - 'Ⰷ' => 'ⰷ', - 'Ⰸ' => 'ⰸ', - 'Ⰹ' => 'ⰹ', - 'Ⰺ' => 'ⰺ', - 'Ⰻ' => 'ⰻ', - 'Ⰼ' => 'ⰼ', - 'Ⰽ' => 'ⰽ', - 'Ⰾ' => 'ⰾ', - 'Ⰿ' => 'ⰿ', - 'Ⱀ' => 'ⱀ', - 'Ⱁ' => 'ⱁ', - 'Ⱂ' => 'ⱂ', - 'Ⱃ' => 'ⱃ', - 'Ⱄ' => 'ⱄ', - 'Ⱅ' => 'ⱅ', - 'Ⱆ' => 'ⱆ', - 'Ⱇ' => 'ⱇ', - 'Ⱈ' => 'ⱈ', - 'Ⱉ' => 'ⱉ', - 'Ⱊ' => 'ⱊ', - 'Ⱋ' => 'ⱋ', - 'Ⱌ' => 'ⱌ', - 'Ⱍ' => 'ⱍ', - 'Ⱎ' => 'ⱎ', - 'Ⱏ' => 'ⱏ', - 'Ⱐ' => 'ⱐ', - 'Ⱑ' => 'ⱑ', - 'Ⱒ' => 'ⱒ', - 'Ⱓ' => 'ⱓ', - 'Ⱔ' => 'ⱔ', - 'Ⱕ' => 'ⱕ', - 'Ⱖ' => 'ⱖ', - 'Ⱗ' => 'ⱗ', - 'Ⱘ' => 'ⱘ', - 'Ⱙ' => 'ⱙ', - 'Ⱚ' => 'ⱚ', - 'Ⱛ' => 'ⱛ', - 'Ⱜ' => 'ⱜ', - 'Ⱝ' => 'ⱝ', - 'Ⱞ' => 'ⱞ', - 'Ⱡ' => 'ⱡ', - 'Ɫ' => 'ɫ', - 'Ᵽ' => 'ᵽ', - 'Ɽ' => 'ɽ', - 'Ⱨ' => 'ⱨ', - 'Ⱪ' => 'ⱪ', - 'Ⱬ' => 'ⱬ', - 'Ɑ' => 'ɑ', - 'Ɱ' => 'ɱ', - 'Ɐ' => 'ɐ', - 'Ɒ' => 'ɒ', - 'Ⱳ' => 'ⱳ', - 'Ⱶ' => 'ⱶ', - 'Ȿ' => 'ȿ', - 'Ɀ' => 'ɀ', - 'Ⲁ' => 'ⲁ', - 'Ⲃ' => 'ⲃ', - 'Ⲅ' => 'ⲅ', - 'Ⲇ' => 'ⲇ', - 'Ⲉ' => 'ⲉ', - 'Ⲋ' => 'ⲋ', - 'Ⲍ' => 'ⲍ', - 'Ⲏ' => 'ⲏ', - 'Ⲑ' => 'ⲑ', - 'Ⲓ' => 'ⲓ', - 'Ⲕ' => 'ⲕ', - 'Ⲗ' => 'ⲗ', - 'Ⲙ' => 'ⲙ', - 'Ⲛ' => 'ⲛ', - 'Ⲝ' => 'ⲝ', - 'Ⲟ' => 'ⲟ', - 'Ⲡ' => 'ⲡ', - 'Ⲣ' => 'ⲣ', - 'Ⲥ' => 'ⲥ', - 'Ⲧ' => 'ⲧ', - 'Ⲩ' => 'ⲩ', - 'Ⲫ' => 'ⲫ', - 'Ⲭ' => 'ⲭ', - 'Ⲯ' => 'ⲯ', - 'Ⲱ' => 'ⲱ', - 'Ⲳ' => 'ⲳ', - 'Ⲵ' => 'ⲵ', - 'Ⲷ' => 'ⲷ', - 'Ⲹ' => 'ⲹ', - 'Ⲻ' => 'ⲻ', - 'Ⲽ' => 'ⲽ', - 'Ⲿ' => 'ⲿ', - 'Ⳁ' => 'ⳁ', - 'Ⳃ' => 'ⳃ', - 'Ⳅ' => 'ⳅ', - 'Ⳇ' => 'ⳇ', - 'Ⳉ' => 'ⳉ', - 'Ⳋ' => 'ⳋ', - 'Ⳍ' => 'ⳍ', - 'Ⳏ' => 'ⳏ', - 'Ⳑ' => 'ⳑ', - 'Ⳓ' => 'ⳓ', - 'Ⳕ' => 'ⳕ', - 'Ⳗ' => 'ⳗ', - 'Ⳙ' => 'ⳙ', - 'Ⳛ' => 'ⳛ', - 'Ⳝ' => 'ⳝ', - 'Ⳟ' => 'ⳟ', - 'Ⳡ' => 'ⳡ', - 'Ⳣ' => 'ⳣ', - 'Ⳬ' => 'ⳬ', - 'Ⳮ' => 'ⳮ', - 'Ⳳ' => 'ⳳ', - 'Ꙁ' => 'ꙁ', - 'Ꙃ' => 'ꙃ', - 'Ꙅ' => 'ꙅ', - 'Ꙇ' => 'ꙇ', - 'Ꙉ' => 'ꙉ', - 'Ꙋ' => 'ꙋ', - 'Ꙍ' => 'ꙍ', - 'Ꙏ' => 'ꙏ', - 'Ꙑ' => 'ꙑ', - 'Ꙓ' => 'ꙓ', - 'Ꙕ' => 'ꙕ', - 'Ꙗ' => 'ꙗ', - 'Ꙙ' => 'ꙙ', - 'Ꙛ' => 'ꙛ', - 'Ꙝ' => 'ꙝ', - 'Ꙟ' => 'ꙟ', - 'Ꙡ' => 'ꙡ', - 'Ꙣ' => 'ꙣ', - 'Ꙥ' => 'ꙥ', - 'Ꙧ' => 'ꙧ', - 'Ꙩ' => 'ꙩ', - 'Ꙫ' => 'ꙫ', - 'Ꙭ' => 'ꙭ', - 'Ꚁ' => 'ꚁ', - 'Ꚃ' => 'ꚃ', - 'Ꚅ' => 'ꚅ', - 'Ꚇ' => 'ꚇ', - 'Ꚉ' => 'ꚉ', - 'Ꚋ' => 'ꚋ', - 'Ꚍ' => 'ꚍ', - 'Ꚏ' => 'ꚏ', - 'Ꚑ' => 'ꚑ', - 'Ꚓ' => 'ꚓ', - 'Ꚕ' => 'ꚕ', - 'Ꚗ' => 'ꚗ', - 'Ꚙ' => 'ꚙ', - 'Ꚛ' => 'ꚛ', - 'Ꜣ' => 'ꜣ', - 'Ꜥ' => 'ꜥ', - 'Ꜧ' => 'ꜧ', - 'Ꜩ' => 'ꜩ', - 'Ꜫ' => 'ꜫ', - 'Ꜭ' => 'ꜭ', - 'Ꜯ' => 'ꜯ', - 'Ꜳ' => 'ꜳ', - 'Ꜵ' => 'ꜵ', - 'Ꜷ' => 'ꜷ', - 'Ꜹ' => 'ꜹ', - 'Ꜻ' => 'ꜻ', - 'Ꜽ' => 'ꜽ', - 'Ꜿ' => 'ꜿ', - 'Ꝁ' => 'ꝁ', - 'Ꝃ' => 'ꝃ', - 'Ꝅ' => 'ꝅ', - 'Ꝇ' => 'ꝇ', - 'Ꝉ' => 'ꝉ', - 'Ꝋ' => 'ꝋ', - 'Ꝍ' => 'ꝍ', - 'Ꝏ' => 'ꝏ', - 'Ꝑ' => 'ꝑ', - 'Ꝓ' => 'ꝓ', - 'Ꝕ' => 'ꝕ', - 'Ꝗ' => 'ꝗ', - 'Ꝙ' => 'ꝙ', - 'Ꝛ' => 'ꝛ', - 'Ꝝ' => 'ꝝ', - 'Ꝟ' => 'ꝟ', - 'Ꝡ' => 'ꝡ', - 'Ꝣ' => 'ꝣ', - 'Ꝥ' => 'ꝥ', - 'Ꝧ' => 'ꝧ', - 'Ꝩ' => 'ꝩ', - 'Ꝫ' => 'ꝫ', - 'Ꝭ' => 'ꝭ', - 'Ꝯ' => 'ꝯ', - 'Ꝺ' => 'ꝺ', - 'Ꝼ' => 'ꝼ', - 'Ᵹ' => 'ᵹ', - 'Ꝿ' => 'ꝿ', - 'Ꞁ' => 'ꞁ', - 'Ꞃ' => 'ꞃ', - 'Ꞅ' => 'ꞅ', - 'Ꞇ' => 'ꞇ', - 'Ꞌ' => 'ꞌ', - 'Ɥ' => 'ɥ', - 'Ꞑ' => 'ꞑ', - 'Ꞓ' => 'ꞓ', - 'Ꞗ' => 'ꞗ', - 'Ꞙ' => 'ꞙ', - 'Ꞛ' => 'ꞛ', - 'Ꞝ' => 'ꞝ', - 'Ꞟ' => 'ꞟ', - 'Ꞡ' => 'ꞡ', - 'Ꞣ' => 'ꞣ', - 'Ꞥ' => 'ꞥ', - 'Ꞧ' => 'ꞧ', - 'Ꞩ' => 'ꞩ', - 'Ɦ' => 'ɦ', - 'Ɜ' => 'ɜ', - 'Ɡ' => 'ɡ', - 'Ɬ' => 'ɬ', - 'Ɪ' => 'ɪ', - 'Ʞ' => 'ʞ', - 'Ʇ' => 'ʇ', - 'Ʝ' => 'ʝ', - 'Ꭓ' => 'ꭓ', - 'Ꞵ' => 'ꞵ', - 'Ꞷ' => 'ꞷ', - 'Ꞹ' => 'ꞹ', - 'Ꞻ' => 'ꞻ', - 'Ꞽ' => 'ꞽ', - 'Ꞿ' => 'ꞿ', - 'Ꟃ' => 'ꟃ', - 'Ꞔ' => 'ꞔ', - 'Ʂ' => 'ʂ', - 'Ᶎ' => 'ᶎ', - 'Ꟈ' => 'ꟈ', - 'Ꟊ' => 'ꟊ', - 'Ꟶ' => 'ꟶ', - 'A' => 'a', - 'B' => 'b', - 'C' => 'c', - 'D' => 'd', - 'E' => 'e', - 'F' => 'f', - 'G' => 'g', - 'H' => 'h', - 'I' => 'i', - 'J' => 'j', - 'K' => 'k', - 'L' => 'l', - 'M' => 'm', - 'N' => 'n', - 'O' => 'o', - 'P' => 'p', - 'Q' => 'q', - 'R' => 'r', - 'S' => 's', - 'T' => 't', - 'U' => 'u', - 'V' => 'v', - 'W' => 'w', - 'X' => 'x', - 'Y' => 'y', - 'Z' => 'z', - '𐐀' => '𐐨', - '𐐁' => '𐐩', - '𐐂' => '𐐪', - '𐐃' => '𐐫', - '𐐄' => '𐐬', - '𐐅' => '𐐭', - '𐐆' => '𐐮', - '𐐇' => '𐐯', - '𐐈' => '𐐰', - '𐐉' => '𐐱', - '𐐊' => '𐐲', - '𐐋' => '𐐳', - '𐐌' => '𐐴', - '𐐍' => '𐐵', - '𐐎' => '𐐶', - '𐐏' => '𐐷', - '𐐐' => '𐐸', - '𐐑' => '𐐹', - '𐐒' => '𐐺', - '𐐓' => '𐐻', - '𐐔' => '𐐼', - '𐐕' => '𐐽', - '𐐖' => '𐐾', - '𐐗' => '𐐿', - '𐐘' => '𐑀', - '𐐙' => '𐑁', - '𐐚' => '𐑂', - '𐐛' => '𐑃', - '𐐜' => '𐑄', - '𐐝' => '𐑅', - '𐐞' => '𐑆', - '𐐟' => '𐑇', - '𐐠' => '𐑈', - '𐐡' => '𐑉', - '𐐢' => '𐑊', - '𐐣' => '𐑋', - '𐐤' => '𐑌', - '𐐥' => '𐑍', - '𐐦' => '𐑎', - '𐐧' => '𐑏', - '𐒰' => '𐓘', - '𐒱' => '𐓙', - '𐒲' => '𐓚', - '𐒳' => '𐓛', - '𐒴' => '𐓜', - '𐒵' => '𐓝', - '𐒶' => '𐓞', - '𐒷' => '𐓟', - '𐒸' => '𐓠', - '𐒹' => '𐓡', - '𐒺' => '𐓢', - '𐒻' => '𐓣', - '𐒼' => '𐓤', - '𐒽' => '𐓥', - '𐒾' => '𐓦', - '𐒿' => '𐓧', - '𐓀' => '𐓨', - '𐓁' => '𐓩', - '𐓂' => '𐓪', - '𐓃' => '𐓫', - '𐓄' => '𐓬', - '𐓅' => '𐓭', - '𐓆' => '𐓮', - '𐓇' => '𐓯', - '𐓈' => '𐓰', - '𐓉' => '𐓱', - '𐓊' => '𐓲', - '𐓋' => '𐓳', - '𐓌' => '𐓴', - '𐓍' => '𐓵', - '𐓎' => '𐓶', - '𐓏' => '𐓷', - '𐓐' => '𐓸', - '𐓑' => '𐓹', - '𐓒' => '𐓺', - '𐓓' => '𐓻', - '𐲀' => '𐳀', - '𐲁' => '𐳁', - '𐲂' => '𐳂', - '𐲃' => '𐳃', - '𐲄' => '𐳄', - '𐲅' => '𐳅', - '𐲆' => '𐳆', - '𐲇' => '𐳇', - '𐲈' => '𐳈', - '𐲉' => '𐳉', - '𐲊' => '𐳊', - '𐲋' => '𐳋', - '𐲌' => '𐳌', - '𐲍' => '𐳍', - '𐲎' => '𐳎', - '𐲏' => '𐳏', - '𐲐' => '𐳐', - '𐲑' => '𐳑', - '𐲒' => '𐳒', - '𐲓' => '𐳓', - '𐲔' => '𐳔', - '𐲕' => '𐳕', - '𐲖' => '𐳖', - '𐲗' => '𐳗', - '𐲘' => '𐳘', - '𐲙' => '𐳙', - '𐲚' => '𐳚', - '𐲛' => '𐳛', - '𐲜' => '𐳜', - '𐲝' => '𐳝', - '𐲞' => '𐳞', - '𐲟' => '𐳟', - '𐲠' => '𐳠', - '𐲡' => '𐳡', - '𐲢' => '𐳢', - '𐲣' => '𐳣', - '𐲤' => '𐳤', - '𐲥' => '𐳥', - '𐲦' => '𐳦', - '𐲧' => '𐳧', - '𐲨' => '𐳨', - '𐲩' => '𐳩', - '𐲪' => '𐳪', - '𐲫' => '𐳫', - '𐲬' => '𐳬', - '𐲭' => '𐳭', - '𐲮' => '𐳮', - '𐲯' => '𐳯', - '𐲰' => '𐳰', - '𐲱' => '𐳱', - '𐲲' => '𐳲', - '𑢠' => '𑣀', - '𑢡' => '𑣁', - '𑢢' => '𑣂', - '𑢣' => '𑣃', - '𑢤' => '𑣄', - '𑢥' => '𑣅', - '𑢦' => '𑣆', - '𑢧' => '𑣇', - '𑢨' => '𑣈', - '𑢩' => '𑣉', - '𑢪' => '𑣊', - '𑢫' => '𑣋', - '𑢬' => '𑣌', - '𑢭' => '𑣍', - '𑢮' => '𑣎', - '𑢯' => '𑣏', - '𑢰' => '𑣐', - '𑢱' => '𑣑', - '𑢲' => '𑣒', - '𑢳' => '𑣓', - '𑢴' => '𑣔', - '𑢵' => '𑣕', - '𑢶' => '𑣖', - '𑢷' => '𑣗', - '𑢸' => '𑣘', - '𑢹' => '𑣙', - '𑢺' => '𑣚', - '𑢻' => '𑣛', - '𑢼' => '𑣜', - '𑢽' => '𑣝', - '𑢾' => '𑣞', - '𑢿' => '𑣟', - '𖹀' => '𖹠', - '𖹁' => '𖹡', - '𖹂' => '𖹢', - '𖹃' => '𖹣', - '𖹄' => '𖹤', - '𖹅' => '𖹥', - '𖹆' => '𖹦', - '𖹇' => '𖹧', - '𖹈' => '𖹨', - '𖹉' => '𖹩', - '𖹊' => '𖹪', - '𖹋' => '𖹫', - '𖹌' => '𖹬', - '𖹍' => '𖹭', - '𖹎' => '𖹮', - '𖹏' => '𖹯', - '𖹐' => '𖹰', - '𖹑' => '𖹱', - '𖹒' => '𖹲', - '𖹓' => '𖹳', - '𖹔' => '𖹴', - '𖹕' => '𖹵', - '𖹖' => '𖹶', - '𖹗' => '𖹷', - '𖹘' => '𖹸', - '𖹙' => '𖹹', - '𖹚' => '𖹺', - '𖹛' => '𖹻', - '𖹜' => '𖹼', - '𖹝' => '𖹽', - '𖹞' => '𖹾', - '𖹟' => '𖹿', - '𞤀' => '𞤢', - '𞤁' => '𞤣', - '𞤂' => '𞤤', - '𞤃' => '𞤥', - '𞤄' => '𞤦', - '𞤅' => '𞤧', - '𞤆' => '𞤨', - '𞤇' => '𞤩', - '𞤈' => '𞤪', - '𞤉' => '𞤫', - '𞤊' => '𞤬', - '𞤋' => '𞤭', - '𞤌' => '𞤮', - '𞤍' => '𞤯', - '𞤎' => '𞤰', - '𞤏' => '𞤱', - '𞤐' => '𞤲', - '𞤑' => '𞤳', - '𞤒' => '𞤴', - '𞤓' => '𞤵', - '𞤔' => '𞤶', - '𞤕' => '𞤷', - '𞤖' => '𞤸', - '𞤗' => '𞤹', - '𞤘' => '𞤺', - '𞤙' => '𞤻', - '𞤚' => '𞤼', - '𞤛' => '𞤽', - '𞤜' => '𞤾', - '𞤝' => '𞤿', - '𞤞' => '𞥀', - '𞤟' => '𞥁', - '𞤠' => '𞥂', - '𞤡' => '𞥃', -); + 'a', + 'B' => 'b', + 'C' => 'c', + 'D' => 'd', + 'E' => 'e', + 'F' => 'f', + 'G' => 'g', + 'H' => 'h', + 'I' => 'i', + 'J' => 'j', + 'K' => 'k', + 'L' => 'l', + 'M' => 'm', + 'N' => 'n', + 'O' => 'o', + 'P' => 'p', + 'Q' => 'q', + 'R' => 'r', + 'S' => 's', + 'T' => 't', + 'U' => 'u', + 'V' => 'v', + 'W' => 'w', + 'X' => 'x', + 'Y' => 'y', + 'Z' => 'z', + 'À' => 'à', + 'Á' => 'á', + 'Â' => 'â', + 'Ã' => 'ã', + 'Ä' => 'ä', + 'Å' => 'å', + 'Æ' => 'æ', + 'Ç' => 'ç', + 'È' => 'è', + 'É' => 'é', + 'Ê' => 'ê', + 'Ë' => 'ë', + 'Ì' => 'ì', + 'Í' => 'í', + 'Î' => 'î', + 'Ï' => 'ï', + 'Ð' => 'ð', + 'Ñ' => 'ñ', + 'Ò' => 'ò', + 'Ó' => 'ó', + 'Ô' => 'ô', + 'Õ' => 'õ', + 'Ö' => 'ö', + 'Ø' => 'ø', + 'Ù' => 'ù', + 'Ú' => 'ú', + 'Û' => 'û', + 'Ü' => 'ü', + 'Ý' => 'ý', + 'Þ' => 'þ', + 'Ā' => 'ā', + 'Ă' => 'ă', + 'Ą' => 'ą', + 'Ć' => 'ć', + 'Ĉ' => 'ĉ', + 'Ċ' => 'ċ', + 'Č' => 'č', + 'Ď' => 'ď', + 'Đ' => 'đ', + 'Ē' => 'ē', + 'Ĕ' => 'ĕ', + 'Ė' => 'ė', + 'Ę' => 'ę', + 'Ě' => 'ě', + 'Ĝ' => 'ĝ', + 'Ğ' => 'ğ', + 'Ġ' => 'ġ', + 'Ģ' => 'ģ', + 'Ĥ' => 'ĥ', + 'Ħ' => 'ħ', + 'Ĩ' => 'ĩ', + 'Ī' => 'ī', + 'Ĭ' => 'ĭ', + 'Į' => 'į', + 'İ' => 'i̇', + 'IJ' => 'ij', + 'Ĵ' => 'ĵ', + 'Ķ' => 'ķ', + 'Ĺ' => 'ĺ', + 'Ļ' => 'ļ', + 'Ľ' => 'ľ', + 'Ŀ' => 'ŀ', + 'Ł' => 'ł', + 'Ń' => 'ń', + 'Ņ' => 'ņ', + 'Ň' => 'ň', + 'Ŋ' => 'ŋ', + 'Ō' => 'ō', + 'Ŏ' => 'ŏ', + 'Ő' => 'ő', + 'Œ' => 'œ', + 'Ŕ' => 'ŕ', + 'Ŗ' => 'ŗ', + 'Ř' => 'ř', + 'Ś' => 'ś', + 'Ŝ' => 'ŝ', + 'Ş' => 'ş', + 'Š' => 'š', + 'Ţ' => 'ţ', + 'Ť' => 'ť', + 'Ŧ' => 'ŧ', + 'Ũ' => 'ũ', + 'Ū' => 'ū', + 'Ŭ' => 'ŭ', + 'Ů' => 'ů', + 'Ű' => 'ű', + 'Ų' => 'ų', + 'Ŵ' => 'ŵ', + 'Ŷ' => 'ŷ', + 'Ÿ' => 'ÿ', + 'Ź' => 'ź', + 'Ż' => 'ż', + 'Ž' => 'ž', + 'Ɓ' => 'ɓ', + 'Ƃ' => 'ƃ', + 'Ƅ' => 'ƅ', + 'Ɔ' => 'ɔ', + 'Ƈ' => 'ƈ', + 'Ɖ' => 'ɖ', + 'Ɗ' => 'ɗ', + 'Ƌ' => 'ƌ', + 'Ǝ' => 'ǝ', + 'Ə' => 'ə', + 'Ɛ' => 'ɛ', + 'Ƒ' => 'ƒ', + 'Ɠ' => 'ɠ', + 'Ɣ' => 'ɣ', + 'Ɩ' => 'ɩ', + 'Ɨ' => 'ɨ', + 'Ƙ' => 'ƙ', + 'Ɯ' => 'ɯ', + 'Ɲ' => 'ɲ', + 'Ɵ' => 'ɵ', + 'Ơ' => 'ơ', + 'Ƣ' => 'ƣ', + 'Ƥ' => 'ƥ', + 'Ʀ' => 'ʀ', + 'Ƨ' => 'ƨ', + 'Ʃ' => 'ʃ', + 'Ƭ' => 'ƭ', + 'Ʈ' => 'ʈ', + 'Ư' => 'ư', + 'Ʊ' => 'ʊ', + 'Ʋ' => 'ʋ', + 'Ƴ' => 'ƴ', + 'Ƶ' => 'ƶ', + 'Ʒ' => 'ʒ', + 'Ƹ' => 'ƹ', + 'Ƽ' => 'ƽ', + 'DŽ' => 'dž', + 'Dž' => 'dž', + 'LJ' => 'lj', + 'Lj' => 'lj', + 'NJ' => 'nj', + 'Nj' => 'nj', + 'Ǎ' => 'ǎ', + 'Ǐ' => 'ǐ', + 'Ǒ' => 'ǒ', + 'Ǔ' => 'ǔ', + 'Ǖ' => 'ǖ', + 'Ǘ' => 'ǘ', + 'Ǚ' => 'ǚ', + 'Ǜ' => 'ǜ', + 'Ǟ' => 'ǟ', + 'Ǡ' => 'ǡ', + 'Ǣ' => 'ǣ', + 'Ǥ' => 'ǥ', + 'Ǧ' => 'ǧ', + 'Ǩ' => 'ǩ', + 'Ǫ' => 'ǫ', + 'Ǭ' => 'ǭ', + 'Ǯ' => 'ǯ', + 'DZ' => 'dz', + 'Dz' => 'dz', + 'Ǵ' => 'ǵ', + 'Ƕ' => 'ƕ', + 'Ƿ' => 'ƿ', + 'Ǹ' => 'ǹ', + 'Ǻ' => 'ǻ', + 'Ǽ' => 'ǽ', + 'Ǿ' => 'ǿ', + 'Ȁ' => 'ȁ', + 'Ȃ' => 'ȃ', + 'Ȅ' => 'ȅ', + 'Ȇ' => 'ȇ', + 'Ȉ' => 'ȉ', + 'Ȋ' => 'ȋ', + 'Ȍ' => 'ȍ', + 'Ȏ' => 'ȏ', + 'Ȑ' => 'ȑ', + 'Ȓ' => 'ȓ', + 'Ȕ' => 'ȕ', + 'Ȗ' => 'ȗ', + 'Ș' => 'ș', + 'Ț' => 'ț', + 'Ȝ' => 'ȝ', + 'Ȟ' => 'ȟ', + 'Ƞ' => 'ƞ', + 'Ȣ' => 'ȣ', + 'Ȥ' => 'ȥ', + 'Ȧ' => 'ȧ', + 'Ȩ' => 'ȩ', + 'Ȫ' => 'ȫ', + 'Ȭ' => 'ȭ', + 'Ȯ' => 'ȯ', + 'Ȱ' => 'ȱ', + 'Ȳ' => 'ȳ', + 'Ⱥ' => 'ⱥ', + 'Ȼ' => 'ȼ', + 'Ƚ' => 'ƚ', + 'Ⱦ' => 'ⱦ', + 'Ɂ' => 'ɂ', + 'Ƀ' => 'ƀ', + 'Ʉ' => 'ʉ', + 'Ʌ' => 'ʌ', + 'Ɇ' => 'ɇ', + 'Ɉ' => 'ɉ', + 'Ɋ' => 'ɋ', + 'Ɍ' => 'ɍ', + 'Ɏ' => 'ɏ', + 'Ͱ' => 'ͱ', + 'Ͳ' => 'ͳ', + 'Ͷ' => 'ͷ', + 'Ϳ' => 'ϳ', + 'Ά' => 'ά', + 'Έ' => 'έ', + 'Ή' => 'ή', + 'Ί' => 'ί', + 'Ό' => 'ό', + 'Ύ' => 'ύ', + 'Ώ' => 'ώ', + 'Α' => 'α', + 'Β' => 'β', + 'Γ' => 'γ', + 'Δ' => 'δ', + 'Ε' => 'ε', + 'Ζ' => 'ζ', + 'Η' => 'η', + 'Θ' => 'θ', + 'Ι' => 'ι', + 'Κ' => 'κ', + 'Λ' => 'λ', + 'Μ' => 'μ', + 'Ν' => 'ν', + 'Ξ' => 'ξ', + 'Ο' => 'ο', + 'Π' => 'π', + 'Ρ' => 'ρ', + 'Σ' => 'σ', + 'Τ' => 'τ', + 'Υ' => 'υ', + 'Φ' => 'φ', + 'Χ' => 'χ', + 'Ψ' => 'ψ', + 'Ω' => 'ω', + 'Ϊ' => 'ϊ', + 'Ϋ' => 'ϋ', + 'Ϗ' => 'ϗ', + 'Ϙ' => 'ϙ', + 'Ϛ' => 'ϛ', + 'Ϝ' => 'ϝ', + 'Ϟ' => 'ϟ', + 'Ϡ' => 'ϡ', + 'Ϣ' => 'ϣ', + 'Ϥ' => 'ϥ', + 'Ϧ' => 'ϧ', + 'Ϩ' => 'ϩ', + 'Ϫ' => 'ϫ', + 'Ϭ' => 'ϭ', + 'Ϯ' => 'ϯ', + 'ϴ' => 'θ', + 'Ϸ' => 'ϸ', + 'Ϲ' => 'ϲ', + 'Ϻ' => 'ϻ', + 'Ͻ' => 'ͻ', + 'Ͼ' => 'ͼ', + 'Ͽ' => 'ͽ', + 'Ѐ' => 'ѐ', + 'Ё' => 'ё', + 'Ђ' => 'ђ', + 'Ѓ' => 'ѓ', + 'Є' => 'є', + 'Ѕ' => 'ѕ', + 'І' => 'і', + 'Ї' => 'ї', + 'Ј' => 'ј', + 'Љ' => 'љ', + 'Њ' => 'њ', + 'Ћ' => 'ћ', + 'Ќ' => 'ќ', + 'Ѝ' => 'ѝ', + 'Ў' => 'ў', + 'Џ' => 'џ', + 'А' => 'а', + 'Б' => 'б', + 'В' => 'в', + 'Г' => 'г', + 'Д' => 'д', + 'Е' => 'е', + 'Ж' => 'ж', + 'З' => 'з', + 'И' => 'и', + 'Й' => 'й', + 'К' => 'к', + 'Л' => 'л', + 'М' => 'м', + 'Н' => 'н', + 'О' => 'о', + 'П' => 'п', + 'Р' => 'р', + 'С' => 'с', + 'Т' => 'т', + 'У' => 'у', + 'Ф' => 'ф', + 'Х' => 'х', + 'Ц' => 'ц', + 'Ч' => 'ч', + 'Ш' => 'ш', + 'Щ' => 'щ', + 'Ъ' => 'ъ', + 'Ы' => 'ы', + 'Ь' => 'ь', + 'Э' => 'э', + 'Ю' => 'ю', + 'Я' => 'я', + 'Ѡ' => 'ѡ', + 'Ѣ' => 'ѣ', + 'Ѥ' => 'ѥ', + 'Ѧ' => 'ѧ', + 'Ѩ' => 'ѩ', + 'Ѫ' => 'ѫ', + 'Ѭ' => 'ѭ', + 'Ѯ' => 'ѯ', + 'Ѱ' => 'ѱ', + 'Ѳ' => 'ѳ', + 'Ѵ' => 'ѵ', + 'Ѷ' => 'ѷ', + 'Ѹ' => 'ѹ', + 'Ѻ' => 'ѻ', + 'Ѽ' => 'ѽ', + 'Ѿ' => 'ѿ', + 'Ҁ' => 'ҁ', + 'Ҋ' => 'ҋ', + 'Ҍ' => 'ҍ', + 'Ҏ' => 'ҏ', + 'Ґ' => 'ґ', + 'Ғ' => 'ғ', + 'Ҕ' => 'ҕ', + 'Җ' => 'җ', + 'Ҙ' => 'ҙ', + 'Қ' => 'қ', + 'Ҝ' => 'ҝ', + 'Ҟ' => 'ҟ', + 'Ҡ' => 'ҡ', + 'Ң' => 'ң', + 'Ҥ' => 'ҥ', + 'Ҧ' => 'ҧ', + 'Ҩ' => 'ҩ', + 'Ҫ' => 'ҫ', + 'Ҭ' => 'ҭ', + 'Ү' => 'ү', + 'Ұ' => 'ұ', + 'Ҳ' => 'ҳ', + 'Ҵ' => 'ҵ', + 'Ҷ' => 'ҷ', + 'Ҹ' => 'ҹ', + 'Һ' => 'һ', + 'Ҽ' => 'ҽ', + 'Ҿ' => 'ҿ', + 'Ӏ' => 'ӏ', + 'Ӂ' => 'ӂ', + 'Ӄ' => 'ӄ', + 'Ӆ' => 'ӆ', + 'Ӈ' => 'ӈ', + 'Ӊ' => 'ӊ', + 'Ӌ' => 'ӌ', + 'Ӎ' => 'ӎ', + 'Ӑ' => 'ӑ', + 'Ӓ' => 'ӓ', + 'Ӕ' => 'ӕ', + 'Ӗ' => 'ӗ', + 'Ә' => 'ә', + 'Ӛ' => 'ӛ', + 'Ӝ' => 'ӝ', + 'Ӟ' => 'ӟ', + 'Ӡ' => 'ӡ', + 'Ӣ' => 'ӣ', + 'Ӥ' => 'ӥ', + 'Ӧ' => 'ӧ', + 'Ө' => 'ө', + 'Ӫ' => 'ӫ', + 'Ӭ' => 'ӭ', + 'Ӯ' => 'ӯ', + 'Ӱ' => 'ӱ', + 'Ӳ' => 'ӳ', + 'Ӵ' => 'ӵ', + 'Ӷ' => 'ӷ', + 'Ӹ' => 'ӹ', + 'Ӻ' => 'ӻ', + 'Ӽ' => 'ӽ', + 'Ӿ' => 'ӿ', + 'Ԁ' => 'ԁ', + 'Ԃ' => 'ԃ', + 'Ԅ' => 'ԅ', + 'Ԇ' => 'ԇ', + 'Ԉ' => 'ԉ', + 'Ԋ' => 'ԋ', + 'Ԍ' => 'ԍ', + 'Ԏ' => 'ԏ', + 'Ԑ' => 'ԑ', + 'Ԓ' => 'ԓ', + 'Ԕ' => 'ԕ', + 'Ԗ' => 'ԗ', + 'Ԙ' => 'ԙ', + 'Ԛ' => 'ԛ', + 'Ԝ' => 'ԝ', + 'Ԟ' => 'ԟ', + 'Ԡ' => 'ԡ', + 'Ԣ' => 'ԣ', + 'Ԥ' => 'ԥ', + 'Ԧ' => 'ԧ', + 'Ԩ' => 'ԩ', + 'Ԫ' => 'ԫ', + 'Ԭ' => 'ԭ', + 'Ԯ' => 'ԯ', + 'Ա' => 'ա', + 'Բ' => 'բ', + 'Գ' => 'գ', + 'Դ' => 'դ', + 'Ե' => 'ե', + 'Զ' => 'զ', + 'Է' => 'է', + 'Ը' => 'ը', + 'Թ' => 'թ', + 'Ժ' => 'ժ', + 'Ի' => 'ի', + 'Լ' => 'լ', + 'Խ' => 'խ', + 'Ծ' => 'ծ', + 'Կ' => 'կ', + 'Հ' => 'հ', + 'Ձ' => 'ձ', + 'Ղ' => 'ղ', + 'Ճ' => 'ճ', + 'Մ' => 'մ', + 'Յ' => 'յ', + 'Ն' => 'ն', + 'Շ' => 'շ', + 'Ո' => 'ո', + 'Չ' => 'չ', + 'Պ' => 'պ', + 'Ջ' => 'ջ', + 'Ռ' => 'ռ', + 'Ս' => 'ս', + 'Վ' => 'վ', + 'Տ' => 'տ', + 'Ր' => 'ր', + 'Ց' => 'ց', + 'Ւ' => 'ւ', + 'Փ' => 'փ', + 'Ք' => 'ք', + 'Օ' => 'օ', + 'Ֆ' => 'ֆ', + 'Ⴀ' => 'ⴀ', + 'Ⴁ' => 'ⴁ', + 'Ⴂ' => 'ⴂ', + 'Ⴃ' => 'ⴃ', + 'Ⴄ' => 'ⴄ', + 'Ⴅ' => 'ⴅ', + 'Ⴆ' => 'ⴆ', + 'Ⴇ' => 'ⴇ', + 'Ⴈ' => 'ⴈ', + 'Ⴉ' => 'ⴉ', + 'Ⴊ' => 'ⴊ', + 'Ⴋ' => 'ⴋ', + 'Ⴌ' => 'ⴌ', + 'Ⴍ' => 'ⴍ', + 'Ⴎ' => 'ⴎ', + 'Ⴏ' => 'ⴏ', + 'Ⴐ' => 'ⴐ', + 'Ⴑ' => 'ⴑ', + 'Ⴒ' => 'ⴒ', + 'Ⴓ' => 'ⴓ', + 'Ⴔ' => 'ⴔ', + 'Ⴕ' => 'ⴕ', + 'Ⴖ' => 'ⴖ', + 'Ⴗ' => 'ⴗ', + 'Ⴘ' => 'ⴘ', + 'Ⴙ' => 'ⴙ', + 'Ⴚ' => 'ⴚ', + 'Ⴛ' => 'ⴛ', + 'Ⴜ' => 'ⴜ', + 'Ⴝ' => 'ⴝ', + 'Ⴞ' => 'ⴞ', + 'Ⴟ' => 'ⴟ', + 'Ⴠ' => 'ⴠ', + 'Ⴡ' => 'ⴡ', + 'Ⴢ' => 'ⴢ', + 'Ⴣ' => 'ⴣ', + 'Ⴤ' => 'ⴤ', + 'Ⴥ' => 'ⴥ', + 'Ⴧ' => 'ⴧ', + 'Ⴭ' => 'ⴭ', + 'Ꭰ' => 'ꭰ', + 'Ꭱ' => 'ꭱ', + 'Ꭲ' => 'ꭲ', + 'Ꭳ' => 'ꭳ', + 'Ꭴ' => 'ꭴ', + 'Ꭵ' => 'ꭵ', + 'Ꭶ' => 'ꭶ', + 'Ꭷ' => 'ꭷ', + 'Ꭸ' => 'ꭸ', + 'Ꭹ' => 'ꭹ', + 'Ꭺ' => 'ꭺ', + 'Ꭻ' => 'ꭻ', + 'Ꭼ' => 'ꭼ', + 'Ꭽ' => 'ꭽ', + 'Ꭾ' => 'ꭾ', + 'Ꭿ' => 'ꭿ', + 'Ꮀ' => 'ꮀ', + 'Ꮁ' => 'ꮁ', + 'Ꮂ' => 'ꮂ', + 'Ꮃ' => 'ꮃ', + 'Ꮄ' => 'ꮄ', + 'Ꮅ' => 'ꮅ', + 'Ꮆ' => 'ꮆ', + 'Ꮇ' => 'ꮇ', + 'Ꮈ' => 'ꮈ', + 'Ꮉ' => 'ꮉ', + 'Ꮊ' => 'ꮊ', + 'Ꮋ' => 'ꮋ', + 'Ꮌ' => 'ꮌ', + 'Ꮍ' => 'ꮍ', + 'Ꮎ' => 'ꮎ', + 'Ꮏ' => 'ꮏ', + 'Ꮐ' => 'ꮐ', + 'Ꮑ' => 'ꮑ', + 'Ꮒ' => 'ꮒ', + 'Ꮓ' => 'ꮓ', + 'Ꮔ' => 'ꮔ', + 'Ꮕ' => 'ꮕ', + 'Ꮖ' => 'ꮖ', + 'Ꮗ' => 'ꮗ', + 'Ꮘ' => 'ꮘ', + 'Ꮙ' => 'ꮙ', + 'Ꮚ' => 'ꮚ', + 'Ꮛ' => 'ꮛ', + 'Ꮜ' => 'ꮜ', + 'Ꮝ' => 'ꮝ', + 'Ꮞ' => 'ꮞ', + 'Ꮟ' => 'ꮟ', + 'Ꮠ' => 'ꮠ', + 'Ꮡ' => 'ꮡ', + 'Ꮢ' => 'ꮢ', + 'Ꮣ' => 'ꮣ', + 'Ꮤ' => 'ꮤ', + 'Ꮥ' => 'ꮥ', + 'Ꮦ' => 'ꮦ', + 'Ꮧ' => 'ꮧ', + 'Ꮨ' => 'ꮨ', + 'Ꮩ' => 'ꮩ', + 'Ꮪ' => 'ꮪ', + 'Ꮫ' => 'ꮫ', + 'Ꮬ' => 'ꮬ', + 'Ꮭ' => 'ꮭ', + 'Ꮮ' => 'ꮮ', + 'Ꮯ' => 'ꮯ', + 'Ꮰ' => 'ꮰ', + 'Ꮱ' => 'ꮱ', + 'Ꮲ' => 'ꮲ', + 'Ꮳ' => 'ꮳ', + 'Ꮴ' => 'ꮴ', + 'Ꮵ' => 'ꮵ', + 'Ꮶ' => 'ꮶ', + 'Ꮷ' => 'ꮷ', + 'Ꮸ' => 'ꮸ', + 'Ꮹ' => 'ꮹ', + 'Ꮺ' => 'ꮺ', + 'Ꮻ' => 'ꮻ', + 'Ꮼ' => 'ꮼ', + 'Ꮽ' => 'ꮽ', + 'Ꮾ' => 'ꮾ', + 'Ꮿ' => 'ꮿ', + 'Ᏸ' => 'ᏸ', + 'Ᏹ' => 'ᏹ', + 'Ᏺ' => 'ᏺ', + 'Ᏻ' => 'ᏻ', + 'Ᏼ' => 'ᏼ', + 'Ᏽ' => 'ᏽ', + 'Ა' => 'ა', + 'Ბ' => 'ბ', + 'Გ' => 'გ', + 'Დ' => 'დ', + 'Ე' => 'ე', + 'Ვ' => 'ვ', + 'Ზ' => 'ზ', + 'Თ' => 'თ', + 'Ი' => 'ი', + 'Კ' => 'კ', + 'Ლ' => 'ლ', + 'Მ' => 'მ', + 'Ნ' => 'ნ', + 'Ო' => 'ო', + 'Პ' => 'პ', + 'Ჟ' => 'ჟ', + 'Რ' => 'რ', + 'Ს' => 'ს', + 'Ტ' => 'ტ', + 'Უ' => 'უ', + 'Ფ' => 'ფ', + 'Ქ' => 'ქ', + 'Ღ' => 'ღ', + 'Ყ' => 'ყ', + 'Შ' => 'შ', + 'Ჩ' => 'ჩ', + 'Ც' => 'ც', + 'Ძ' => 'ძ', + 'Წ' => 'წ', + 'Ჭ' => 'ჭ', + 'Ხ' => 'ხ', + 'Ჯ' => 'ჯ', + 'Ჰ' => 'ჰ', + 'Ჱ' => 'ჱ', + 'Ჲ' => 'ჲ', + 'Ჳ' => 'ჳ', + 'Ჴ' => 'ჴ', + 'Ჵ' => 'ჵ', + 'Ჶ' => 'ჶ', + 'Ჷ' => 'ჷ', + 'Ჸ' => 'ჸ', + 'Ჹ' => 'ჹ', + 'Ჺ' => 'ჺ', + 'Ჽ' => 'ჽ', + 'Ჾ' => 'ჾ', + 'Ჿ' => 'ჿ', + 'Ḁ' => 'ḁ', + 'Ḃ' => 'ḃ', + 'Ḅ' => 'ḅ', + 'Ḇ' => 'ḇ', + 'Ḉ' => 'ḉ', + 'Ḋ' => 'ḋ', + 'Ḍ' => 'ḍ', + 'Ḏ' => 'ḏ', + 'Ḑ' => 'ḑ', + 'Ḓ' => 'ḓ', + 'Ḕ' => 'ḕ', + 'Ḗ' => 'ḗ', + 'Ḙ' => 'ḙ', + 'Ḛ' => 'ḛ', + 'Ḝ' => 'ḝ', + 'Ḟ' => 'ḟ', + 'Ḡ' => 'ḡ', + 'Ḣ' => 'ḣ', + 'Ḥ' => 'ḥ', + 'Ḧ' => 'ḧ', + 'Ḩ' => 'ḩ', + 'Ḫ' => 'ḫ', + 'Ḭ' => 'ḭ', + 'Ḯ' => 'ḯ', + 'Ḱ' => 'ḱ', + 'Ḳ' => 'ḳ', + 'Ḵ' => 'ḵ', + 'Ḷ' => 'ḷ', + 'Ḹ' => 'ḹ', + 'Ḻ' => 'ḻ', + 'Ḽ' => 'ḽ', + 'Ḿ' => 'ḿ', + 'Ṁ' => 'ṁ', + 'Ṃ' => 'ṃ', + 'Ṅ' => 'ṅ', + 'Ṇ' => 'ṇ', + 'Ṉ' => 'ṉ', + 'Ṋ' => 'ṋ', + 'Ṍ' => 'ṍ', + 'Ṏ' => 'ṏ', + 'Ṑ' => 'ṑ', + 'Ṓ' => 'ṓ', + 'Ṕ' => 'ṕ', + 'Ṗ' => 'ṗ', + 'Ṙ' => 'ṙ', + 'Ṛ' => 'ṛ', + 'Ṝ' => 'ṝ', + 'Ṟ' => 'ṟ', + 'Ṡ' => 'ṡ', + 'Ṣ' => 'ṣ', + 'Ṥ' => 'ṥ', + 'Ṧ' => 'ṧ', + 'Ṩ' => 'ṩ', + 'Ṫ' => 'ṫ', + 'Ṭ' => 'ṭ', + 'Ṯ' => 'ṯ', + 'Ṱ' => 'ṱ', + 'Ṳ' => 'ṳ', + 'Ṵ' => 'ṵ', + 'Ṷ' => 'ṷ', + 'Ṹ' => 'ṹ', + 'Ṻ' => 'ṻ', + 'Ṽ' => 'ṽ', + 'Ṿ' => 'ṿ', + 'Ẁ' => 'ẁ', + 'Ẃ' => 'ẃ', + 'Ẅ' => 'ẅ', + 'Ẇ' => 'ẇ', + 'Ẉ' => 'ẉ', + 'Ẋ' => 'ẋ', + 'Ẍ' => 'ẍ', + 'Ẏ' => 'ẏ', + 'Ẑ' => 'ẑ', + 'Ẓ' => 'ẓ', + 'Ẕ' => 'ẕ', + 'ẞ' => 'ß', + 'Ạ' => 'ạ', + 'Ả' => 'ả', + 'Ấ' => 'ấ', + 'Ầ' => 'ầ', + 'Ẩ' => 'ẩ', + 'Ẫ' => 'ẫ', + 'Ậ' => 'ậ', + 'Ắ' => 'ắ', + 'Ằ' => 'ằ', + 'Ẳ' => 'ẳ', + 'Ẵ' => 'ẵ', + 'Ặ' => 'ặ', + 'Ẹ' => 'ẹ', + 'Ẻ' => 'ẻ', + 'Ẽ' => 'ẽ', + 'Ế' => 'ế', + 'Ề' => 'ề', + 'Ể' => 'ể', + 'Ễ' => 'ễ', + 'Ệ' => 'ệ', + 'Ỉ' => 'ỉ', + 'Ị' => 'ị', + 'Ọ' => 'ọ', + 'Ỏ' => 'ỏ', + 'Ố' => 'ố', + 'Ồ' => 'ồ', + 'Ổ' => 'ổ', + 'Ỗ' => 'ỗ', + 'Ộ' => 'ộ', + 'Ớ' => 'ớ', + 'Ờ' => 'ờ', + 'Ở' => 'ở', + 'Ỡ' => 'ỡ', + 'Ợ' => 'ợ', + 'Ụ' => 'ụ', + 'Ủ' => 'ủ', + 'Ứ' => 'ứ', + 'Ừ' => 'ừ', + 'Ử' => 'ử', + 'Ữ' => 'ữ', + 'Ự' => 'ự', + 'Ỳ' => 'ỳ', + 'Ỵ' => 'ỵ', + 'Ỷ' => 'ỷ', + 'Ỹ' => 'ỹ', + 'Ỻ' => 'ỻ', + 'Ỽ' => 'ỽ', + 'Ỿ' => 'ỿ', + 'Ἀ' => 'ἀ', + 'Ἁ' => 'ἁ', + 'Ἂ' => 'ἂ', + 'Ἃ' => 'ἃ', + 'Ἄ' => 'ἄ', + 'Ἅ' => 'ἅ', + 'Ἆ' => 'ἆ', + 'Ἇ' => 'ἇ', + 'Ἐ' => 'ἐ', + 'Ἑ' => 'ἑ', + 'Ἒ' => 'ἒ', + 'Ἓ' => 'ἓ', + 'Ἔ' => 'ἔ', + 'Ἕ' => 'ἕ', + 'Ἠ' => 'ἠ', + 'Ἡ' => 'ἡ', + 'Ἢ' => 'ἢ', + 'Ἣ' => 'ἣ', + 'Ἤ' => 'ἤ', + 'Ἥ' => 'ἥ', + 'Ἦ' => 'ἦ', + 'Ἧ' => 'ἧ', + 'Ἰ' => 'ἰ', + 'Ἱ' => 'ἱ', + 'Ἲ' => 'ἲ', + 'Ἳ' => 'ἳ', + 'Ἴ' => 'ἴ', + 'Ἵ' => 'ἵ', + 'Ἶ' => 'ἶ', + 'Ἷ' => 'ἷ', + 'Ὀ' => 'ὀ', + 'Ὁ' => 'ὁ', + 'Ὂ' => 'ὂ', + 'Ὃ' => 'ὃ', + 'Ὄ' => 'ὄ', + 'Ὅ' => 'ὅ', + 'Ὑ' => 'ὑ', + 'Ὓ' => 'ὓ', + 'Ὕ' => 'ὕ', + 'Ὗ' => 'ὗ', + 'Ὠ' => 'ὠ', + 'Ὡ' => 'ὡ', + 'Ὢ' => 'ὢ', + 'Ὣ' => 'ὣ', + 'Ὤ' => 'ὤ', + 'Ὥ' => 'ὥ', + 'Ὦ' => 'ὦ', + 'Ὧ' => 'ὧ', + 'ᾈ' => 'ᾀ', + 'ᾉ' => 'ᾁ', + 'ᾊ' => 'ᾂ', + 'ᾋ' => 'ᾃ', + 'ᾌ' => 'ᾄ', + 'ᾍ' => 'ᾅ', + 'ᾎ' => 'ᾆ', + 'ᾏ' => 'ᾇ', + 'ᾘ' => 'ᾐ', + 'ᾙ' => 'ᾑ', + 'ᾚ' => 'ᾒ', + 'ᾛ' => 'ᾓ', + 'ᾜ' => 'ᾔ', + 'ᾝ' => 'ᾕ', + 'ᾞ' => 'ᾖ', + 'ᾟ' => 'ᾗ', + 'ᾨ' => 'ᾠ', + 'ᾩ' => 'ᾡ', + 'ᾪ' => 'ᾢ', + 'ᾫ' => 'ᾣ', + 'ᾬ' => 'ᾤ', + 'ᾭ' => 'ᾥ', + 'ᾮ' => 'ᾦ', + 'ᾯ' => 'ᾧ', + 'Ᾰ' => 'ᾰ', + 'Ᾱ' => 'ᾱ', + 'Ὰ' => 'ὰ', + 'Ά' => 'ά', + 'ᾼ' => 'ᾳ', + 'Ὲ' => 'ὲ', + 'Έ' => 'έ', + 'Ὴ' => 'ὴ', + 'Ή' => 'ή', + 'ῌ' => 'ῃ', + 'Ῐ' => 'ῐ', + 'Ῑ' => 'ῑ', + 'Ὶ' => 'ὶ', + 'Ί' => 'ί', + 'Ῠ' => 'ῠ', + 'Ῡ' => 'ῡ', + 'Ὺ' => 'ὺ', + 'Ύ' => 'ύ', + 'Ῥ' => 'ῥ', + 'Ὸ' => 'ὸ', + 'Ό' => 'ό', + 'Ὼ' => 'ὼ', + 'Ώ' => 'ώ', + 'ῼ' => 'ῳ', + 'Ω' => 'ω', + 'K' => 'k', + 'Å' => 'å', + 'Ⅎ' => 'ⅎ', + 'Ⅰ' => 'ⅰ', + 'Ⅱ' => 'ⅱ', + 'Ⅲ' => 'ⅲ', + 'Ⅳ' => 'ⅳ', + 'Ⅴ' => 'ⅴ', + 'Ⅵ' => 'ⅵ', + 'Ⅶ' => 'ⅶ', + 'Ⅷ' => 'ⅷ', + 'Ⅸ' => 'ⅸ', + 'Ⅹ' => 'ⅹ', + 'Ⅺ' => 'ⅺ', + 'Ⅻ' => 'ⅻ', + 'Ⅼ' => 'ⅼ', + 'Ⅽ' => 'ⅽ', + 'Ⅾ' => 'ⅾ', + 'Ⅿ' => 'ⅿ', + 'Ↄ' => 'ↄ', + 'Ⓐ' => 'ⓐ', + 'Ⓑ' => 'ⓑ', + 'Ⓒ' => 'ⓒ', + 'Ⓓ' => 'ⓓ', + 'Ⓔ' => 'ⓔ', + 'Ⓕ' => 'ⓕ', + 'Ⓖ' => 'ⓖ', + 'Ⓗ' => 'ⓗ', + 'Ⓘ' => 'ⓘ', + 'Ⓙ' => 'ⓙ', + 'Ⓚ' => 'ⓚ', + 'Ⓛ' => 'ⓛ', + 'Ⓜ' => 'ⓜ', + 'Ⓝ' => 'ⓝ', + 'Ⓞ' => 'ⓞ', + 'Ⓟ' => 'ⓟ', + 'Ⓠ' => 'ⓠ', + 'Ⓡ' => 'ⓡ', + 'Ⓢ' => 'ⓢ', + 'Ⓣ' => 'ⓣ', + 'Ⓤ' => 'ⓤ', + 'Ⓥ' => 'ⓥ', + 'Ⓦ' => 'ⓦ', + 'Ⓧ' => 'ⓧ', + 'Ⓨ' => 'ⓨ', + 'Ⓩ' => 'ⓩ', + 'Ⰰ' => 'ⰰ', + 'Ⰱ' => 'ⰱ', + 'Ⰲ' => 'ⰲ', + 'Ⰳ' => 'ⰳ', + 'Ⰴ' => 'ⰴ', + 'Ⰵ' => 'ⰵ', + 'Ⰶ' => 'ⰶ', + 'Ⰷ' => 'ⰷ', + 'Ⰸ' => 'ⰸ', + 'Ⰹ' => 'ⰹ', + 'Ⰺ' => 'ⰺ', + 'Ⰻ' => 'ⰻ', + 'Ⰼ' => 'ⰼ', + 'Ⰽ' => 'ⰽ', + 'Ⰾ' => 'ⰾ', + 'Ⰿ' => 'ⰿ', + 'Ⱀ' => 'ⱀ', + 'Ⱁ' => 'ⱁ', + 'Ⱂ' => 'ⱂ', + 'Ⱃ' => 'ⱃ', + 'Ⱄ' => 'ⱄ', + 'Ⱅ' => 'ⱅ', + 'Ⱆ' => 'ⱆ', + 'Ⱇ' => 'ⱇ', + 'Ⱈ' => 'ⱈ', + 'Ⱉ' => 'ⱉ', + 'Ⱊ' => 'ⱊ', + 'Ⱋ' => 'ⱋ', + 'Ⱌ' => 'ⱌ', + 'Ⱍ' => 'ⱍ', + 'Ⱎ' => 'ⱎ', + 'Ⱏ' => 'ⱏ', + 'Ⱐ' => 'ⱐ', + 'Ⱑ' => 'ⱑ', + 'Ⱒ' => 'ⱒ', + 'Ⱓ' => 'ⱓ', + 'Ⱔ' => 'ⱔ', + 'Ⱕ' => 'ⱕ', + 'Ⱖ' => 'ⱖ', + 'Ⱗ' => 'ⱗ', + 'Ⱘ' => 'ⱘ', + 'Ⱙ' => 'ⱙ', + 'Ⱚ' => 'ⱚ', + 'Ⱛ' => 'ⱛ', + 'Ⱜ' => 'ⱜ', + 'Ⱝ' => 'ⱝ', + 'Ⱞ' => 'ⱞ', + 'Ⱡ' => 'ⱡ', + 'Ɫ' => 'ɫ', + 'Ᵽ' => 'ᵽ', + 'Ɽ' => 'ɽ', + 'Ⱨ' => 'ⱨ', + 'Ⱪ' => 'ⱪ', + 'Ⱬ' => 'ⱬ', + 'Ɑ' => 'ɑ', + 'Ɱ' => 'ɱ', + 'Ɐ' => 'ɐ', + 'Ɒ' => 'ɒ', + 'Ⱳ' => 'ⱳ', + 'Ⱶ' => 'ⱶ', + 'Ȿ' => 'ȿ', + 'Ɀ' => 'ɀ', + 'Ⲁ' => 'ⲁ', + 'Ⲃ' => 'ⲃ', + 'Ⲅ' => 'ⲅ', + 'Ⲇ' => 'ⲇ', + 'Ⲉ' => 'ⲉ', + 'Ⲋ' => 'ⲋ', + 'Ⲍ' => 'ⲍ', + 'Ⲏ' => 'ⲏ', + 'Ⲑ' => 'ⲑ', + 'Ⲓ' => 'ⲓ', + 'Ⲕ' => 'ⲕ', + 'Ⲗ' => 'ⲗ', + 'Ⲙ' => 'ⲙ', + 'Ⲛ' => 'ⲛ', + 'Ⲝ' => 'ⲝ', + 'Ⲟ' => 'ⲟ', + 'Ⲡ' => 'ⲡ', + 'Ⲣ' => 'ⲣ', + 'Ⲥ' => 'ⲥ', + 'Ⲧ' => 'ⲧ', + 'Ⲩ' => 'ⲩ', + 'Ⲫ' => 'ⲫ', + 'Ⲭ' => 'ⲭ', + 'Ⲯ' => 'ⲯ', + 'Ⲱ' => 'ⲱ', + 'Ⲳ' => 'ⲳ', + 'Ⲵ' => 'ⲵ', + 'Ⲷ' => 'ⲷ', + 'Ⲹ' => 'ⲹ', + 'Ⲻ' => 'ⲻ', + 'Ⲽ' => 'ⲽ', + 'Ⲿ' => 'ⲿ', + 'Ⳁ' => 'ⳁ', + 'Ⳃ' => 'ⳃ', + 'Ⳅ' => 'ⳅ', + 'Ⳇ' => 'ⳇ', + 'Ⳉ' => 'ⳉ', + 'Ⳋ' => 'ⳋ', + 'Ⳍ' => 'ⳍ', + 'Ⳏ' => 'ⳏ', + 'Ⳑ' => 'ⳑ', + 'Ⳓ' => 'ⳓ', + 'Ⳕ' => 'ⳕ', + 'Ⳗ' => 'ⳗ', + 'Ⳙ' => 'ⳙ', + 'Ⳛ' => 'ⳛ', + 'Ⳝ' => 'ⳝ', + 'Ⳟ' => 'ⳟ', + 'Ⳡ' => 'ⳡ', + 'Ⳣ' => 'ⳣ', + 'Ⳬ' => 'ⳬ', + 'Ⳮ' => 'ⳮ', + 'Ⳳ' => 'ⳳ', + 'Ꙁ' => 'ꙁ', + 'Ꙃ' => 'ꙃ', + 'Ꙅ' => 'ꙅ', + 'Ꙇ' => 'ꙇ', + 'Ꙉ' => 'ꙉ', + 'Ꙋ' => 'ꙋ', + 'Ꙍ' => 'ꙍ', + 'Ꙏ' => 'ꙏ', + 'Ꙑ' => 'ꙑ', + 'Ꙓ' => 'ꙓ', + 'Ꙕ' => 'ꙕ', + 'Ꙗ' => 'ꙗ', + 'Ꙙ' => 'ꙙ', + 'Ꙛ' => 'ꙛ', + 'Ꙝ' => 'ꙝ', + 'Ꙟ' => 'ꙟ', + 'Ꙡ' => 'ꙡ', + 'Ꙣ' => 'ꙣ', + 'Ꙥ' => 'ꙥ', + 'Ꙧ' => 'ꙧ', + 'Ꙩ' => 'ꙩ', + 'Ꙫ' => 'ꙫ', + 'Ꙭ' => 'ꙭ', + 'Ꚁ' => 'ꚁ', + 'Ꚃ' => 'ꚃ', + 'Ꚅ' => 'ꚅ', + 'Ꚇ' => 'ꚇ', + 'Ꚉ' => 'ꚉ', + 'Ꚋ' => 'ꚋ', + 'Ꚍ' => 'ꚍ', + 'Ꚏ' => 'ꚏ', + 'Ꚑ' => 'ꚑ', + 'Ꚓ' => 'ꚓ', + 'Ꚕ' => 'ꚕ', + 'Ꚗ' => 'ꚗ', + 'Ꚙ' => 'ꚙ', + 'Ꚛ' => 'ꚛ', + 'Ꜣ' => 'ꜣ', + 'Ꜥ' => 'ꜥ', + 'Ꜧ' => 'ꜧ', + 'Ꜩ' => 'ꜩ', + 'Ꜫ' => 'ꜫ', + 'Ꜭ' => 'ꜭ', + 'Ꜯ' => 'ꜯ', + 'Ꜳ' => 'ꜳ', + 'Ꜵ' => 'ꜵ', + 'Ꜷ' => 'ꜷ', + 'Ꜹ' => 'ꜹ', + 'Ꜻ' => 'ꜻ', + 'Ꜽ' => 'ꜽ', + 'Ꜿ' => 'ꜿ', + 'Ꝁ' => 'ꝁ', + 'Ꝃ' => 'ꝃ', + 'Ꝅ' => 'ꝅ', + 'Ꝇ' => 'ꝇ', + 'Ꝉ' => 'ꝉ', + 'Ꝋ' => 'ꝋ', + 'Ꝍ' => 'ꝍ', + 'Ꝏ' => 'ꝏ', + 'Ꝑ' => 'ꝑ', + 'Ꝓ' => 'ꝓ', + 'Ꝕ' => 'ꝕ', + 'Ꝗ' => 'ꝗ', + 'Ꝙ' => 'ꝙ', + 'Ꝛ' => 'ꝛ', + 'Ꝝ' => 'ꝝ', + 'Ꝟ' => 'ꝟ', + 'Ꝡ' => 'ꝡ', + 'Ꝣ' => 'ꝣ', + 'Ꝥ' => 'ꝥ', + 'Ꝧ' => 'ꝧ', + 'Ꝩ' => 'ꝩ', + 'Ꝫ' => 'ꝫ', + 'Ꝭ' => 'ꝭ', + 'Ꝯ' => 'ꝯ', + 'Ꝺ' => 'ꝺ', + 'Ꝼ' => 'ꝼ', + 'Ᵹ' => 'ᵹ', + 'Ꝿ' => 'ꝿ', + 'Ꞁ' => 'ꞁ', + 'Ꞃ' => 'ꞃ', + 'Ꞅ' => 'ꞅ', + 'Ꞇ' => 'ꞇ', + 'Ꞌ' => 'ꞌ', + 'Ɥ' => 'ɥ', + 'Ꞑ' => 'ꞑ', + 'Ꞓ' => 'ꞓ', + 'Ꞗ' => 'ꞗ', + 'Ꞙ' => 'ꞙ', + 'Ꞛ' => 'ꞛ', + 'Ꞝ' => 'ꞝ', + 'Ꞟ' => 'ꞟ', + 'Ꞡ' => 'ꞡ', + 'Ꞣ' => 'ꞣ', + 'Ꞥ' => 'ꞥ', + 'Ꞧ' => 'ꞧ', + 'Ꞩ' => 'ꞩ', + 'Ɦ' => 'ɦ', + 'Ɜ' => 'ɜ', + 'Ɡ' => 'ɡ', + 'Ɬ' => 'ɬ', + 'Ɪ' => 'ɪ', + 'Ʞ' => 'ʞ', + 'Ʇ' => 'ʇ', + 'Ʝ' => 'ʝ', + 'Ꭓ' => 'ꭓ', + 'Ꞵ' => 'ꞵ', + 'Ꞷ' => 'ꞷ', + 'Ꞹ' => 'ꞹ', + 'Ꞻ' => 'ꞻ', + 'Ꞽ' => 'ꞽ', + 'Ꞿ' => 'ꞿ', + 'Ꟃ' => 'ꟃ', + 'Ꞔ' => 'ꞔ', + 'Ʂ' => 'ʂ', + 'Ᶎ' => 'ᶎ', + 'Ꟈ' => 'ꟈ', + 'Ꟊ' => 'ꟊ', + 'Ꟶ' => 'ꟶ', + 'A' => 'a', + 'B' => 'b', + 'C' => 'c', + 'D' => 'd', + 'E' => 'e', + 'F' => 'f', + 'G' => 'g', + 'H' => 'h', + 'I' => 'i', + 'J' => 'j', + 'K' => 'k', + 'L' => 'l', + 'M' => 'm', + 'N' => 'n', + 'O' => 'o', + 'P' => 'p', + 'Q' => 'q', + 'R' => 'r', + 'S' => 's', + 'T' => 't', + 'U' => 'u', + 'V' => 'v', + 'W' => 'w', + 'X' => 'x', + 'Y' => 'y', + 'Z' => 'z', + '𐐀' => '𐐨', + '𐐁' => '𐐩', + '𐐂' => '𐐪', + '𐐃' => '𐐫', + '𐐄' => '𐐬', + '𐐅' => '𐐭', + '𐐆' => '𐐮', + '𐐇' => '𐐯', + '𐐈' => '𐐰', + '𐐉' => '𐐱', + '𐐊' => '𐐲', + '𐐋' => '𐐳', + '𐐌' => '𐐴', + '𐐍' => '𐐵', + '𐐎' => '𐐶', + '𐐏' => '𐐷', + '𐐐' => '𐐸', + '𐐑' => '𐐹', + '𐐒' => '𐐺', + '𐐓' => '𐐻', + '𐐔' => '𐐼', + '𐐕' => '𐐽', + '𐐖' => '𐐾', + '𐐗' => '𐐿', + '𐐘' => '𐑀', + '𐐙' => '𐑁', + '𐐚' => '𐑂', + '𐐛' => '𐑃', + '𐐜' => '𐑄', + '𐐝' => '𐑅', + '𐐞' => '𐑆', + '𐐟' => '𐑇', + '𐐠' => '𐑈', + '𐐡' => '𐑉', + '𐐢' => '𐑊', + '𐐣' => '𐑋', + '𐐤' => '𐑌', + '𐐥' => '𐑍', + '𐐦' => '𐑎', + '𐐧' => '𐑏', + '𐒰' => '𐓘', + '𐒱' => '𐓙', + '𐒲' => '𐓚', + '𐒳' => '𐓛', + '𐒴' => '𐓜', + '𐒵' => '𐓝', + '𐒶' => '𐓞', + '𐒷' => '𐓟', + '𐒸' => '𐓠', + '𐒹' => '𐓡', + '𐒺' => '𐓢', + '𐒻' => '𐓣', + '𐒼' => '𐓤', + '𐒽' => '𐓥', + '𐒾' => '𐓦', + '𐒿' => '𐓧', + '𐓀' => '𐓨', + '𐓁' => '𐓩', + '𐓂' => '𐓪', + '𐓃' => '𐓫', + '𐓄' => '𐓬', + '𐓅' => '𐓭', + '𐓆' => '𐓮', + '𐓇' => '𐓯', + '𐓈' => '𐓰', + '𐓉' => '𐓱', + '𐓊' => '𐓲', + '𐓋' => '𐓳', + '𐓌' => '𐓴', + '𐓍' => '𐓵', + '𐓎' => '𐓶', + '𐓏' => '𐓷', + '𐓐' => '𐓸', + '𐓑' => '𐓹', + '𐓒' => '𐓺', + '𐓓' => '𐓻', + '𐲀' => '𐳀', + '𐲁' => '𐳁', + '𐲂' => '𐳂', + '𐲃' => '𐳃', + '𐲄' => '𐳄', + '𐲅' => '𐳅', + '𐲆' => '𐳆', + '𐲇' => '𐳇', + '𐲈' => '𐳈', + '𐲉' => '𐳉', + '𐲊' => '𐳊', + '𐲋' => '𐳋', + '𐲌' => '𐳌', + '𐲍' => '𐳍', + '𐲎' => '𐳎', + '𐲏' => '𐳏', + '𐲐' => '𐳐', + '𐲑' => '𐳑', + '𐲒' => '𐳒', + '𐲓' => '𐳓', + '𐲔' => '𐳔', + '𐲕' => '𐳕', + '𐲖' => '𐳖', + '𐲗' => '𐳗', + '𐲘' => '𐳘', + '𐲙' => '𐳙', + '𐲚' => '𐳚', + '𐲛' => '𐳛', + '𐲜' => '𐳜', + '𐲝' => '𐳝', + '𐲞' => '𐳞', + '𐲟' => '𐳟', + '𐲠' => '𐳠', + '𐲡' => '𐳡', + '𐲢' => '𐳢', + '𐲣' => '𐳣', + '𐲤' => '𐳤', + '𐲥' => '𐳥', + '𐲦' => '𐳦', + '𐲧' => '𐳧', + '𐲨' => '𐳨', + '𐲩' => '𐳩', + '𐲪' => '𐳪', + '𐲫' => '𐳫', + '𐲬' => '𐳬', + '𐲭' => '𐳭', + '𐲮' => '𐳮', + '𐲯' => '𐳯', + '𐲰' => '𐳰', + '𐲱' => '𐳱', + '𐲲' => '𐳲', + '𑢠' => '𑣀', + '𑢡' => '𑣁', + '𑢢' => '𑣂', + '𑢣' => '𑣃', + '𑢤' => '𑣄', + '𑢥' => '𑣅', + '𑢦' => '𑣆', + '𑢧' => '𑣇', + '𑢨' => '𑣈', + '𑢩' => '𑣉', + '𑢪' => '𑣊', + '𑢫' => '𑣋', + '𑢬' => '𑣌', + '𑢭' => '𑣍', + '𑢮' => '𑣎', + '𑢯' => '𑣏', + '𑢰' => '𑣐', + '𑢱' => '𑣑', + '𑢲' => '𑣒', + '𑢳' => '𑣓', + '𑢴' => '𑣔', + '𑢵' => '𑣕', + '𑢶' => '𑣖', + '𑢷' => '𑣗', + '𑢸' => '𑣘', + '𑢹' => '𑣙', + '𑢺' => '𑣚', + '𑢻' => '𑣛', + '𑢼' => '𑣜', + '𑢽' => '𑣝', + '𑢾' => '𑣞', + '𑢿' => '𑣟', + '𖹀' => '𖹠', + '𖹁' => '𖹡', + '𖹂' => '𖹢', + '𖹃' => '𖹣', + '𖹄' => '𖹤', + '𖹅' => '𖹥', + '𖹆' => '𖹦', + '𖹇' => '𖹧', + '𖹈' => '𖹨', + '𖹉' => '𖹩', + '𖹊' => '𖹪', + '𖹋' => '𖹫', + '𖹌' => '𖹬', + '𖹍' => '𖹭', + '𖹎' => '𖹮', + '𖹏' => '𖹯', + '𖹐' => '𖹰', + '𖹑' => '𖹱', + '𖹒' => '𖹲', + '𖹓' => '𖹳', + '𖹔' => '𖹴', + '𖹕' => '𖹵', + '𖹖' => '𖹶', + '𖹗' => '𖹷', + '𖹘' => '𖹸', + '𖹙' => '𖹹', + '𖹚' => '𖹺', + '𖹛' => '𖹻', + '𖹜' => '𖹼', + '𖹝' => '𖹽', + '𖹞' => '𖹾', + '𖹟' => '𖹿', + '𞤀' => '𞤢', + '𞤁' => '𞤣', + '𞤂' => '𞤤', + '𞤃' => '𞤥', + '𞤄' => '𞤦', + '𞤅' => '𞤧', + '𞤆' => '𞤨', + '𞤇' => '𞤩', + '𞤈' => '𞤪', + '𞤉' => '𞤫', + '𞤊' => '𞤬', + '𞤋' => '𞤭', + '𞤌' => '𞤮', + '𞤍' => '𞤯', + '𞤎' => '𞤰', + '𞤏' => '𞤱', + '𞤐' => '𞤲', + '𞤑' => '𞤳', + '𞤒' => '𞤴', + '𞤓' => '𞤵', + '𞤔' => '𞤶', + '𞤕' => '𞤷', + '𞤖' => '𞤸', + '𞤗' => '𞤹', + '𞤘' => '𞤺', + '𞤙' => '𞤻', + '𞤚' => '𞤼', + '𞤛' => '𞤽', + '𞤜' => '𞤾', + '𞤝' => '𞤿', + '𞤞' => '𞥀', + '𞤟' => '𞥁', + '𞤠' => '𞥂', + '𞤡' => '𞥃', +); diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php index 2a8f6e7..d2f10e0 100644 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php @@ -1,5 +1,5 @@ - 'A', - 'b' => 'B', - 'c' => 'C', - 'd' => 'D', - 'e' => 'E', - 'f' => 'F', - 'g' => 'G', - 'h' => 'H', - 'i' => 'I', - 'j' => 'J', - 'k' => 'K', - 'l' => 'L', - 'm' => 'M', - 'n' => 'N', - 'o' => 'O', - 'p' => 'P', - 'q' => 'Q', - 'r' => 'R', - 's' => 'S', - 't' => 'T', - 'u' => 'U', - 'v' => 'V', - 'w' => 'W', - 'x' => 'X', - 'y' => 'Y', - 'z' => 'Z', - 'µ' => 'Μ', - 'à' => 'À', - 'á' => 'Á', - 'â' => 'Â', - 'ã' => 'Ã', - 'ä' => 'Ä', - 'å' => 'Å', - 'æ' => 'Æ', - 'ç' => 'Ç', - 'è' => 'È', - 'é' => 'É', - 'ê' => 'Ê', - 'ë' => 'Ë', - 'ì' => 'Ì', - 'í' => 'Í', - 'î' => 'Î', - 'ï' => 'Ï', - 'ð' => 'Ð', - 'ñ' => 'Ñ', - 'ò' => 'Ò', - 'ó' => 'Ó', - 'ô' => 'Ô', - 'õ' => 'Õ', - 'ö' => 'Ö', - 'ø' => 'Ø', - 'ù' => 'Ù', - 'ú' => 'Ú', - 'û' => 'Û', - 'ü' => 'Ü', - 'ý' => 'Ý', - 'þ' => 'Þ', - 'ÿ' => 'Ÿ', - 'ā' => 'Ā', - 'ă' => 'Ă', - 'ą' => 'Ą', - 'ć' => 'Ć', - 'ĉ' => 'Ĉ', - 'ċ' => 'Ċ', - 'č' => 'Č', - 'ď' => 'Ď', - 'đ' => 'Đ', - 'ē' => 'Ē', - 'ĕ' => 'Ĕ', - 'ė' => 'Ė', - 'ę' => 'Ę', - 'ě' => 'Ě', - 'ĝ' => 'Ĝ', - 'ğ' => 'Ğ', - 'ġ' => 'Ġ', - 'ģ' => 'Ģ', - 'ĥ' => 'Ĥ', - 'ħ' => 'Ħ', - 'ĩ' => 'Ĩ', - 'ī' => 'Ī', - 'ĭ' => 'Ĭ', - 'į' => 'Į', - 'ı' => 'I', - 'ij' => 'IJ', - 'ĵ' => 'Ĵ', - 'ķ' => 'Ķ', - 'ĺ' => 'Ĺ', - 'ļ' => 'Ļ', - 'ľ' => 'Ľ', - 'ŀ' => 'Ŀ', - 'ł' => 'Ł', - 'ń' => 'Ń', - 'ņ' => 'Ņ', - 'ň' => 'Ň', - 'ŋ' => 'Ŋ', - 'ō' => 'Ō', - 'ŏ' => 'Ŏ', - 'ő' => 'Ő', - 'œ' => 'Œ', - 'ŕ' => 'Ŕ', - 'ŗ' => 'Ŗ', - 'ř' => 'Ř', - 'ś' => 'Ś', - 'ŝ' => 'Ŝ', - 'ş' => 'Ş', - 'š' => 'Š', - 'ţ' => 'Ţ', - 'ť' => 'Ť', - 'ŧ' => 'Ŧ', - 'ũ' => 'Ũ', - 'ū' => 'Ū', - 'ŭ' => 'Ŭ', - 'ů' => 'Ů', - 'ű' => 'Ű', - 'ų' => 'Ų', - 'ŵ' => 'Ŵ', - 'ŷ' => 'Ŷ', - 'ź' => 'Ź', - 'ż' => 'Ż', - 'ž' => 'Ž', - 'ſ' => 'S', - 'ƀ' => 'Ƀ', - 'ƃ' => 'Ƃ', - 'ƅ' => 'Ƅ', - 'ƈ' => 'Ƈ', - 'ƌ' => 'Ƌ', - 'ƒ' => 'Ƒ', - 'ƕ' => 'Ƕ', - 'ƙ' => 'Ƙ', - 'ƚ' => 'Ƚ', - 'ƞ' => 'Ƞ', - 'ơ' => 'Ơ', - 'ƣ' => 'Ƣ', - 'ƥ' => 'Ƥ', - 'ƨ' => 'Ƨ', - 'ƭ' => 'Ƭ', - 'ư' => 'Ư', - 'ƴ' => 'Ƴ', - 'ƶ' => 'Ƶ', - 'ƹ' => 'Ƹ', - 'ƽ' => 'Ƽ', - 'ƿ' => 'Ƿ', - 'Dž' => 'DŽ', - 'dž' => 'DŽ', - 'Lj' => 'LJ', - 'lj' => 'LJ', - 'Nj' => 'NJ', - 'nj' => 'NJ', - 'ǎ' => 'Ǎ', - 'ǐ' => 'Ǐ', - 'ǒ' => 'Ǒ', - 'ǔ' => 'Ǔ', - 'ǖ' => 'Ǖ', - 'ǘ' => 'Ǘ', - 'ǚ' => 'Ǚ', - 'ǜ' => 'Ǜ', - 'ǝ' => 'Ǝ', - 'ǟ' => 'Ǟ', - 'ǡ' => 'Ǡ', - 'ǣ' => 'Ǣ', - 'ǥ' => 'Ǥ', - 'ǧ' => 'Ǧ', - 'ǩ' => 'Ǩ', - 'ǫ' => 'Ǫ', - 'ǭ' => 'Ǭ', - 'ǯ' => 'Ǯ', - 'Dz' => 'DZ', - 'dz' => 'DZ', - 'ǵ' => 'Ǵ', - 'ǹ' => 'Ǹ', - 'ǻ' => 'Ǻ', - 'ǽ' => 'Ǽ', - 'ǿ' => 'Ǿ', - 'ȁ' => 'Ȁ', - 'ȃ' => 'Ȃ', - 'ȅ' => 'Ȅ', - 'ȇ' => 'Ȇ', - 'ȉ' => 'Ȉ', - 'ȋ' => 'Ȋ', - 'ȍ' => 'Ȍ', - 'ȏ' => 'Ȏ', - 'ȑ' => 'Ȑ', - 'ȓ' => 'Ȓ', - 'ȕ' => 'Ȕ', - 'ȗ' => 'Ȗ', - 'ș' => 'Ș', - 'ț' => 'Ț', - 'ȝ' => 'Ȝ', - 'ȟ' => 'Ȟ', - 'ȣ' => 'Ȣ', - 'ȥ' => 'Ȥ', - 'ȧ' => 'Ȧ', - 'ȩ' => 'Ȩ', - 'ȫ' => 'Ȫ', - 'ȭ' => 'Ȭ', - 'ȯ' => 'Ȯ', - 'ȱ' => 'Ȱ', - 'ȳ' => 'Ȳ', - 'ȼ' => 'Ȼ', - 'ȿ' => 'Ȿ', - 'ɀ' => 'Ɀ', - 'ɂ' => 'Ɂ', - 'ɇ' => 'Ɇ', - 'ɉ' => 'Ɉ', - 'ɋ' => 'Ɋ', - 'ɍ' => 'Ɍ', - 'ɏ' => 'Ɏ', - 'ɐ' => 'Ɐ', - 'ɑ' => 'Ɑ', - 'ɒ' => 'Ɒ', - 'ɓ' => 'Ɓ', - 'ɔ' => 'Ɔ', - 'ɖ' => 'Ɖ', - 'ɗ' => 'Ɗ', - 'ə' => 'Ə', - 'ɛ' => 'Ɛ', - 'ɜ' => 'Ɜ', - 'ɠ' => 'Ɠ', - 'ɡ' => 'Ɡ', - 'ɣ' => 'Ɣ', - 'ɥ' => 'Ɥ', - 'ɦ' => 'Ɦ', - 'ɨ' => 'Ɨ', - 'ɩ' => 'Ɩ', - 'ɪ' => 'Ɪ', - 'ɫ' => 'Ɫ', - 'ɬ' => 'Ɬ', - 'ɯ' => 'Ɯ', - 'ɱ' => 'Ɱ', - 'ɲ' => 'Ɲ', - 'ɵ' => 'Ɵ', - 'ɽ' => 'Ɽ', - 'ʀ' => 'Ʀ', - 'ʂ' => 'Ʂ', - 'ʃ' => 'Ʃ', - 'ʇ' => 'Ʇ', - 'ʈ' => 'Ʈ', - 'ʉ' => 'Ʉ', - 'ʊ' => 'Ʊ', - 'ʋ' => 'Ʋ', - 'ʌ' => 'Ʌ', - 'ʒ' => 'Ʒ', - 'ʝ' => 'Ʝ', - 'ʞ' => 'Ʞ', - 'ͅ' => 'Ι', - 'ͱ' => 'Ͱ', - 'ͳ' => 'Ͳ', - 'ͷ' => 'Ͷ', - 'ͻ' => 'Ͻ', - 'ͼ' => 'Ͼ', - 'ͽ' => 'Ͽ', - 'ά' => 'Ά', - 'έ' => 'Έ', - 'ή' => 'Ή', - 'ί' => 'Ί', - 'α' => 'Α', - 'β' => 'Β', - 'γ' => 'Γ', - 'δ' => 'Δ', - 'ε' => 'Ε', - 'ζ' => 'Ζ', - 'η' => 'Η', - 'θ' => 'Θ', - 'ι' => 'Ι', - 'κ' => 'Κ', - 'λ' => 'Λ', - 'μ' => 'Μ', - 'ν' => 'Ν', - 'ξ' => 'Ξ', - 'ο' => 'Ο', - 'π' => 'Π', - 'ρ' => 'Ρ', - 'ς' => 'Σ', - 'σ' => 'Σ', - 'τ' => 'Τ', - 'υ' => 'Υ', - 'φ' => 'Φ', - 'χ' => 'Χ', - 'ψ' => 'Ψ', - 'ω' => 'Ω', - 'ϊ' => 'Ϊ', - 'ϋ' => 'Ϋ', - 'ό' => 'Ό', - 'ύ' => 'Ύ', - 'ώ' => 'Ώ', - 'ϐ' => 'Β', - 'ϑ' => 'Θ', - 'ϕ' => 'Φ', - 'ϖ' => 'Π', - 'ϗ' => 'Ϗ', - 'ϙ' => 'Ϙ', - 'ϛ' => 'Ϛ', - 'ϝ' => 'Ϝ', - 'ϟ' => 'Ϟ', - 'ϡ' => 'Ϡ', - 'ϣ' => 'Ϣ', - 'ϥ' => 'Ϥ', - 'ϧ' => 'Ϧ', - 'ϩ' => 'Ϩ', - 'ϫ' => 'Ϫ', - 'ϭ' => 'Ϭ', - 'ϯ' => 'Ϯ', - 'ϰ' => 'Κ', - 'ϱ' => 'Ρ', - 'ϲ' => 'Ϲ', - 'ϳ' => 'Ϳ', - 'ϵ' => 'Ε', - 'ϸ' => 'Ϸ', - 'ϻ' => 'Ϻ', - 'а' => 'А', - 'б' => 'Б', - 'в' => 'В', - 'г' => 'Г', - 'д' => 'Д', - 'е' => 'Е', - 'ж' => 'Ж', - 'з' => 'З', - 'и' => 'И', - 'й' => 'Й', - 'к' => 'К', - 'л' => 'Л', - 'м' => 'М', - 'н' => 'Н', - 'о' => 'О', - 'п' => 'П', - 'р' => 'Р', - 'с' => 'С', - 'т' => 'Т', - 'у' => 'У', - 'ф' => 'Ф', - 'х' => 'Х', - 'ц' => 'Ц', - 'ч' => 'Ч', - 'ш' => 'Ш', - 'щ' => 'Щ', - 'ъ' => 'Ъ', - 'ы' => 'Ы', - 'ь' => 'Ь', - 'э' => 'Э', - 'ю' => 'Ю', - 'я' => 'Я', - 'ѐ' => 'Ѐ', - 'ё' => 'Ё', - 'ђ' => 'Ђ', - 'ѓ' => 'Ѓ', - 'є' => 'Є', - 'ѕ' => 'Ѕ', - 'і' => 'І', - 'ї' => 'Ї', - 'ј' => 'Ј', - 'љ' => 'Љ', - 'њ' => 'Њ', - 'ћ' => 'Ћ', - 'ќ' => 'Ќ', - 'ѝ' => 'Ѝ', - 'ў' => 'Ў', - 'џ' => 'Џ', - 'ѡ' => 'Ѡ', - 'ѣ' => 'Ѣ', - 'ѥ' => 'Ѥ', - 'ѧ' => 'Ѧ', - 'ѩ' => 'Ѩ', - 'ѫ' => 'Ѫ', - 'ѭ' => 'Ѭ', - 'ѯ' => 'Ѯ', - 'ѱ' => 'Ѱ', - 'ѳ' => 'Ѳ', - 'ѵ' => 'Ѵ', - 'ѷ' => 'Ѷ', - 'ѹ' => 'Ѹ', - 'ѻ' => 'Ѻ', - 'ѽ' => 'Ѽ', - 'ѿ' => 'Ѿ', - 'ҁ' => 'Ҁ', - 'ҋ' => 'Ҋ', - 'ҍ' => 'Ҍ', - 'ҏ' => 'Ҏ', - 'ґ' => 'Ґ', - 'ғ' => 'Ғ', - 'ҕ' => 'Ҕ', - 'җ' => 'Җ', - 'ҙ' => 'Ҙ', - 'қ' => 'Қ', - 'ҝ' => 'Ҝ', - 'ҟ' => 'Ҟ', - 'ҡ' => 'Ҡ', - 'ң' => 'Ң', - 'ҥ' => 'Ҥ', - 'ҧ' => 'Ҧ', - 'ҩ' => 'Ҩ', - 'ҫ' => 'Ҫ', - 'ҭ' => 'Ҭ', - 'ү' => 'Ү', - 'ұ' => 'Ұ', - 'ҳ' => 'Ҳ', - 'ҵ' => 'Ҵ', - 'ҷ' => 'Ҷ', - 'ҹ' => 'Ҹ', - 'һ' => 'Һ', - 'ҽ' => 'Ҽ', - 'ҿ' => 'Ҿ', - 'ӂ' => 'Ӂ', - 'ӄ' => 'Ӄ', - 'ӆ' => 'Ӆ', - 'ӈ' => 'Ӈ', - 'ӊ' => 'Ӊ', - 'ӌ' => 'Ӌ', - 'ӎ' => 'Ӎ', - 'ӏ' => 'Ӏ', - 'ӑ' => 'Ӑ', - 'ӓ' => 'Ӓ', - 'ӕ' => 'Ӕ', - 'ӗ' => 'Ӗ', - 'ә' => 'Ә', - 'ӛ' => 'Ӛ', - 'ӝ' => 'Ӝ', - 'ӟ' => 'Ӟ', - 'ӡ' => 'Ӡ', - 'ӣ' => 'Ӣ', - 'ӥ' => 'Ӥ', - 'ӧ' => 'Ӧ', - 'ө' => 'Ө', - 'ӫ' => 'Ӫ', - 'ӭ' => 'Ӭ', - 'ӯ' => 'Ӯ', - 'ӱ' => 'Ӱ', - 'ӳ' => 'Ӳ', - 'ӵ' => 'Ӵ', - 'ӷ' => 'Ӷ', - 'ӹ' => 'Ӹ', - 'ӻ' => 'Ӻ', - 'ӽ' => 'Ӽ', - 'ӿ' => 'Ӿ', - 'ԁ' => 'Ԁ', - 'ԃ' => 'Ԃ', - 'ԅ' => 'Ԅ', - 'ԇ' => 'Ԇ', - 'ԉ' => 'Ԉ', - 'ԋ' => 'Ԋ', - 'ԍ' => 'Ԍ', - 'ԏ' => 'Ԏ', - 'ԑ' => 'Ԑ', - 'ԓ' => 'Ԓ', - 'ԕ' => 'Ԕ', - 'ԗ' => 'Ԗ', - 'ԙ' => 'Ԙ', - 'ԛ' => 'Ԛ', - 'ԝ' => 'Ԝ', - 'ԟ' => 'Ԟ', - 'ԡ' => 'Ԡ', - 'ԣ' => 'Ԣ', - 'ԥ' => 'Ԥ', - 'ԧ' => 'Ԧ', - 'ԩ' => 'Ԩ', - 'ԫ' => 'Ԫ', - 'ԭ' => 'Ԭ', - 'ԯ' => 'Ԯ', - 'ա' => 'Ա', - 'բ' => 'Բ', - 'գ' => 'Գ', - 'դ' => 'Դ', - 'ե' => 'Ե', - 'զ' => 'Զ', - 'է' => 'Է', - 'ը' => 'Ը', - 'թ' => 'Թ', - 'ժ' => 'Ժ', - 'ի' => 'Ի', - 'լ' => 'Լ', - 'խ' => 'Խ', - 'ծ' => 'Ծ', - 'կ' => 'Կ', - 'հ' => 'Հ', - 'ձ' => 'Ձ', - 'ղ' => 'Ղ', - 'ճ' => 'Ճ', - 'մ' => 'Մ', - 'յ' => 'Յ', - 'ն' => 'Ն', - 'շ' => 'Շ', - 'ո' => 'Ո', - 'չ' => 'Չ', - 'պ' => 'Պ', - 'ջ' => 'Ջ', - 'ռ' => 'Ռ', - 'ս' => 'Ս', - 'վ' => 'Վ', - 'տ' => 'Տ', - 'ր' => 'Ր', - 'ց' => 'Ց', - 'ւ' => 'Ւ', - 'փ' => 'Փ', - 'ք' => 'Ք', - 'օ' => 'Օ', - 'ֆ' => 'Ֆ', - 'ა' => 'Ა', - 'ბ' => 'Ბ', - 'გ' => 'Გ', - 'დ' => 'Დ', - 'ე' => 'Ე', - 'ვ' => 'Ვ', - 'ზ' => 'Ზ', - 'თ' => 'Თ', - 'ი' => 'Ი', - 'კ' => 'Კ', - 'ლ' => 'Ლ', - 'მ' => 'Მ', - 'ნ' => 'Ნ', - 'ო' => 'Ო', - 'პ' => 'Პ', - 'ჟ' => 'Ჟ', - 'რ' => 'Რ', - 'ს' => 'Ს', - 'ტ' => 'Ტ', - 'უ' => 'Უ', - 'ფ' => 'Ფ', - 'ქ' => 'Ქ', - 'ღ' => 'Ღ', - 'ყ' => 'Ყ', - 'შ' => 'Შ', - 'ჩ' => 'Ჩ', - 'ც' => 'Ც', - 'ძ' => 'Ძ', - 'წ' => 'Წ', - 'ჭ' => 'Ჭ', - 'ხ' => 'Ხ', - 'ჯ' => 'Ჯ', - 'ჰ' => 'Ჰ', - 'ჱ' => 'Ჱ', - 'ჲ' => 'Ჲ', - 'ჳ' => 'Ჳ', - 'ჴ' => 'Ჴ', - 'ჵ' => 'Ჵ', - 'ჶ' => 'Ჶ', - 'ჷ' => 'Ჷ', - 'ჸ' => 'Ჸ', - 'ჹ' => 'Ჹ', - 'ჺ' => 'Ჺ', - 'ჽ' => 'Ჽ', - 'ჾ' => 'Ჾ', - 'ჿ' => 'Ჿ', - 'ᏸ' => 'Ᏸ', - 'ᏹ' => 'Ᏹ', - 'ᏺ' => 'Ᏺ', - 'ᏻ' => 'Ᏻ', - 'ᏼ' => 'Ᏼ', - 'ᏽ' => 'Ᏽ', - 'ᲀ' => 'В', - 'ᲁ' => 'Д', - 'ᲂ' => 'О', - 'ᲃ' => 'С', - 'ᲄ' => 'Т', - 'ᲅ' => 'Т', - 'ᲆ' => 'Ъ', - 'ᲇ' => 'Ѣ', - 'ᲈ' => 'Ꙋ', - 'ᵹ' => 'Ᵹ', - 'ᵽ' => 'Ᵽ', - 'ᶎ' => 'Ᶎ', - 'ḁ' => 'Ḁ', - 'ḃ' => 'Ḃ', - 'ḅ' => 'Ḅ', - 'ḇ' => 'Ḇ', - 'ḉ' => 'Ḉ', - 'ḋ' => 'Ḋ', - 'ḍ' => 'Ḍ', - 'ḏ' => 'Ḏ', - 'ḑ' => 'Ḑ', - 'ḓ' => 'Ḓ', - 'ḕ' => 'Ḕ', - 'ḗ' => 'Ḗ', - 'ḙ' => 'Ḙ', - 'ḛ' => 'Ḛ', - 'ḝ' => 'Ḝ', - 'ḟ' => 'Ḟ', - 'ḡ' => 'Ḡ', - 'ḣ' => 'Ḣ', - 'ḥ' => 'Ḥ', - 'ḧ' => 'Ḧ', - 'ḩ' => 'Ḩ', - 'ḫ' => 'Ḫ', - 'ḭ' => 'Ḭ', - 'ḯ' => 'Ḯ', - 'ḱ' => 'Ḱ', - 'ḳ' => 'Ḳ', - 'ḵ' => 'Ḵ', - 'ḷ' => 'Ḷ', - 'ḹ' => 'Ḹ', - 'ḻ' => 'Ḻ', - 'ḽ' => 'Ḽ', - 'ḿ' => 'Ḿ', - 'ṁ' => 'Ṁ', - 'ṃ' => 'Ṃ', - 'ṅ' => 'Ṅ', - 'ṇ' => 'Ṇ', - 'ṉ' => 'Ṉ', - 'ṋ' => 'Ṋ', - 'ṍ' => 'Ṍ', - 'ṏ' => 'Ṏ', - 'ṑ' => 'Ṑ', - 'ṓ' => 'Ṓ', - 'ṕ' => 'Ṕ', - 'ṗ' => 'Ṗ', - 'ṙ' => 'Ṙ', - 'ṛ' => 'Ṛ', - 'ṝ' => 'Ṝ', - 'ṟ' => 'Ṟ', - 'ṡ' => 'Ṡ', - 'ṣ' => 'Ṣ', - 'ṥ' => 'Ṥ', - 'ṧ' => 'Ṧ', - 'ṩ' => 'Ṩ', - 'ṫ' => 'Ṫ', - 'ṭ' => 'Ṭ', - 'ṯ' => 'Ṯ', - 'ṱ' => 'Ṱ', - 'ṳ' => 'Ṳ', - 'ṵ' => 'Ṵ', - 'ṷ' => 'Ṷ', - 'ṹ' => 'Ṹ', - 'ṻ' => 'Ṻ', - 'ṽ' => 'Ṽ', - 'ṿ' => 'Ṿ', - 'ẁ' => 'Ẁ', - 'ẃ' => 'Ẃ', - 'ẅ' => 'Ẅ', - 'ẇ' => 'Ẇ', - 'ẉ' => 'Ẉ', - 'ẋ' => 'Ẋ', - 'ẍ' => 'Ẍ', - 'ẏ' => 'Ẏ', - 'ẑ' => 'Ẑ', - 'ẓ' => 'Ẓ', - 'ẕ' => 'Ẕ', - 'ẛ' => 'Ṡ', - 'ạ' => 'Ạ', - 'ả' => 'Ả', - 'ấ' => 'Ấ', - 'ầ' => 'Ầ', - 'ẩ' => 'Ẩ', - 'ẫ' => 'Ẫ', - 'ậ' => 'Ậ', - 'ắ' => 'Ắ', - 'ằ' => 'Ằ', - 'ẳ' => 'Ẳ', - 'ẵ' => 'Ẵ', - 'ặ' => 'Ặ', - 'ẹ' => 'Ẹ', - 'ẻ' => 'Ẻ', - 'ẽ' => 'Ẽ', - 'ế' => 'Ế', - 'ề' => 'Ề', - 'ể' => 'Ể', - 'ễ' => 'Ễ', - 'ệ' => 'Ệ', - 'ỉ' => 'Ỉ', - 'ị' => 'Ị', - 'ọ' => 'Ọ', - 'ỏ' => 'Ỏ', - 'ố' => 'Ố', - 'ồ' => 'Ồ', - 'ổ' => 'Ổ', - 'ỗ' => 'Ỗ', - 'ộ' => 'Ộ', - 'ớ' => 'Ớ', - 'ờ' => 'Ờ', - 'ở' => 'Ở', - 'ỡ' => 'Ỡ', - 'ợ' => 'Ợ', - 'ụ' => 'Ụ', - 'ủ' => 'Ủ', - 'ứ' => 'Ứ', - 'ừ' => 'Ừ', - 'ử' => 'Ử', - 'ữ' => 'Ữ', - 'ự' => 'Ự', - 'ỳ' => 'Ỳ', - 'ỵ' => 'Ỵ', - 'ỷ' => 'Ỷ', - 'ỹ' => 'Ỹ', - 'ỻ' => 'Ỻ', - 'ỽ' => 'Ỽ', - 'ỿ' => 'Ỿ', - 'ἀ' => 'Ἀ', - 'ἁ' => 'Ἁ', - 'ἂ' => 'Ἂ', - 'ἃ' => 'Ἃ', - 'ἄ' => 'Ἄ', - 'ἅ' => 'Ἅ', - 'ἆ' => 'Ἆ', - 'ἇ' => 'Ἇ', - 'ἐ' => 'Ἐ', - 'ἑ' => 'Ἑ', - 'ἒ' => 'Ἒ', - 'ἓ' => 'Ἓ', - 'ἔ' => 'Ἔ', - 'ἕ' => 'Ἕ', - 'ἠ' => 'Ἠ', - 'ἡ' => 'Ἡ', - 'ἢ' => 'Ἢ', - 'ἣ' => 'Ἣ', - 'ἤ' => 'Ἤ', - 'ἥ' => 'Ἥ', - 'ἦ' => 'Ἦ', - 'ἧ' => 'Ἧ', - 'ἰ' => 'Ἰ', - 'ἱ' => 'Ἱ', - 'ἲ' => 'Ἲ', - 'ἳ' => 'Ἳ', - 'ἴ' => 'Ἴ', - 'ἵ' => 'Ἵ', - 'ἶ' => 'Ἶ', - 'ἷ' => 'Ἷ', - 'ὀ' => 'Ὀ', - 'ὁ' => 'Ὁ', - 'ὂ' => 'Ὂ', - 'ὃ' => 'Ὃ', - 'ὄ' => 'Ὄ', - 'ὅ' => 'Ὅ', - 'ὑ' => 'Ὑ', - 'ὓ' => 'Ὓ', - 'ὕ' => 'Ὕ', - 'ὗ' => 'Ὗ', - 'ὠ' => 'Ὠ', - 'ὡ' => 'Ὡ', - 'ὢ' => 'Ὢ', - 'ὣ' => 'Ὣ', - 'ὤ' => 'Ὤ', - 'ὥ' => 'Ὥ', - 'ὦ' => 'Ὦ', - 'ὧ' => 'Ὧ', - 'ὰ' => 'Ὰ', - 'ά' => 'Ά', - 'ὲ' => 'Ὲ', - 'έ' => 'Έ', - 'ὴ' => 'Ὴ', - 'ή' => 'Ή', - 'ὶ' => 'Ὶ', - 'ί' => 'Ί', - 'ὸ' => 'Ὸ', - 'ό' => 'Ό', - 'ὺ' => 'Ὺ', - 'ύ' => 'Ύ', - 'ὼ' => 'Ὼ', - 'ώ' => 'Ώ', - 'ᾀ' => 'ἈΙ', - 'ᾁ' => 'ἉΙ', - 'ᾂ' => 'ἊΙ', - 'ᾃ' => 'ἋΙ', - 'ᾄ' => 'ἌΙ', - 'ᾅ' => 'ἍΙ', - 'ᾆ' => 'ἎΙ', - 'ᾇ' => 'ἏΙ', - 'ᾐ' => 'ἨΙ', - 'ᾑ' => 'ἩΙ', - 'ᾒ' => 'ἪΙ', - 'ᾓ' => 'ἫΙ', - 'ᾔ' => 'ἬΙ', - 'ᾕ' => 'ἭΙ', - 'ᾖ' => 'ἮΙ', - 'ᾗ' => 'ἯΙ', - 'ᾠ' => 'ὨΙ', - 'ᾡ' => 'ὩΙ', - 'ᾢ' => 'ὪΙ', - 'ᾣ' => 'ὫΙ', - 'ᾤ' => 'ὬΙ', - 'ᾥ' => 'ὭΙ', - 'ᾦ' => 'ὮΙ', - 'ᾧ' => 'ὯΙ', - 'ᾰ' => 'Ᾰ', - 'ᾱ' => 'Ᾱ', - 'ᾳ' => 'ΑΙ', - 'ι' => 'Ι', - 'ῃ' => 'ΗΙ', - 'ῐ' => 'Ῐ', - 'ῑ' => 'Ῑ', - 'ῠ' => 'Ῠ', - 'ῡ' => 'Ῡ', - 'ῥ' => 'Ῥ', - 'ῳ' => 'ΩΙ', - 'ⅎ' => 'Ⅎ', - 'ⅰ' => 'Ⅰ', - 'ⅱ' => 'Ⅱ', - 'ⅲ' => 'Ⅲ', - 'ⅳ' => 'Ⅳ', - 'ⅴ' => 'Ⅴ', - 'ⅵ' => 'Ⅵ', - 'ⅶ' => 'Ⅶ', - 'ⅷ' => 'Ⅷ', - 'ⅸ' => 'Ⅸ', - 'ⅹ' => 'Ⅹ', - 'ⅺ' => 'Ⅺ', - 'ⅻ' => 'Ⅻ', - 'ⅼ' => 'Ⅼ', - 'ⅽ' => 'Ⅽ', - 'ⅾ' => 'Ⅾ', - 'ⅿ' => 'Ⅿ', - 'ↄ' => 'Ↄ', - 'ⓐ' => 'Ⓐ', - 'ⓑ' => 'Ⓑ', - 'ⓒ' => 'Ⓒ', - 'ⓓ' => 'Ⓓ', - 'ⓔ' => 'Ⓔ', - 'ⓕ' => 'Ⓕ', - 'ⓖ' => 'Ⓖ', - 'ⓗ' => 'Ⓗ', - 'ⓘ' => 'Ⓘ', - 'ⓙ' => 'Ⓙ', - 'ⓚ' => 'Ⓚ', - 'ⓛ' => 'Ⓛ', - 'ⓜ' => 'Ⓜ', - 'ⓝ' => 'Ⓝ', - 'ⓞ' => 'Ⓞ', - 'ⓟ' => 'Ⓟ', - 'ⓠ' => 'Ⓠ', - 'ⓡ' => 'Ⓡ', - 'ⓢ' => 'Ⓢ', - 'ⓣ' => 'Ⓣ', - 'ⓤ' => 'Ⓤ', - 'ⓥ' => 'Ⓥ', - 'ⓦ' => 'Ⓦ', - 'ⓧ' => 'Ⓧ', - 'ⓨ' => 'Ⓨ', - 'ⓩ' => 'Ⓩ', - 'ⰰ' => 'Ⰰ', - 'ⰱ' => 'Ⰱ', - 'ⰲ' => 'Ⰲ', - 'ⰳ' => 'Ⰳ', - 'ⰴ' => 'Ⰴ', - 'ⰵ' => 'Ⰵ', - 'ⰶ' => 'Ⰶ', - 'ⰷ' => 'Ⰷ', - 'ⰸ' => 'Ⰸ', - 'ⰹ' => 'Ⰹ', - 'ⰺ' => 'Ⰺ', - 'ⰻ' => 'Ⰻ', - 'ⰼ' => 'Ⰼ', - 'ⰽ' => 'Ⰽ', - 'ⰾ' => 'Ⰾ', - 'ⰿ' => 'Ⰿ', - 'ⱀ' => 'Ⱀ', - 'ⱁ' => 'Ⱁ', - 'ⱂ' => 'Ⱂ', - 'ⱃ' => 'Ⱃ', - 'ⱄ' => 'Ⱄ', - 'ⱅ' => 'Ⱅ', - 'ⱆ' => 'Ⱆ', - 'ⱇ' => 'Ⱇ', - 'ⱈ' => 'Ⱈ', - 'ⱉ' => 'Ⱉ', - 'ⱊ' => 'Ⱊ', - 'ⱋ' => 'Ⱋ', - 'ⱌ' => 'Ⱌ', - 'ⱍ' => 'Ⱍ', - 'ⱎ' => 'Ⱎ', - 'ⱏ' => 'Ⱏ', - 'ⱐ' => 'Ⱐ', - 'ⱑ' => 'Ⱑ', - 'ⱒ' => 'Ⱒ', - 'ⱓ' => 'Ⱓ', - 'ⱔ' => 'Ⱔ', - 'ⱕ' => 'Ⱕ', - 'ⱖ' => 'Ⱖ', - 'ⱗ' => 'Ⱗ', - 'ⱘ' => 'Ⱘ', - 'ⱙ' => 'Ⱙ', - 'ⱚ' => 'Ⱚ', - 'ⱛ' => 'Ⱛ', - 'ⱜ' => 'Ⱜ', - 'ⱝ' => 'Ⱝ', - 'ⱞ' => 'Ⱞ', - 'ⱡ' => 'Ⱡ', - 'ⱥ' => 'Ⱥ', - 'ⱦ' => 'Ⱦ', - 'ⱨ' => 'Ⱨ', - 'ⱪ' => 'Ⱪ', - 'ⱬ' => 'Ⱬ', - 'ⱳ' => 'Ⱳ', - 'ⱶ' => 'Ⱶ', - 'ⲁ' => 'Ⲁ', - 'ⲃ' => 'Ⲃ', - 'ⲅ' => 'Ⲅ', - 'ⲇ' => 'Ⲇ', - 'ⲉ' => 'Ⲉ', - 'ⲋ' => 'Ⲋ', - 'ⲍ' => 'Ⲍ', - 'ⲏ' => 'Ⲏ', - 'ⲑ' => 'Ⲑ', - 'ⲓ' => 'Ⲓ', - 'ⲕ' => 'Ⲕ', - 'ⲗ' => 'Ⲗ', - 'ⲙ' => 'Ⲙ', - 'ⲛ' => 'Ⲛ', - 'ⲝ' => 'Ⲝ', - 'ⲟ' => 'Ⲟ', - 'ⲡ' => 'Ⲡ', - 'ⲣ' => 'Ⲣ', - 'ⲥ' => 'Ⲥ', - 'ⲧ' => 'Ⲧ', - 'ⲩ' => 'Ⲩ', - 'ⲫ' => 'Ⲫ', - 'ⲭ' => 'Ⲭ', - 'ⲯ' => 'Ⲯ', - 'ⲱ' => 'Ⲱ', - 'ⲳ' => 'Ⲳ', - 'ⲵ' => 'Ⲵ', - 'ⲷ' => 'Ⲷ', - 'ⲹ' => 'Ⲹ', - 'ⲻ' => 'Ⲻ', - 'ⲽ' => 'Ⲽ', - 'ⲿ' => 'Ⲿ', - 'ⳁ' => 'Ⳁ', - 'ⳃ' => 'Ⳃ', - 'ⳅ' => 'Ⳅ', - 'ⳇ' => 'Ⳇ', - 'ⳉ' => 'Ⳉ', - 'ⳋ' => 'Ⳋ', - 'ⳍ' => 'Ⳍ', - 'ⳏ' => 'Ⳏ', - 'ⳑ' => 'Ⳑ', - 'ⳓ' => 'Ⳓ', - 'ⳕ' => 'Ⳕ', - 'ⳗ' => 'Ⳗ', - 'ⳙ' => 'Ⳙ', - 'ⳛ' => 'Ⳛ', - 'ⳝ' => 'Ⳝ', - 'ⳟ' => 'Ⳟ', - 'ⳡ' => 'Ⳡ', - 'ⳣ' => 'Ⳣ', - 'ⳬ' => 'Ⳬ', - 'ⳮ' => 'Ⳮ', - 'ⳳ' => 'Ⳳ', - 'ⴀ' => 'Ⴀ', - 'ⴁ' => 'Ⴁ', - 'ⴂ' => 'Ⴂ', - 'ⴃ' => 'Ⴃ', - 'ⴄ' => 'Ⴄ', - 'ⴅ' => 'Ⴅ', - 'ⴆ' => 'Ⴆ', - 'ⴇ' => 'Ⴇ', - 'ⴈ' => 'Ⴈ', - 'ⴉ' => 'Ⴉ', - 'ⴊ' => 'Ⴊ', - 'ⴋ' => 'Ⴋ', - 'ⴌ' => 'Ⴌ', - 'ⴍ' => 'Ⴍ', - 'ⴎ' => 'Ⴎ', - 'ⴏ' => 'Ⴏ', - 'ⴐ' => 'Ⴐ', - 'ⴑ' => 'Ⴑ', - 'ⴒ' => 'Ⴒ', - 'ⴓ' => 'Ⴓ', - 'ⴔ' => 'Ⴔ', - 'ⴕ' => 'Ⴕ', - 'ⴖ' => 'Ⴖ', - 'ⴗ' => 'Ⴗ', - 'ⴘ' => 'Ⴘ', - 'ⴙ' => 'Ⴙ', - 'ⴚ' => 'Ⴚ', - 'ⴛ' => 'Ⴛ', - 'ⴜ' => 'Ⴜ', - 'ⴝ' => 'Ⴝ', - 'ⴞ' => 'Ⴞ', - 'ⴟ' => 'Ⴟ', - 'ⴠ' => 'Ⴠ', - 'ⴡ' => 'Ⴡ', - 'ⴢ' => 'Ⴢ', - 'ⴣ' => 'Ⴣ', - 'ⴤ' => 'Ⴤ', - 'ⴥ' => 'Ⴥ', - 'ⴧ' => 'Ⴧ', - 'ⴭ' => 'Ⴭ', - 'ꙁ' => 'Ꙁ', - 'ꙃ' => 'Ꙃ', - 'ꙅ' => 'Ꙅ', - 'ꙇ' => 'Ꙇ', - 'ꙉ' => 'Ꙉ', - 'ꙋ' => 'Ꙋ', - 'ꙍ' => 'Ꙍ', - 'ꙏ' => 'Ꙏ', - 'ꙑ' => 'Ꙑ', - 'ꙓ' => 'Ꙓ', - 'ꙕ' => 'Ꙕ', - 'ꙗ' => 'Ꙗ', - 'ꙙ' => 'Ꙙ', - 'ꙛ' => 'Ꙛ', - 'ꙝ' => 'Ꙝ', - 'ꙟ' => 'Ꙟ', - 'ꙡ' => 'Ꙡ', - 'ꙣ' => 'Ꙣ', - 'ꙥ' => 'Ꙥ', - 'ꙧ' => 'Ꙧ', - 'ꙩ' => 'Ꙩ', - 'ꙫ' => 'Ꙫ', - 'ꙭ' => 'Ꙭ', - 'ꚁ' => 'Ꚁ', - 'ꚃ' => 'Ꚃ', - 'ꚅ' => 'Ꚅ', - 'ꚇ' => 'Ꚇ', - 'ꚉ' => 'Ꚉ', - 'ꚋ' => 'Ꚋ', - 'ꚍ' => 'Ꚍ', - 'ꚏ' => 'Ꚏ', - 'ꚑ' => 'Ꚑ', - 'ꚓ' => 'Ꚓ', - 'ꚕ' => 'Ꚕ', - 'ꚗ' => 'Ꚗ', - 'ꚙ' => 'Ꚙ', - 'ꚛ' => 'Ꚛ', - 'ꜣ' => 'Ꜣ', - 'ꜥ' => 'Ꜥ', - 'ꜧ' => 'Ꜧ', - 'ꜩ' => 'Ꜩ', - 'ꜫ' => 'Ꜫ', - 'ꜭ' => 'Ꜭ', - 'ꜯ' => 'Ꜯ', - 'ꜳ' => 'Ꜳ', - 'ꜵ' => 'Ꜵ', - 'ꜷ' => 'Ꜷ', - 'ꜹ' => 'Ꜹ', - 'ꜻ' => 'Ꜻ', - 'ꜽ' => 'Ꜽ', - 'ꜿ' => 'Ꜿ', - 'ꝁ' => 'Ꝁ', - 'ꝃ' => 'Ꝃ', - 'ꝅ' => 'Ꝅ', - 'ꝇ' => 'Ꝇ', - 'ꝉ' => 'Ꝉ', - 'ꝋ' => 'Ꝋ', - 'ꝍ' => 'Ꝍ', - 'ꝏ' => 'Ꝏ', - 'ꝑ' => 'Ꝑ', - 'ꝓ' => 'Ꝓ', - 'ꝕ' => 'Ꝕ', - 'ꝗ' => 'Ꝗ', - 'ꝙ' => 'Ꝙ', - 'ꝛ' => 'Ꝛ', - 'ꝝ' => 'Ꝝ', - 'ꝟ' => 'Ꝟ', - 'ꝡ' => 'Ꝡ', - 'ꝣ' => 'Ꝣ', - 'ꝥ' => 'Ꝥ', - 'ꝧ' => 'Ꝧ', - 'ꝩ' => 'Ꝩ', - 'ꝫ' => 'Ꝫ', - 'ꝭ' => 'Ꝭ', - 'ꝯ' => 'Ꝯ', - 'ꝺ' => 'Ꝺ', - 'ꝼ' => 'Ꝼ', - 'ꝿ' => 'Ꝿ', - 'ꞁ' => 'Ꞁ', - 'ꞃ' => 'Ꞃ', - 'ꞅ' => 'Ꞅ', - 'ꞇ' => 'Ꞇ', - 'ꞌ' => 'Ꞌ', - 'ꞑ' => 'Ꞑ', - 'ꞓ' => 'Ꞓ', - 'ꞔ' => 'Ꞔ', - 'ꞗ' => 'Ꞗ', - 'ꞙ' => 'Ꞙ', - 'ꞛ' => 'Ꞛ', - 'ꞝ' => 'Ꞝ', - 'ꞟ' => 'Ꞟ', - 'ꞡ' => 'Ꞡ', - 'ꞣ' => 'Ꞣ', - 'ꞥ' => 'Ꞥ', - 'ꞧ' => 'Ꞧ', - 'ꞩ' => 'Ꞩ', - 'ꞵ' => 'Ꞵ', - 'ꞷ' => 'Ꞷ', - 'ꞹ' => 'Ꞹ', - 'ꞻ' => 'Ꞻ', - 'ꞽ' => 'Ꞽ', - 'ꞿ' => 'Ꞿ', - 'ꟃ' => 'Ꟃ', - 'ꟈ' => 'Ꟈ', - 'ꟊ' => 'Ꟊ', - 'ꟶ' => 'Ꟶ', - 'ꭓ' => 'Ꭓ', - 'ꭰ' => 'Ꭰ', - 'ꭱ' => 'Ꭱ', - 'ꭲ' => 'Ꭲ', - 'ꭳ' => 'Ꭳ', - 'ꭴ' => 'Ꭴ', - 'ꭵ' => 'Ꭵ', - 'ꭶ' => 'Ꭶ', - 'ꭷ' => 'Ꭷ', - 'ꭸ' => 'Ꭸ', - 'ꭹ' => 'Ꭹ', - 'ꭺ' => 'Ꭺ', - 'ꭻ' => 'Ꭻ', - 'ꭼ' => 'Ꭼ', - 'ꭽ' => 'Ꭽ', - 'ꭾ' => 'Ꭾ', - 'ꭿ' => 'Ꭿ', - 'ꮀ' => 'Ꮀ', - 'ꮁ' => 'Ꮁ', - 'ꮂ' => 'Ꮂ', - 'ꮃ' => 'Ꮃ', - 'ꮄ' => 'Ꮄ', - 'ꮅ' => 'Ꮅ', - 'ꮆ' => 'Ꮆ', - 'ꮇ' => 'Ꮇ', - 'ꮈ' => 'Ꮈ', - 'ꮉ' => 'Ꮉ', - 'ꮊ' => 'Ꮊ', - 'ꮋ' => 'Ꮋ', - 'ꮌ' => 'Ꮌ', - 'ꮍ' => 'Ꮍ', - 'ꮎ' => 'Ꮎ', - 'ꮏ' => 'Ꮏ', - 'ꮐ' => 'Ꮐ', - 'ꮑ' => 'Ꮑ', - 'ꮒ' => 'Ꮒ', - 'ꮓ' => 'Ꮓ', - 'ꮔ' => 'Ꮔ', - 'ꮕ' => 'Ꮕ', - 'ꮖ' => 'Ꮖ', - 'ꮗ' => 'Ꮗ', - 'ꮘ' => 'Ꮘ', - 'ꮙ' => 'Ꮙ', - 'ꮚ' => 'Ꮚ', - 'ꮛ' => 'Ꮛ', - 'ꮜ' => 'Ꮜ', - 'ꮝ' => 'Ꮝ', - 'ꮞ' => 'Ꮞ', - 'ꮟ' => 'Ꮟ', - 'ꮠ' => 'Ꮠ', - 'ꮡ' => 'Ꮡ', - 'ꮢ' => 'Ꮢ', - 'ꮣ' => 'Ꮣ', - 'ꮤ' => 'Ꮤ', - 'ꮥ' => 'Ꮥ', - 'ꮦ' => 'Ꮦ', - 'ꮧ' => 'Ꮧ', - 'ꮨ' => 'Ꮨ', - 'ꮩ' => 'Ꮩ', - 'ꮪ' => 'Ꮪ', - 'ꮫ' => 'Ꮫ', - 'ꮬ' => 'Ꮬ', - 'ꮭ' => 'Ꮭ', - 'ꮮ' => 'Ꮮ', - 'ꮯ' => 'Ꮯ', - 'ꮰ' => 'Ꮰ', - 'ꮱ' => 'Ꮱ', - 'ꮲ' => 'Ꮲ', - 'ꮳ' => 'Ꮳ', - 'ꮴ' => 'Ꮴ', - 'ꮵ' => 'Ꮵ', - 'ꮶ' => 'Ꮶ', - 'ꮷ' => 'Ꮷ', - 'ꮸ' => 'Ꮸ', - 'ꮹ' => 'Ꮹ', - 'ꮺ' => 'Ꮺ', - 'ꮻ' => 'Ꮻ', - 'ꮼ' => 'Ꮼ', - 'ꮽ' => 'Ꮽ', - 'ꮾ' => 'Ꮾ', - 'ꮿ' => 'Ꮿ', - 'a' => 'A', - 'b' => 'B', - 'c' => 'C', - 'd' => 'D', - 'e' => 'E', - 'f' => 'F', - 'g' => 'G', - 'h' => 'H', - 'i' => 'I', - 'j' => 'J', - 'k' => 'K', - 'l' => 'L', - 'm' => 'M', - 'n' => 'N', - 'o' => 'O', - 'p' => 'P', - 'q' => 'Q', - 'r' => 'R', - 's' => 'S', - 't' => 'T', - 'u' => 'U', - 'v' => 'V', - 'w' => 'W', - 'x' => 'X', - 'y' => 'Y', - 'z' => 'Z', - '𐐨' => '𐐀', - '𐐩' => '𐐁', - '𐐪' => '𐐂', - '𐐫' => '𐐃', - '𐐬' => '𐐄', - '𐐭' => '𐐅', - '𐐮' => '𐐆', - '𐐯' => '𐐇', - '𐐰' => '𐐈', - '𐐱' => '𐐉', - '𐐲' => '𐐊', - '𐐳' => '𐐋', - '𐐴' => '𐐌', - '𐐵' => '𐐍', - '𐐶' => '𐐎', - '𐐷' => '𐐏', - '𐐸' => '𐐐', - '𐐹' => '𐐑', - '𐐺' => '𐐒', - '𐐻' => '𐐓', - '𐐼' => '𐐔', - '𐐽' => '𐐕', - '𐐾' => '𐐖', - '𐐿' => '𐐗', - '𐑀' => '𐐘', - '𐑁' => '𐐙', - '𐑂' => '𐐚', - '𐑃' => '𐐛', - '𐑄' => '𐐜', - '𐑅' => '𐐝', - '𐑆' => '𐐞', - '𐑇' => '𐐟', - '𐑈' => '𐐠', - '𐑉' => '𐐡', - '𐑊' => '𐐢', - '𐑋' => '𐐣', - '𐑌' => '𐐤', - '𐑍' => '𐐥', - '𐑎' => '𐐦', - '𐑏' => '𐐧', - '𐓘' => '𐒰', - '𐓙' => '𐒱', - '𐓚' => '𐒲', - '𐓛' => '𐒳', - '𐓜' => '𐒴', - '𐓝' => '𐒵', - '𐓞' => '𐒶', - '𐓟' => '𐒷', - '𐓠' => '𐒸', - '𐓡' => '𐒹', - '𐓢' => '𐒺', - '𐓣' => '𐒻', - '𐓤' => '𐒼', - '𐓥' => '𐒽', - '𐓦' => '𐒾', - '𐓧' => '𐒿', - '𐓨' => '𐓀', - '𐓩' => '𐓁', - '𐓪' => '𐓂', - '𐓫' => '𐓃', - '𐓬' => '𐓄', - '𐓭' => '𐓅', - '𐓮' => '𐓆', - '𐓯' => '𐓇', - '𐓰' => '𐓈', - '𐓱' => '𐓉', - '𐓲' => '𐓊', - '𐓳' => '𐓋', - '𐓴' => '𐓌', - '𐓵' => '𐓍', - '𐓶' => '𐓎', - '𐓷' => '𐓏', - '𐓸' => '𐓐', - '𐓹' => '𐓑', - '𐓺' => '𐓒', - '𐓻' => '𐓓', - '𐳀' => '𐲀', - '𐳁' => '𐲁', - '𐳂' => '𐲂', - '𐳃' => '𐲃', - '𐳄' => '𐲄', - '𐳅' => '𐲅', - '𐳆' => '𐲆', - '𐳇' => '𐲇', - '𐳈' => '𐲈', - '𐳉' => '𐲉', - '𐳊' => '𐲊', - '𐳋' => '𐲋', - '𐳌' => '𐲌', - '𐳍' => '𐲍', - '𐳎' => '𐲎', - '𐳏' => '𐲏', - '𐳐' => '𐲐', - '𐳑' => '𐲑', - '𐳒' => '𐲒', - '𐳓' => '𐲓', - '𐳔' => '𐲔', - '𐳕' => '𐲕', - '𐳖' => '𐲖', - '𐳗' => '𐲗', - '𐳘' => '𐲘', - '𐳙' => '𐲙', - '𐳚' => '𐲚', - '𐳛' => '𐲛', - '𐳜' => '𐲜', - '𐳝' => '𐲝', - '𐳞' => '𐲞', - '𐳟' => '𐲟', - '𐳠' => '𐲠', - '𐳡' => '𐲡', - '𐳢' => '𐲢', - '𐳣' => '𐲣', - '𐳤' => '𐲤', - '𐳥' => '𐲥', - '𐳦' => '𐲦', - '𐳧' => '𐲧', - '𐳨' => '𐲨', - '𐳩' => '𐲩', - '𐳪' => '𐲪', - '𐳫' => '𐲫', - '𐳬' => '𐲬', - '𐳭' => '𐲭', - '𐳮' => '𐲮', - '𐳯' => '𐲯', - '𐳰' => '𐲰', - '𐳱' => '𐲱', - '𐳲' => '𐲲', - '𑣀' => '𑢠', - '𑣁' => '𑢡', - '𑣂' => '𑢢', - '𑣃' => '𑢣', - '𑣄' => '𑢤', - '𑣅' => '𑢥', - '𑣆' => '𑢦', - '𑣇' => '𑢧', - '𑣈' => '𑢨', - '𑣉' => '𑢩', - '𑣊' => '𑢪', - '𑣋' => '𑢫', - '𑣌' => '𑢬', - '𑣍' => '𑢭', - '𑣎' => '𑢮', - '𑣏' => '𑢯', - '𑣐' => '𑢰', - '𑣑' => '𑢱', - '𑣒' => '𑢲', - '𑣓' => '𑢳', - '𑣔' => '𑢴', - '𑣕' => '𑢵', - '𑣖' => '𑢶', - '𑣗' => '𑢷', - '𑣘' => '𑢸', - '𑣙' => '𑢹', - '𑣚' => '𑢺', - '𑣛' => '𑢻', - '𑣜' => '𑢼', - '𑣝' => '𑢽', - '𑣞' => '𑢾', - '𑣟' => '𑢿', - '𖹠' => '𖹀', - '𖹡' => '𖹁', - '𖹢' => '𖹂', - '𖹣' => '𖹃', - '𖹤' => '𖹄', - '𖹥' => '𖹅', - '𖹦' => '𖹆', - '𖹧' => '𖹇', - '𖹨' => '𖹈', - '𖹩' => '𖹉', - '𖹪' => '𖹊', - '𖹫' => '𖹋', - '𖹬' => '𖹌', - '𖹭' => '𖹍', - '𖹮' => '𖹎', - '𖹯' => '𖹏', - '𖹰' => '𖹐', - '𖹱' => '𖹑', - '𖹲' => '𖹒', - '𖹳' => '𖹓', - '𖹴' => '𖹔', - '𖹵' => '𖹕', - '𖹶' => '𖹖', - '𖹷' => '𖹗', - '𖹸' => '𖹘', - '𖹹' => '𖹙', - '𖹺' => '𖹚', - '𖹻' => '𖹛', - '𖹼' => '𖹜', - '𖹽' => '𖹝', - '𖹾' => '𖹞', - '𖹿' => '𖹟', - '𞤢' => '𞤀', - '𞤣' => '𞤁', - '𞤤' => '𞤂', - '𞤥' => '𞤃', - '𞤦' => '𞤄', - '𞤧' => '𞤅', - '𞤨' => '𞤆', - '𞤩' => '𞤇', - '𞤪' => '𞤈', - '𞤫' => '𞤉', - '𞤬' => '𞤊', - '𞤭' => '𞤋', - '𞤮' => '𞤌', - '𞤯' => '𞤍', - '𞤰' => '𞤎', - '𞤱' => '𞤏', - '𞤲' => '𞤐', - '𞤳' => '𞤑', - '𞤴' => '𞤒', - '𞤵' => '𞤓', - '𞤶' => '𞤔', - '𞤷' => '𞤕', - '𞤸' => '𞤖', - '𞤹' => '𞤗', - '𞤺' => '𞤘', - '𞤻' => '𞤙', - '𞤼' => '𞤚', - '𞤽' => '𞤛', - '𞤾' => '𞤜', - '𞤿' => '𞤝', - '𞥀' => '𞤞', - '𞥁' => '𞤟', - '𞥂' => '𞤠', - '𞥃' => '𞤡', - 'ß' => 'SS', - 'ff' => 'FF', - 'fi' => 'FI', - 'fl' => 'FL', - 'ffi' => 'FFI', - 'ffl' => 'FFL', - 'ſt' => 'ST', - 'st' => 'ST', - 'և' => 'ԵՒ', - 'ﬓ' => 'ՄՆ', - 'ﬔ' => 'ՄԵ', - 'ﬕ' => 'ՄԻ', - 'ﬖ' => 'ՎՆ', - 'ﬗ' => 'ՄԽ', - 'ʼn' => 'ʼN', - 'ΐ' => 'Ϊ́', - 'ΰ' => 'Ϋ́', - 'ǰ' => 'J̌', - 'ẖ' => 'H̱', - 'ẗ' => 'T̈', - 'ẘ' => 'W̊', - 'ẙ' => 'Y̊', - 'ẚ' => 'Aʾ', - 'ὐ' => 'Υ̓', - 'ὒ' => 'Υ̓̀', - 'ὔ' => 'Υ̓́', - 'ὖ' => 'Υ̓͂', - 'ᾶ' => 'Α͂', - 'ῆ' => 'Η͂', - 'ῒ' => 'Ϊ̀', - 'ΐ' => 'Ϊ́', - 'ῖ' => 'Ι͂', - 'ῗ' => 'Ϊ͂', - 'ῢ' => 'Ϋ̀', - 'ΰ' => 'Ϋ́', - 'ῤ' => 'Ρ̓', - 'ῦ' => 'Υ͂', - 'ῧ' => 'Ϋ͂', - 'ῶ' => 'Ω͂', - 'ᾈ' => 'ἈΙ', - 'ᾉ' => 'ἉΙ', - 'ᾊ' => 'ἊΙ', - 'ᾋ' => 'ἋΙ', - 'ᾌ' => 'ἌΙ', - 'ᾍ' => 'ἍΙ', - 'ᾎ' => 'ἎΙ', - 'ᾏ' => 'ἏΙ', - 'ᾘ' => 'ἨΙ', - 'ᾙ' => 'ἩΙ', - 'ᾚ' => 'ἪΙ', - 'ᾛ' => 'ἫΙ', - 'ᾜ' => 'ἬΙ', - 'ᾝ' => 'ἭΙ', - 'ᾞ' => 'ἮΙ', - 'ᾟ' => 'ἯΙ', - 'ᾨ' => 'ὨΙ', - 'ᾩ' => 'ὩΙ', - 'ᾪ' => 'ὪΙ', - 'ᾫ' => 'ὫΙ', - 'ᾬ' => 'ὬΙ', - 'ᾭ' => 'ὭΙ', - 'ᾮ' => 'ὮΙ', - 'ᾯ' => 'ὯΙ', - 'ᾼ' => 'ΑΙ', - 'ῌ' => 'ΗΙ', - 'ῼ' => 'ΩΙ', - 'ᾲ' => 'ᾺΙ', - 'ᾴ' => 'ΆΙ', - 'ῂ' => 'ῊΙ', - 'ῄ' => 'ΉΙ', - 'ῲ' => 'ῺΙ', - 'ῴ' => 'ΏΙ', - 'ᾷ' => 'Α͂Ι', - 'ῇ' => 'Η͂Ι', - 'ῷ' => 'Ω͂Ι', -); + 'A', + 'b' => 'B', + 'c' => 'C', + 'd' => 'D', + 'e' => 'E', + 'f' => 'F', + 'g' => 'G', + 'h' => 'H', + 'i' => 'I', + 'j' => 'J', + 'k' => 'K', + 'l' => 'L', + 'm' => 'M', + 'n' => 'N', + 'o' => 'O', + 'p' => 'P', + 'q' => 'Q', + 'r' => 'R', + 's' => 'S', + 't' => 'T', + 'u' => 'U', + 'v' => 'V', + 'w' => 'W', + 'x' => 'X', + 'y' => 'Y', + 'z' => 'Z', + 'µ' => 'Μ', + 'à' => 'À', + 'á' => 'Á', + 'â' => 'Â', + 'ã' => 'Ã', + 'ä' => 'Ä', + 'å' => 'Å', + 'æ' => 'Æ', + 'ç' => 'Ç', + 'è' => 'È', + 'é' => 'É', + 'ê' => 'Ê', + 'ë' => 'Ë', + 'ì' => 'Ì', + 'í' => 'Í', + 'î' => 'Î', + 'ï' => 'Ï', + 'ð' => 'Ð', + 'ñ' => 'Ñ', + 'ò' => 'Ò', + 'ó' => 'Ó', + 'ô' => 'Ô', + 'õ' => 'Õ', + 'ö' => 'Ö', + 'ø' => 'Ø', + 'ù' => 'Ù', + 'ú' => 'Ú', + 'û' => 'Û', + 'ü' => 'Ü', + 'ý' => 'Ý', + 'þ' => 'Þ', + 'ÿ' => 'Ÿ', + 'ā' => 'Ā', + 'ă' => 'Ă', + 'ą' => 'Ą', + 'ć' => 'Ć', + 'ĉ' => 'Ĉ', + 'ċ' => 'Ċ', + 'č' => 'Č', + 'ď' => 'Ď', + 'đ' => 'Đ', + 'ē' => 'Ē', + 'ĕ' => 'Ĕ', + 'ė' => 'Ė', + 'ę' => 'Ę', + 'ě' => 'Ě', + 'ĝ' => 'Ĝ', + 'ğ' => 'Ğ', + 'ġ' => 'Ġ', + 'ģ' => 'Ģ', + 'ĥ' => 'Ĥ', + 'ħ' => 'Ħ', + 'ĩ' => 'Ĩ', + 'ī' => 'Ī', + 'ĭ' => 'Ĭ', + 'į' => 'Į', + 'ı' => 'I', + 'ij' => 'IJ', + 'ĵ' => 'Ĵ', + 'ķ' => 'Ķ', + 'ĺ' => 'Ĺ', + 'ļ' => 'Ļ', + 'ľ' => 'Ľ', + 'ŀ' => 'Ŀ', + 'ł' => 'Ł', + 'ń' => 'Ń', + 'ņ' => 'Ņ', + 'ň' => 'Ň', + 'ŋ' => 'Ŋ', + 'ō' => 'Ō', + 'ŏ' => 'Ŏ', + 'ő' => 'Ő', + 'œ' => 'Œ', + 'ŕ' => 'Ŕ', + 'ŗ' => 'Ŗ', + 'ř' => 'Ř', + 'ś' => 'Ś', + 'ŝ' => 'Ŝ', + 'ş' => 'Ş', + 'š' => 'Š', + 'ţ' => 'Ţ', + 'ť' => 'Ť', + 'ŧ' => 'Ŧ', + 'ũ' => 'Ũ', + 'ū' => 'Ū', + 'ŭ' => 'Ŭ', + 'ů' => 'Ů', + 'ű' => 'Ű', + 'ų' => 'Ų', + 'ŵ' => 'Ŵ', + 'ŷ' => 'Ŷ', + 'ź' => 'Ź', + 'ż' => 'Ż', + 'ž' => 'Ž', + 'ſ' => 'S', + 'ƀ' => 'Ƀ', + 'ƃ' => 'Ƃ', + 'ƅ' => 'Ƅ', + 'ƈ' => 'Ƈ', + 'ƌ' => 'Ƌ', + 'ƒ' => 'Ƒ', + 'ƕ' => 'Ƕ', + 'ƙ' => 'Ƙ', + 'ƚ' => 'Ƚ', + 'ƞ' => 'Ƞ', + 'ơ' => 'Ơ', + 'ƣ' => 'Ƣ', + 'ƥ' => 'Ƥ', + 'ƨ' => 'Ƨ', + 'ƭ' => 'Ƭ', + 'ư' => 'Ư', + 'ƴ' => 'Ƴ', + 'ƶ' => 'Ƶ', + 'ƹ' => 'Ƹ', + 'ƽ' => 'Ƽ', + 'ƿ' => 'Ƿ', + 'Dž' => 'DŽ', + 'dž' => 'DŽ', + 'Lj' => 'LJ', + 'lj' => 'LJ', + 'Nj' => 'NJ', + 'nj' => 'NJ', + 'ǎ' => 'Ǎ', + 'ǐ' => 'Ǐ', + 'ǒ' => 'Ǒ', + 'ǔ' => 'Ǔ', + 'ǖ' => 'Ǖ', + 'ǘ' => 'Ǘ', + 'ǚ' => 'Ǚ', + 'ǜ' => 'Ǜ', + 'ǝ' => 'Ǝ', + 'ǟ' => 'Ǟ', + 'ǡ' => 'Ǡ', + 'ǣ' => 'Ǣ', + 'ǥ' => 'Ǥ', + 'ǧ' => 'Ǧ', + 'ǩ' => 'Ǩ', + 'ǫ' => 'Ǫ', + 'ǭ' => 'Ǭ', + 'ǯ' => 'Ǯ', + 'Dz' => 'DZ', + 'dz' => 'DZ', + 'ǵ' => 'Ǵ', + 'ǹ' => 'Ǹ', + 'ǻ' => 'Ǻ', + 'ǽ' => 'Ǽ', + 'ǿ' => 'Ǿ', + 'ȁ' => 'Ȁ', + 'ȃ' => 'Ȃ', + 'ȅ' => 'Ȅ', + 'ȇ' => 'Ȇ', + 'ȉ' => 'Ȉ', + 'ȋ' => 'Ȋ', + 'ȍ' => 'Ȍ', + 'ȏ' => 'Ȏ', + 'ȑ' => 'Ȑ', + 'ȓ' => 'Ȓ', + 'ȕ' => 'Ȕ', + 'ȗ' => 'Ȗ', + 'ș' => 'Ș', + 'ț' => 'Ț', + 'ȝ' => 'Ȝ', + 'ȟ' => 'Ȟ', + 'ȣ' => 'Ȣ', + 'ȥ' => 'Ȥ', + 'ȧ' => 'Ȧ', + 'ȩ' => 'Ȩ', + 'ȫ' => 'Ȫ', + 'ȭ' => 'Ȭ', + 'ȯ' => 'Ȯ', + 'ȱ' => 'Ȱ', + 'ȳ' => 'Ȳ', + 'ȼ' => 'Ȼ', + 'ȿ' => 'Ȿ', + 'ɀ' => 'Ɀ', + 'ɂ' => 'Ɂ', + 'ɇ' => 'Ɇ', + 'ɉ' => 'Ɉ', + 'ɋ' => 'Ɋ', + 'ɍ' => 'Ɍ', + 'ɏ' => 'Ɏ', + 'ɐ' => 'Ɐ', + 'ɑ' => 'Ɑ', + 'ɒ' => 'Ɒ', + 'ɓ' => 'Ɓ', + 'ɔ' => 'Ɔ', + 'ɖ' => 'Ɖ', + 'ɗ' => 'Ɗ', + 'ə' => 'Ə', + 'ɛ' => 'Ɛ', + 'ɜ' => 'Ɜ', + 'ɠ' => 'Ɠ', + 'ɡ' => 'Ɡ', + 'ɣ' => 'Ɣ', + 'ɥ' => 'Ɥ', + 'ɦ' => 'Ɦ', + 'ɨ' => 'Ɨ', + 'ɩ' => 'Ɩ', + 'ɪ' => 'Ɪ', + 'ɫ' => 'Ɫ', + 'ɬ' => 'Ɬ', + 'ɯ' => 'Ɯ', + 'ɱ' => 'Ɱ', + 'ɲ' => 'Ɲ', + 'ɵ' => 'Ɵ', + 'ɽ' => 'Ɽ', + 'ʀ' => 'Ʀ', + 'ʂ' => 'Ʂ', + 'ʃ' => 'Ʃ', + 'ʇ' => 'Ʇ', + 'ʈ' => 'Ʈ', + 'ʉ' => 'Ʉ', + 'ʊ' => 'Ʊ', + 'ʋ' => 'Ʋ', + 'ʌ' => 'Ʌ', + 'ʒ' => 'Ʒ', + 'ʝ' => 'Ʝ', + 'ʞ' => 'Ʞ', + 'ͅ' => 'Ι', + 'ͱ' => 'Ͱ', + 'ͳ' => 'Ͳ', + 'ͷ' => 'Ͷ', + 'ͻ' => 'Ͻ', + 'ͼ' => 'Ͼ', + 'ͽ' => 'Ͽ', + 'ά' => 'Ά', + 'έ' => 'Έ', + 'ή' => 'Ή', + 'ί' => 'Ί', + 'α' => 'Α', + 'β' => 'Β', + 'γ' => 'Γ', + 'δ' => 'Δ', + 'ε' => 'Ε', + 'ζ' => 'Ζ', + 'η' => 'Η', + 'θ' => 'Θ', + 'ι' => 'Ι', + 'κ' => 'Κ', + 'λ' => 'Λ', + 'μ' => 'Μ', + 'ν' => 'Ν', + 'ξ' => 'Ξ', + 'ο' => 'Ο', + 'π' => 'Π', + 'ρ' => 'Ρ', + 'ς' => 'Σ', + 'σ' => 'Σ', + 'τ' => 'Τ', + 'υ' => 'Υ', + 'φ' => 'Φ', + 'χ' => 'Χ', + 'ψ' => 'Ψ', + 'ω' => 'Ω', + 'ϊ' => 'Ϊ', + 'ϋ' => 'Ϋ', + 'ό' => 'Ό', + 'ύ' => 'Ύ', + 'ώ' => 'Ώ', + 'ϐ' => 'Β', + 'ϑ' => 'Θ', + 'ϕ' => 'Φ', + 'ϖ' => 'Π', + 'ϗ' => 'Ϗ', + 'ϙ' => 'Ϙ', + 'ϛ' => 'Ϛ', + 'ϝ' => 'Ϝ', + 'ϟ' => 'Ϟ', + 'ϡ' => 'Ϡ', + 'ϣ' => 'Ϣ', + 'ϥ' => 'Ϥ', + 'ϧ' => 'Ϧ', + 'ϩ' => 'Ϩ', + 'ϫ' => 'Ϫ', + 'ϭ' => 'Ϭ', + 'ϯ' => 'Ϯ', + 'ϰ' => 'Κ', + 'ϱ' => 'Ρ', + 'ϲ' => 'Ϲ', + 'ϳ' => 'Ϳ', + 'ϵ' => 'Ε', + 'ϸ' => 'Ϸ', + 'ϻ' => 'Ϻ', + 'а' => 'А', + 'б' => 'Б', + 'в' => 'В', + 'г' => 'Г', + 'д' => 'Д', + 'е' => 'Е', + 'ж' => 'Ж', + 'з' => 'З', + 'и' => 'И', + 'й' => 'Й', + 'к' => 'К', + 'л' => 'Л', + 'м' => 'М', + 'н' => 'Н', + 'о' => 'О', + 'п' => 'П', + 'р' => 'Р', + 'с' => 'С', + 'т' => 'Т', + 'у' => 'У', + 'ф' => 'Ф', + 'х' => 'Х', + 'ц' => 'Ц', + 'ч' => 'Ч', + 'ш' => 'Ш', + 'щ' => 'Щ', + 'ъ' => 'Ъ', + 'ы' => 'Ы', + 'ь' => 'Ь', + 'э' => 'Э', + 'ю' => 'Ю', + 'я' => 'Я', + 'ѐ' => 'Ѐ', + 'ё' => 'Ё', + 'ђ' => 'Ђ', + 'ѓ' => 'Ѓ', + 'є' => 'Є', + 'ѕ' => 'Ѕ', + 'і' => 'І', + 'ї' => 'Ї', + 'ј' => 'Ј', + 'љ' => 'Љ', + 'њ' => 'Њ', + 'ћ' => 'Ћ', + 'ќ' => 'Ќ', + 'ѝ' => 'Ѝ', + 'ў' => 'Ў', + 'џ' => 'Џ', + 'ѡ' => 'Ѡ', + 'ѣ' => 'Ѣ', + 'ѥ' => 'Ѥ', + 'ѧ' => 'Ѧ', + 'ѩ' => 'Ѩ', + 'ѫ' => 'Ѫ', + 'ѭ' => 'Ѭ', + 'ѯ' => 'Ѯ', + 'ѱ' => 'Ѱ', + 'ѳ' => 'Ѳ', + 'ѵ' => 'Ѵ', + 'ѷ' => 'Ѷ', + 'ѹ' => 'Ѹ', + 'ѻ' => 'Ѻ', + 'ѽ' => 'Ѽ', + 'ѿ' => 'Ѿ', + 'ҁ' => 'Ҁ', + 'ҋ' => 'Ҋ', + 'ҍ' => 'Ҍ', + 'ҏ' => 'Ҏ', + 'ґ' => 'Ґ', + 'ғ' => 'Ғ', + 'ҕ' => 'Ҕ', + 'җ' => 'Җ', + 'ҙ' => 'Ҙ', + 'қ' => 'Қ', + 'ҝ' => 'Ҝ', + 'ҟ' => 'Ҟ', + 'ҡ' => 'Ҡ', + 'ң' => 'Ң', + 'ҥ' => 'Ҥ', + 'ҧ' => 'Ҧ', + 'ҩ' => 'Ҩ', + 'ҫ' => 'Ҫ', + 'ҭ' => 'Ҭ', + 'ү' => 'Ү', + 'ұ' => 'Ұ', + 'ҳ' => 'Ҳ', + 'ҵ' => 'Ҵ', + 'ҷ' => 'Ҷ', + 'ҹ' => 'Ҹ', + 'һ' => 'Һ', + 'ҽ' => 'Ҽ', + 'ҿ' => 'Ҿ', + 'ӂ' => 'Ӂ', + 'ӄ' => 'Ӄ', + 'ӆ' => 'Ӆ', + 'ӈ' => 'Ӈ', + 'ӊ' => 'Ӊ', + 'ӌ' => 'Ӌ', + 'ӎ' => 'Ӎ', + 'ӏ' => 'Ӏ', + 'ӑ' => 'Ӑ', + 'ӓ' => 'Ӓ', + 'ӕ' => 'Ӕ', + 'ӗ' => 'Ӗ', + 'ә' => 'Ә', + 'ӛ' => 'Ӛ', + 'ӝ' => 'Ӝ', + 'ӟ' => 'Ӟ', + 'ӡ' => 'Ӡ', + 'ӣ' => 'Ӣ', + 'ӥ' => 'Ӥ', + 'ӧ' => 'Ӧ', + 'ө' => 'Ө', + 'ӫ' => 'Ӫ', + 'ӭ' => 'Ӭ', + 'ӯ' => 'Ӯ', + 'ӱ' => 'Ӱ', + 'ӳ' => 'Ӳ', + 'ӵ' => 'Ӵ', + 'ӷ' => 'Ӷ', + 'ӹ' => 'Ӹ', + 'ӻ' => 'Ӻ', + 'ӽ' => 'Ӽ', + 'ӿ' => 'Ӿ', + 'ԁ' => 'Ԁ', + 'ԃ' => 'Ԃ', + 'ԅ' => 'Ԅ', + 'ԇ' => 'Ԇ', + 'ԉ' => 'Ԉ', + 'ԋ' => 'Ԋ', + 'ԍ' => 'Ԍ', + 'ԏ' => 'Ԏ', + 'ԑ' => 'Ԑ', + 'ԓ' => 'Ԓ', + 'ԕ' => 'Ԕ', + 'ԗ' => 'Ԗ', + 'ԙ' => 'Ԙ', + 'ԛ' => 'Ԛ', + 'ԝ' => 'Ԝ', + 'ԟ' => 'Ԟ', + 'ԡ' => 'Ԡ', + 'ԣ' => 'Ԣ', + 'ԥ' => 'Ԥ', + 'ԧ' => 'Ԧ', + 'ԩ' => 'Ԩ', + 'ԫ' => 'Ԫ', + 'ԭ' => 'Ԭ', + 'ԯ' => 'Ԯ', + 'ա' => 'Ա', + 'բ' => 'Բ', + 'գ' => 'Գ', + 'դ' => 'Դ', + 'ե' => 'Ե', + 'զ' => 'Զ', + 'է' => 'Է', + 'ը' => 'Ը', + 'թ' => 'Թ', + 'ժ' => 'Ժ', + 'ի' => 'Ի', + 'լ' => 'Լ', + 'խ' => 'Խ', + 'ծ' => 'Ծ', + 'կ' => 'Կ', + 'հ' => 'Հ', + 'ձ' => 'Ձ', + 'ղ' => 'Ղ', + 'ճ' => 'Ճ', + 'մ' => 'Մ', + 'յ' => 'Յ', + 'ն' => 'Ն', + 'շ' => 'Շ', + 'ո' => 'Ո', + 'չ' => 'Չ', + 'պ' => 'Պ', + 'ջ' => 'Ջ', + 'ռ' => 'Ռ', + 'ս' => 'Ս', + 'վ' => 'Վ', + 'տ' => 'Տ', + 'ր' => 'Ր', + 'ց' => 'Ց', + 'ւ' => 'Ւ', + 'փ' => 'Փ', + 'ք' => 'Ք', + 'օ' => 'Օ', + 'ֆ' => 'Ֆ', + 'ა' => 'Ა', + 'ბ' => 'Ბ', + 'გ' => 'Გ', + 'დ' => 'Დ', + 'ე' => 'Ე', + 'ვ' => 'Ვ', + 'ზ' => 'Ზ', + 'თ' => 'Თ', + 'ი' => 'Ი', + 'კ' => 'Კ', + 'ლ' => 'Ლ', + 'მ' => 'Მ', + 'ნ' => 'Ნ', + 'ო' => 'Ო', + 'პ' => 'Პ', + 'ჟ' => 'Ჟ', + 'რ' => 'Რ', + 'ს' => 'Ს', + 'ტ' => 'Ტ', + 'უ' => 'Უ', + 'ფ' => 'Ფ', + 'ქ' => 'Ქ', + 'ღ' => 'Ღ', + 'ყ' => 'Ყ', + 'შ' => 'Შ', + 'ჩ' => 'Ჩ', + 'ც' => 'Ც', + 'ძ' => 'Ძ', + 'წ' => 'Წ', + 'ჭ' => 'Ჭ', + 'ხ' => 'Ხ', + 'ჯ' => 'Ჯ', + 'ჰ' => 'Ჰ', + 'ჱ' => 'Ჱ', + 'ჲ' => 'Ჲ', + 'ჳ' => 'Ჳ', + 'ჴ' => 'Ჴ', + 'ჵ' => 'Ჵ', + 'ჶ' => 'Ჶ', + 'ჷ' => 'Ჷ', + 'ჸ' => 'Ჸ', + 'ჹ' => 'Ჹ', + 'ჺ' => 'Ჺ', + 'ჽ' => 'Ჽ', + 'ჾ' => 'Ჾ', + 'ჿ' => 'Ჿ', + 'ᏸ' => 'Ᏸ', + 'ᏹ' => 'Ᏹ', + 'ᏺ' => 'Ᏺ', + 'ᏻ' => 'Ᏻ', + 'ᏼ' => 'Ᏼ', + 'ᏽ' => 'Ᏽ', + 'ᲀ' => 'В', + 'ᲁ' => 'Д', + 'ᲂ' => 'О', + 'ᲃ' => 'С', + 'ᲄ' => 'Т', + 'ᲅ' => 'Т', + 'ᲆ' => 'Ъ', + 'ᲇ' => 'Ѣ', + 'ᲈ' => 'Ꙋ', + 'ᵹ' => 'Ᵹ', + 'ᵽ' => 'Ᵽ', + 'ᶎ' => 'Ᶎ', + 'ḁ' => 'Ḁ', + 'ḃ' => 'Ḃ', + 'ḅ' => 'Ḅ', + 'ḇ' => 'Ḇ', + 'ḉ' => 'Ḉ', + 'ḋ' => 'Ḋ', + 'ḍ' => 'Ḍ', + 'ḏ' => 'Ḏ', + 'ḑ' => 'Ḑ', + 'ḓ' => 'Ḓ', + 'ḕ' => 'Ḕ', + 'ḗ' => 'Ḗ', + 'ḙ' => 'Ḙ', + 'ḛ' => 'Ḛ', + 'ḝ' => 'Ḝ', + 'ḟ' => 'Ḟ', + 'ḡ' => 'Ḡ', + 'ḣ' => 'Ḣ', + 'ḥ' => 'Ḥ', + 'ḧ' => 'Ḧ', + 'ḩ' => 'Ḩ', + 'ḫ' => 'Ḫ', + 'ḭ' => 'Ḭ', + 'ḯ' => 'Ḯ', + 'ḱ' => 'Ḱ', + 'ḳ' => 'Ḳ', + 'ḵ' => 'Ḵ', + 'ḷ' => 'Ḷ', + 'ḹ' => 'Ḹ', + 'ḻ' => 'Ḻ', + 'ḽ' => 'Ḽ', + 'ḿ' => 'Ḿ', + 'ṁ' => 'Ṁ', + 'ṃ' => 'Ṃ', + 'ṅ' => 'Ṅ', + 'ṇ' => 'Ṇ', + 'ṉ' => 'Ṉ', + 'ṋ' => 'Ṋ', + 'ṍ' => 'Ṍ', + 'ṏ' => 'Ṏ', + 'ṑ' => 'Ṑ', + 'ṓ' => 'Ṓ', + 'ṕ' => 'Ṕ', + 'ṗ' => 'Ṗ', + 'ṙ' => 'Ṙ', + 'ṛ' => 'Ṛ', + 'ṝ' => 'Ṝ', + 'ṟ' => 'Ṟ', + 'ṡ' => 'Ṡ', + 'ṣ' => 'Ṣ', + 'ṥ' => 'Ṥ', + 'ṧ' => 'Ṧ', + 'ṩ' => 'Ṩ', + 'ṫ' => 'Ṫ', + 'ṭ' => 'Ṭ', + 'ṯ' => 'Ṯ', + 'ṱ' => 'Ṱ', + 'ṳ' => 'Ṳ', + 'ṵ' => 'Ṵ', + 'ṷ' => 'Ṷ', + 'ṹ' => 'Ṹ', + 'ṻ' => 'Ṻ', + 'ṽ' => 'Ṽ', + 'ṿ' => 'Ṿ', + 'ẁ' => 'Ẁ', + 'ẃ' => 'Ẃ', + 'ẅ' => 'Ẅ', + 'ẇ' => 'Ẇ', + 'ẉ' => 'Ẉ', + 'ẋ' => 'Ẋ', + 'ẍ' => 'Ẍ', + 'ẏ' => 'Ẏ', + 'ẑ' => 'Ẑ', + 'ẓ' => 'Ẓ', + 'ẕ' => 'Ẕ', + 'ẛ' => 'Ṡ', + 'ạ' => 'Ạ', + 'ả' => 'Ả', + 'ấ' => 'Ấ', + 'ầ' => 'Ầ', + 'ẩ' => 'Ẩ', + 'ẫ' => 'Ẫ', + 'ậ' => 'Ậ', + 'ắ' => 'Ắ', + 'ằ' => 'Ằ', + 'ẳ' => 'Ẳ', + 'ẵ' => 'Ẵ', + 'ặ' => 'Ặ', + 'ẹ' => 'Ẹ', + 'ẻ' => 'Ẻ', + 'ẽ' => 'Ẽ', + 'ế' => 'Ế', + 'ề' => 'Ề', + 'ể' => 'Ể', + 'ễ' => 'Ễ', + 'ệ' => 'Ệ', + 'ỉ' => 'Ỉ', + 'ị' => 'Ị', + 'ọ' => 'Ọ', + 'ỏ' => 'Ỏ', + 'ố' => 'Ố', + 'ồ' => 'Ồ', + 'ổ' => 'Ổ', + 'ỗ' => 'Ỗ', + 'ộ' => 'Ộ', + 'ớ' => 'Ớ', + 'ờ' => 'Ờ', + 'ở' => 'Ở', + 'ỡ' => 'Ỡ', + 'ợ' => 'Ợ', + 'ụ' => 'Ụ', + 'ủ' => 'Ủ', + 'ứ' => 'Ứ', + 'ừ' => 'Ừ', + 'ử' => 'Ử', + 'ữ' => 'Ữ', + 'ự' => 'Ự', + 'ỳ' => 'Ỳ', + 'ỵ' => 'Ỵ', + 'ỷ' => 'Ỷ', + 'ỹ' => 'Ỹ', + 'ỻ' => 'Ỻ', + 'ỽ' => 'Ỽ', + 'ỿ' => 'Ỿ', + 'ἀ' => 'Ἀ', + 'ἁ' => 'Ἁ', + 'ἂ' => 'Ἂ', + 'ἃ' => 'Ἃ', + 'ἄ' => 'Ἄ', + 'ἅ' => 'Ἅ', + 'ἆ' => 'Ἆ', + 'ἇ' => 'Ἇ', + 'ἐ' => 'Ἐ', + 'ἑ' => 'Ἑ', + 'ἒ' => 'Ἒ', + 'ἓ' => 'Ἓ', + 'ἔ' => 'Ἔ', + 'ἕ' => 'Ἕ', + 'ἠ' => 'Ἠ', + 'ἡ' => 'Ἡ', + 'ἢ' => 'Ἢ', + 'ἣ' => 'Ἣ', + 'ἤ' => 'Ἤ', + 'ἥ' => 'Ἥ', + 'ἦ' => 'Ἦ', + 'ἧ' => 'Ἧ', + 'ἰ' => 'Ἰ', + 'ἱ' => 'Ἱ', + 'ἲ' => 'Ἲ', + 'ἳ' => 'Ἳ', + 'ἴ' => 'Ἴ', + 'ἵ' => 'Ἵ', + 'ἶ' => 'Ἶ', + 'ἷ' => 'Ἷ', + 'ὀ' => 'Ὀ', + 'ὁ' => 'Ὁ', + 'ὂ' => 'Ὂ', + 'ὃ' => 'Ὃ', + 'ὄ' => 'Ὄ', + 'ὅ' => 'Ὅ', + 'ὑ' => 'Ὑ', + 'ὓ' => 'Ὓ', + 'ὕ' => 'Ὕ', + 'ὗ' => 'Ὗ', + 'ὠ' => 'Ὠ', + 'ὡ' => 'Ὡ', + 'ὢ' => 'Ὢ', + 'ὣ' => 'Ὣ', + 'ὤ' => 'Ὤ', + 'ὥ' => 'Ὥ', + 'ὦ' => 'Ὦ', + 'ὧ' => 'Ὧ', + 'ὰ' => 'Ὰ', + 'ά' => 'Ά', + 'ὲ' => 'Ὲ', + 'έ' => 'Έ', + 'ὴ' => 'Ὴ', + 'ή' => 'Ή', + 'ὶ' => 'Ὶ', + 'ί' => 'Ί', + 'ὸ' => 'Ὸ', + 'ό' => 'Ό', + 'ὺ' => 'Ὺ', + 'ύ' => 'Ύ', + 'ὼ' => 'Ὼ', + 'ώ' => 'Ώ', + 'ᾀ' => 'ἈΙ', + 'ᾁ' => 'ἉΙ', + 'ᾂ' => 'ἊΙ', + 'ᾃ' => 'ἋΙ', + 'ᾄ' => 'ἌΙ', + 'ᾅ' => 'ἍΙ', + 'ᾆ' => 'ἎΙ', + 'ᾇ' => 'ἏΙ', + 'ᾐ' => 'ἨΙ', + 'ᾑ' => 'ἩΙ', + 'ᾒ' => 'ἪΙ', + 'ᾓ' => 'ἫΙ', + 'ᾔ' => 'ἬΙ', + 'ᾕ' => 'ἭΙ', + 'ᾖ' => 'ἮΙ', + 'ᾗ' => 'ἯΙ', + 'ᾠ' => 'ὨΙ', + 'ᾡ' => 'ὩΙ', + 'ᾢ' => 'ὪΙ', + 'ᾣ' => 'ὫΙ', + 'ᾤ' => 'ὬΙ', + 'ᾥ' => 'ὭΙ', + 'ᾦ' => 'ὮΙ', + 'ᾧ' => 'ὯΙ', + 'ᾰ' => 'Ᾰ', + 'ᾱ' => 'Ᾱ', + 'ᾳ' => 'ΑΙ', + 'ι' => 'Ι', + 'ῃ' => 'ΗΙ', + 'ῐ' => 'Ῐ', + 'ῑ' => 'Ῑ', + 'ῠ' => 'Ῠ', + 'ῡ' => 'Ῡ', + 'ῥ' => 'Ῥ', + 'ῳ' => 'ΩΙ', + 'ⅎ' => 'Ⅎ', + 'ⅰ' => 'Ⅰ', + 'ⅱ' => 'Ⅱ', + 'ⅲ' => 'Ⅲ', + 'ⅳ' => 'Ⅳ', + 'ⅴ' => 'Ⅴ', + 'ⅵ' => 'Ⅵ', + 'ⅶ' => 'Ⅶ', + 'ⅷ' => 'Ⅷ', + 'ⅸ' => 'Ⅸ', + 'ⅹ' => 'Ⅹ', + 'ⅺ' => 'Ⅺ', + 'ⅻ' => 'Ⅻ', + 'ⅼ' => 'Ⅼ', + 'ⅽ' => 'Ⅽ', + 'ⅾ' => 'Ⅾ', + 'ⅿ' => 'Ⅿ', + 'ↄ' => 'Ↄ', + 'ⓐ' => 'Ⓐ', + 'ⓑ' => 'Ⓑ', + 'ⓒ' => 'Ⓒ', + 'ⓓ' => 'Ⓓ', + 'ⓔ' => 'Ⓔ', + 'ⓕ' => 'Ⓕ', + 'ⓖ' => 'Ⓖ', + 'ⓗ' => 'Ⓗ', + 'ⓘ' => 'Ⓘ', + 'ⓙ' => 'Ⓙ', + 'ⓚ' => 'Ⓚ', + 'ⓛ' => 'Ⓛ', + 'ⓜ' => 'Ⓜ', + 'ⓝ' => 'Ⓝ', + 'ⓞ' => 'Ⓞ', + 'ⓟ' => 'Ⓟ', + 'ⓠ' => 'Ⓠ', + 'ⓡ' => 'Ⓡ', + 'ⓢ' => 'Ⓢ', + 'ⓣ' => 'Ⓣ', + 'ⓤ' => 'Ⓤ', + 'ⓥ' => 'Ⓥ', + 'ⓦ' => 'Ⓦ', + 'ⓧ' => 'Ⓧ', + 'ⓨ' => 'Ⓨ', + 'ⓩ' => 'Ⓩ', + 'ⰰ' => 'Ⰰ', + 'ⰱ' => 'Ⰱ', + 'ⰲ' => 'Ⰲ', + 'ⰳ' => 'Ⰳ', + 'ⰴ' => 'Ⰴ', + 'ⰵ' => 'Ⰵ', + 'ⰶ' => 'Ⰶ', + 'ⰷ' => 'Ⰷ', + 'ⰸ' => 'Ⰸ', + 'ⰹ' => 'Ⰹ', + 'ⰺ' => 'Ⰺ', + 'ⰻ' => 'Ⰻ', + 'ⰼ' => 'Ⰼ', + 'ⰽ' => 'Ⰽ', + 'ⰾ' => 'Ⰾ', + 'ⰿ' => 'Ⰿ', + 'ⱀ' => 'Ⱀ', + 'ⱁ' => 'Ⱁ', + 'ⱂ' => 'Ⱂ', + 'ⱃ' => 'Ⱃ', + 'ⱄ' => 'Ⱄ', + 'ⱅ' => 'Ⱅ', + 'ⱆ' => 'Ⱆ', + 'ⱇ' => 'Ⱇ', + 'ⱈ' => 'Ⱈ', + 'ⱉ' => 'Ⱉ', + 'ⱊ' => 'Ⱊ', + 'ⱋ' => 'Ⱋ', + 'ⱌ' => 'Ⱌ', + 'ⱍ' => 'Ⱍ', + 'ⱎ' => 'Ⱎ', + 'ⱏ' => 'Ⱏ', + 'ⱐ' => 'Ⱐ', + 'ⱑ' => 'Ⱑ', + 'ⱒ' => 'Ⱒ', + 'ⱓ' => 'Ⱓ', + 'ⱔ' => 'Ⱔ', + 'ⱕ' => 'Ⱕ', + 'ⱖ' => 'Ⱖ', + 'ⱗ' => 'Ⱗ', + 'ⱘ' => 'Ⱘ', + 'ⱙ' => 'Ⱙ', + 'ⱚ' => 'Ⱚ', + 'ⱛ' => 'Ⱛ', + 'ⱜ' => 'Ⱜ', + 'ⱝ' => 'Ⱝ', + 'ⱞ' => 'Ⱞ', + 'ⱡ' => 'Ⱡ', + 'ⱥ' => 'Ⱥ', + 'ⱦ' => 'Ⱦ', + 'ⱨ' => 'Ⱨ', + 'ⱪ' => 'Ⱪ', + 'ⱬ' => 'Ⱬ', + 'ⱳ' => 'Ⱳ', + 'ⱶ' => 'Ⱶ', + 'ⲁ' => 'Ⲁ', + 'ⲃ' => 'Ⲃ', + 'ⲅ' => 'Ⲅ', + 'ⲇ' => 'Ⲇ', + 'ⲉ' => 'Ⲉ', + 'ⲋ' => 'Ⲋ', + 'ⲍ' => 'Ⲍ', + 'ⲏ' => 'Ⲏ', + 'ⲑ' => 'Ⲑ', + 'ⲓ' => 'Ⲓ', + 'ⲕ' => 'Ⲕ', + 'ⲗ' => 'Ⲗ', + 'ⲙ' => 'Ⲙ', + 'ⲛ' => 'Ⲛ', + 'ⲝ' => 'Ⲝ', + 'ⲟ' => 'Ⲟ', + 'ⲡ' => 'Ⲡ', + 'ⲣ' => 'Ⲣ', + 'ⲥ' => 'Ⲥ', + 'ⲧ' => 'Ⲧ', + 'ⲩ' => 'Ⲩ', + 'ⲫ' => 'Ⲫ', + 'ⲭ' => 'Ⲭ', + 'ⲯ' => 'Ⲯ', + 'ⲱ' => 'Ⲱ', + 'ⲳ' => 'Ⲳ', + 'ⲵ' => 'Ⲵ', + 'ⲷ' => 'Ⲷ', + 'ⲹ' => 'Ⲹ', + 'ⲻ' => 'Ⲻ', + 'ⲽ' => 'Ⲽ', + 'ⲿ' => 'Ⲿ', + 'ⳁ' => 'Ⳁ', + 'ⳃ' => 'Ⳃ', + 'ⳅ' => 'Ⳅ', + 'ⳇ' => 'Ⳇ', + 'ⳉ' => 'Ⳉ', + 'ⳋ' => 'Ⳋ', + 'ⳍ' => 'Ⳍ', + 'ⳏ' => 'Ⳏ', + 'ⳑ' => 'Ⳑ', + 'ⳓ' => 'Ⳓ', + 'ⳕ' => 'Ⳕ', + 'ⳗ' => 'Ⳗ', + 'ⳙ' => 'Ⳙ', + 'ⳛ' => 'Ⳛ', + 'ⳝ' => 'Ⳝ', + 'ⳟ' => 'Ⳟ', + 'ⳡ' => 'Ⳡ', + 'ⳣ' => 'Ⳣ', + 'ⳬ' => 'Ⳬ', + 'ⳮ' => 'Ⳮ', + 'ⳳ' => 'Ⳳ', + 'ⴀ' => 'Ⴀ', + 'ⴁ' => 'Ⴁ', + 'ⴂ' => 'Ⴂ', + 'ⴃ' => 'Ⴃ', + 'ⴄ' => 'Ⴄ', + 'ⴅ' => 'Ⴅ', + 'ⴆ' => 'Ⴆ', + 'ⴇ' => 'Ⴇ', + 'ⴈ' => 'Ⴈ', + 'ⴉ' => 'Ⴉ', + 'ⴊ' => 'Ⴊ', + 'ⴋ' => 'Ⴋ', + 'ⴌ' => 'Ⴌ', + 'ⴍ' => 'Ⴍ', + 'ⴎ' => 'Ⴎ', + 'ⴏ' => 'Ⴏ', + 'ⴐ' => 'Ⴐ', + 'ⴑ' => 'Ⴑ', + 'ⴒ' => 'Ⴒ', + 'ⴓ' => 'Ⴓ', + 'ⴔ' => 'Ⴔ', + 'ⴕ' => 'Ⴕ', + 'ⴖ' => 'Ⴖ', + 'ⴗ' => 'Ⴗ', + 'ⴘ' => 'Ⴘ', + 'ⴙ' => 'Ⴙ', + 'ⴚ' => 'Ⴚ', + 'ⴛ' => 'Ⴛ', + 'ⴜ' => 'Ⴜ', + 'ⴝ' => 'Ⴝ', + 'ⴞ' => 'Ⴞ', + 'ⴟ' => 'Ⴟ', + 'ⴠ' => 'Ⴠ', + 'ⴡ' => 'Ⴡ', + 'ⴢ' => 'Ⴢ', + 'ⴣ' => 'Ⴣ', + 'ⴤ' => 'Ⴤ', + 'ⴥ' => 'Ⴥ', + 'ⴧ' => 'Ⴧ', + 'ⴭ' => 'Ⴭ', + 'ꙁ' => 'Ꙁ', + 'ꙃ' => 'Ꙃ', + 'ꙅ' => 'Ꙅ', + 'ꙇ' => 'Ꙇ', + 'ꙉ' => 'Ꙉ', + 'ꙋ' => 'Ꙋ', + 'ꙍ' => 'Ꙍ', + 'ꙏ' => 'Ꙏ', + 'ꙑ' => 'Ꙑ', + 'ꙓ' => 'Ꙓ', + 'ꙕ' => 'Ꙕ', + 'ꙗ' => 'Ꙗ', + 'ꙙ' => 'Ꙙ', + 'ꙛ' => 'Ꙛ', + 'ꙝ' => 'Ꙝ', + 'ꙟ' => 'Ꙟ', + 'ꙡ' => 'Ꙡ', + 'ꙣ' => 'Ꙣ', + 'ꙥ' => 'Ꙥ', + 'ꙧ' => 'Ꙧ', + 'ꙩ' => 'Ꙩ', + 'ꙫ' => 'Ꙫ', + 'ꙭ' => 'Ꙭ', + 'ꚁ' => 'Ꚁ', + 'ꚃ' => 'Ꚃ', + 'ꚅ' => 'Ꚅ', + 'ꚇ' => 'Ꚇ', + 'ꚉ' => 'Ꚉ', + 'ꚋ' => 'Ꚋ', + 'ꚍ' => 'Ꚍ', + 'ꚏ' => 'Ꚏ', + 'ꚑ' => 'Ꚑ', + 'ꚓ' => 'Ꚓ', + 'ꚕ' => 'Ꚕ', + 'ꚗ' => 'Ꚗ', + 'ꚙ' => 'Ꚙ', + 'ꚛ' => 'Ꚛ', + 'ꜣ' => 'Ꜣ', + 'ꜥ' => 'Ꜥ', + 'ꜧ' => 'Ꜧ', + 'ꜩ' => 'Ꜩ', + 'ꜫ' => 'Ꜫ', + 'ꜭ' => 'Ꜭ', + 'ꜯ' => 'Ꜯ', + 'ꜳ' => 'Ꜳ', + 'ꜵ' => 'Ꜵ', + 'ꜷ' => 'Ꜷ', + 'ꜹ' => 'Ꜹ', + 'ꜻ' => 'Ꜻ', + 'ꜽ' => 'Ꜽ', + 'ꜿ' => 'Ꜿ', + 'ꝁ' => 'Ꝁ', + 'ꝃ' => 'Ꝃ', + 'ꝅ' => 'Ꝅ', + 'ꝇ' => 'Ꝇ', + 'ꝉ' => 'Ꝉ', + 'ꝋ' => 'Ꝋ', + 'ꝍ' => 'Ꝍ', + 'ꝏ' => 'Ꝏ', + 'ꝑ' => 'Ꝑ', + 'ꝓ' => 'Ꝓ', + 'ꝕ' => 'Ꝕ', + 'ꝗ' => 'Ꝗ', + 'ꝙ' => 'Ꝙ', + 'ꝛ' => 'Ꝛ', + 'ꝝ' => 'Ꝝ', + 'ꝟ' => 'Ꝟ', + 'ꝡ' => 'Ꝡ', + 'ꝣ' => 'Ꝣ', + 'ꝥ' => 'Ꝥ', + 'ꝧ' => 'Ꝧ', + 'ꝩ' => 'Ꝩ', + 'ꝫ' => 'Ꝫ', + 'ꝭ' => 'Ꝭ', + 'ꝯ' => 'Ꝯ', + 'ꝺ' => 'Ꝺ', + 'ꝼ' => 'Ꝼ', + 'ꝿ' => 'Ꝿ', + 'ꞁ' => 'Ꞁ', + 'ꞃ' => 'Ꞃ', + 'ꞅ' => 'Ꞅ', + 'ꞇ' => 'Ꞇ', + 'ꞌ' => 'Ꞌ', + 'ꞑ' => 'Ꞑ', + 'ꞓ' => 'Ꞓ', + 'ꞔ' => 'Ꞔ', + 'ꞗ' => 'Ꞗ', + 'ꞙ' => 'Ꞙ', + 'ꞛ' => 'Ꞛ', + 'ꞝ' => 'Ꞝ', + 'ꞟ' => 'Ꞟ', + 'ꞡ' => 'Ꞡ', + 'ꞣ' => 'Ꞣ', + 'ꞥ' => 'Ꞥ', + 'ꞧ' => 'Ꞧ', + 'ꞩ' => 'Ꞩ', + 'ꞵ' => 'Ꞵ', + 'ꞷ' => 'Ꞷ', + 'ꞹ' => 'Ꞹ', + 'ꞻ' => 'Ꞻ', + 'ꞽ' => 'Ꞽ', + 'ꞿ' => 'Ꞿ', + 'ꟃ' => 'Ꟃ', + 'ꟈ' => 'Ꟈ', + 'ꟊ' => 'Ꟊ', + 'ꟶ' => 'Ꟶ', + 'ꭓ' => 'Ꭓ', + 'ꭰ' => 'Ꭰ', + 'ꭱ' => 'Ꭱ', + 'ꭲ' => 'Ꭲ', + 'ꭳ' => 'Ꭳ', + 'ꭴ' => 'Ꭴ', + 'ꭵ' => 'Ꭵ', + 'ꭶ' => 'Ꭶ', + 'ꭷ' => 'Ꭷ', + 'ꭸ' => 'Ꭸ', + 'ꭹ' => 'Ꭹ', + 'ꭺ' => 'Ꭺ', + 'ꭻ' => 'Ꭻ', + 'ꭼ' => 'Ꭼ', + 'ꭽ' => 'Ꭽ', + 'ꭾ' => 'Ꭾ', + 'ꭿ' => 'Ꭿ', + 'ꮀ' => 'Ꮀ', + 'ꮁ' => 'Ꮁ', + 'ꮂ' => 'Ꮂ', + 'ꮃ' => 'Ꮃ', + 'ꮄ' => 'Ꮄ', + 'ꮅ' => 'Ꮅ', + 'ꮆ' => 'Ꮆ', + 'ꮇ' => 'Ꮇ', + 'ꮈ' => 'Ꮈ', + 'ꮉ' => 'Ꮉ', + 'ꮊ' => 'Ꮊ', + 'ꮋ' => 'Ꮋ', + 'ꮌ' => 'Ꮌ', + 'ꮍ' => 'Ꮍ', + 'ꮎ' => 'Ꮎ', + 'ꮏ' => 'Ꮏ', + 'ꮐ' => 'Ꮐ', + 'ꮑ' => 'Ꮑ', + 'ꮒ' => 'Ꮒ', + 'ꮓ' => 'Ꮓ', + 'ꮔ' => 'Ꮔ', + 'ꮕ' => 'Ꮕ', + 'ꮖ' => 'Ꮖ', + 'ꮗ' => 'Ꮗ', + 'ꮘ' => 'Ꮘ', + 'ꮙ' => 'Ꮙ', + 'ꮚ' => 'Ꮚ', + 'ꮛ' => 'Ꮛ', + 'ꮜ' => 'Ꮜ', + 'ꮝ' => 'Ꮝ', + 'ꮞ' => 'Ꮞ', + 'ꮟ' => 'Ꮟ', + 'ꮠ' => 'Ꮠ', + 'ꮡ' => 'Ꮡ', + 'ꮢ' => 'Ꮢ', + 'ꮣ' => 'Ꮣ', + 'ꮤ' => 'Ꮤ', + 'ꮥ' => 'Ꮥ', + 'ꮦ' => 'Ꮦ', + 'ꮧ' => 'Ꮧ', + 'ꮨ' => 'Ꮨ', + 'ꮩ' => 'Ꮩ', + 'ꮪ' => 'Ꮪ', + 'ꮫ' => 'Ꮫ', + 'ꮬ' => 'Ꮬ', + 'ꮭ' => 'Ꮭ', + 'ꮮ' => 'Ꮮ', + 'ꮯ' => 'Ꮯ', + 'ꮰ' => 'Ꮰ', + 'ꮱ' => 'Ꮱ', + 'ꮲ' => 'Ꮲ', + 'ꮳ' => 'Ꮳ', + 'ꮴ' => 'Ꮴ', + 'ꮵ' => 'Ꮵ', + 'ꮶ' => 'Ꮶ', + 'ꮷ' => 'Ꮷ', + 'ꮸ' => 'Ꮸ', + 'ꮹ' => 'Ꮹ', + 'ꮺ' => 'Ꮺ', + 'ꮻ' => 'Ꮻ', + 'ꮼ' => 'Ꮼ', + 'ꮽ' => 'Ꮽ', + 'ꮾ' => 'Ꮾ', + 'ꮿ' => 'Ꮿ', + 'a' => 'A', + 'b' => 'B', + 'c' => 'C', + 'd' => 'D', + 'e' => 'E', + 'f' => 'F', + 'g' => 'G', + 'h' => 'H', + 'i' => 'I', + 'j' => 'J', + 'k' => 'K', + 'l' => 'L', + 'm' => 'M', + 'n' => 'N', + 'o' => 'O', + 'p' => 'P', + 'q' => 'Q', + 'r' => 'R', + 's' => 'S', + 't' => 'T', + 'u' => 'U', + 'v' => 'V', + 'w' => 'W', + 'x' => 'X', + 'y' => 'Y', + 'z' => 'Z', + '𐐨' => '𐐀', + '𐐩' => '𐐁', + '𐐪' => '𐐂', + '𐐫' => '𐐃', + '𐐬' => '𐐄', + '𐐭' => '𐐅', + '𐐮' => '𐐆', + '𐐯' => '𐐇', + '𐐰' => '𐐈', + '𐐱' => '𐐉', + '𐐲' => '𐐊', + '𐐳' => '𐐋', + '𐐴' => '𐐌', + '𐐵' => '𐐍', + '𐐶' => '𐐎', + '𐐷' => '𐐏', + '𐐸' => '𐐐', + '𐐹' => '𐐑', + '𐐺' => '𐐒', + '𐐻' => '𐐓', + '𐐼' => '𐐔', + '𐐽' => '𐐕', + '𐐾' => '𐐖', + '𐐿' => '𐐗', + '𐑀' => '𐐘', + '𐑁' => '𐐙', + '𐑂' => '𐐚', + '𐑃' => '𐐛', + '𐑄' => '𐐜', + '𐑅' => '𐐝', + '𐑆' => '𐐞', + '𐑇' => '𐐟', + '𐑈' => '𐐠', + '𐑉' => '𐐡', + '𐑊' => '𐐢', + '𐑋' => '𐐣', + '𐑌' => '𐐤', + '𐑍' => '𐐥', + '𐑎' => '𐐦', + '𐑏' => '𐐧', + '𐓘' => '𐒰', + '𐓙' => '𐒱', + '𐓚' => '𐒲', + '𐓛' => '𐒳', + '𐓜' => '𐒴', + '𐓝' => '𐒵', + '𐓞' => '𐒶', + '𐓟' => '𐒷', + '𐓠' => '𐒸', + '𐓡' => '𐒹', + '𐓢' => '𐒺', + '𐓣' => '𐒻', + '𐓤' => '𐒼', + '𐓥' => '𐒽', + '𐓦' => '𐒾', + '𐓧' => '𐒿', + '𐓨' => '𐓀', + '𐓩' => '𐓁', + '𐓪' => '𐓂', + '𐓫' => '𐓃', + '𐓬' => '𐓄', + '𐓭' => '𐓅', + '𐓮' => '𐓆', + '𐓯' => '𐓇', + '𐓰' => '𐓈', + '𐓱' => '𐓉', + '𐓲' => '𐓊', + '𐓳' => '𐓋', + '𐓴' => '𐓌', + '𐓵' => '𐓍', + '𐓶' => '𐓎', + '𐓷' => '𐓏', + '𐓸' => '𐓐', + '𐓹' => '𐓑', + '𐓺' => '𐓒', + '𐓻' => '𐓓', + '𐳀' => '𐲀', + '𐳁' => '𐲁', + '𐳂' => '𐲂', + '𐳃' => '𐲃', + '𐳄' => '𐲄', + '𐳅' => '𐲅', + '𐳆' => '𐲆', + '𐳇' => '𐲇', + '𐳈' => '𐲈', + '𐳉' => '𐲉', + '𐳊' => '𐲊', + '𐳋' => '𐲋', + '𐳌' => '𐲌', + '𐳍' => '𐲍', + '𐳎' => '𐲎', + '𐳏' => '𐲏', + '𐳐' => '𐲐', + '𐳑' => '𐲑', + '𐳒' => '𐲒', + '𐳓' => '𐲓', + '𐳔' => '𐲔', + '𐳕' => '𐲕', + '𐳖' => '𐲖', + '𐳗' => '𐲗', + '𐳘' => '𐲘', + '𐳙' => '𐲙', + '𐳚' => '𐲚', + '𐳛' => '𐲛', + '𐳜' => '𐲜', + '𐳝' => '𐲝', + '𐳞' => '𐲞', + '𐳟' => '𐲟', + '𐳠' => '𐲠', + '𐳡' => '𐲡', + '𐳢' => '𐲢', + '𐳣' => '𐲣', + '𐳤' => '𐲤', + '𐳥' => '𐲥', + '𐳦' => '𐲦', + '𐳧' => '𐲧', + '𐳨' => '𐲨', + '𐳩' => '𐲩', + '𐳪' => '𐲪', + '𐳫' => '𐲫', + '𐳬' => '𐲬', + '𐳭' => '𐲭', + '𐳮' => '𐲮', + '𐳯' => '𐲯', + '𐳰' => '𐲰', + '𐳱' => '𐲱', + '𐳲' => '𐲲', + '𑣀' => '𑢠', + '𑣁' => '𑢡', + '𑣂' => '𑢢', + '𑣃' => '𑢣', + '𑣄' => '𑢤', + '𑣅' => '𑢥', + '𑣆' => '𑢦', + '𑣇' => '𑢧', + '𑣈' => '𑢨', + '𑣉' => '𑢩', + '𑣊' => '𑢪', + '𑣋' => '𑢫', + '𑣌' => '𑢬', + '𑣍' => '𑢭', + '𑣎' => '𑢮', + '𑣏' => '𑢯', + '𑣐' => '𑢰', + '𑣑' => '𑢱', + '𑣒' => '𑢲', + '𑣓' => '𑢳', + '𑣔' => '𑢴', + '𑣕' => '𑢵', + '𑣖' => '𑢶', + '𑣗' => '𑢷', + '𑣘' => '𑢸', + '𑣙' => '𑢹', + '𑣚' => '𑢺', + '𑣛' => '𑢻', + '𑣜' => '𑢼', + '𑣝' => '𑢽', + '𑣞' => '𑢾', + '𑣟' => '𑢿', + '𖹠' => '𖹀', + '𖹡' => '𖹁', + '𖹢' => '𖹂', + '𖹣' => '𖹃', + '𖹤' => '𖹄', + '𖹥' => '𖹅', + '𖹦' => '𖹆', + '𖹧' => '𖹇', + '𖹨' => '𖹈', + '𖹩' => '𖹉', + '𖹪' => '𖹊', + '𖹫' => '𖹋', + '𖹬' => '𖹌', + '𖹭' => '𖹍', + '𖹮' => '𖹎', + '𖹯' => '𖹏', + '𖹰' => '𖹐', + '𖹱' => '𖹑', + '𖹲' => '𖹒', + '𖹳' => '𖹓', + '𖹴' => '𖹔', + '𖹵' => '𖹕', + '𖹶' => '𖹖', + '𖹷' => '𖹗', + '𖹸' => '𖹘', + '𖹹' => '𖹙', + '𖹺' => '𖹚', + '𖹻' => '𖹛', + '𖹼' => '𖹜', + '𖹽' => '𖹝', + '𖹾' => '𖹞', + '𖹿' => '𖹟', + '𞤢' => '𞤀', + '𞤣' => '𞤁', + '𞤤' => '𞤂', + '𞤥' => '𞤃', + '𞤦' => '𞤄', + '𞤧' => '𞤅', + '𞤨' => '𞤆', + '𞤩' => '𞤇', + '𞤪' => '𞤈', + '𞤫' => '𞤉', + '𞤬' => '𞤊', + '𞤭' => '𞤋', + '𞤮' => '𞤌', + '𞤯' => '𞤍', + '𞤰' => '𞤎', + '𞤱' => '𞤏', + '𞤲' => '𞤐', + '𞤳' => '𞤑', + '𞤴' => '𞤒', + '𞤵' => '𞤓', + '𞤶' => '𞤔', + '𞤷' => '𞤕', + '𞤸' => '𞤖', + '𞤹' => '𞤗', + '𞤺' => '𞤘', + '𞤻' => '𞤙', + '𞤼' => '𞤚', + '𞤽' => '𞤛', + '𞤾' => '𞤜', + '𞤿' => '𞤝', + '𞥀' => '𞤞', + '𞥁' => '𞤟', + '𞥂' => '𞤠', + '𞥃' => '𞤡', + 'ß' => 'SS', + 'ff' => 'FF', + 'fi' => 'FI', + 'fl' => 'FL', + 'ffi' => 'FFI', + 'ffl' => 'FFL', + 'ſt' => 'ST', + 'st' => 'ST', + 'և' => 'ԵՒ', + 'ﬓ' => 'ՄՆ', + 'ﬔ' => 'ՄԵ', + 'ﬕ' => 'ՄԻ', + 'ﬖ' => 'ՎՆ', + 'ﬗ' => 'ՄԽ', + 'ʼn' => 'ʼN', + 'ΐ' => 'Ϊ́', + 'ΰ' => 'Ϋ́', + 'ǰ' => 'J̌', + 'ẖ' => 'H̱', + 'ẗ' => 'T̈', + 'ẘ' => 'W̊', + 'ẙ' => 'Y̊', + 'ẚ' => 'Aʾ', + 'ὐ' => 'Υ̓', + 'ὒ' => 'Υ̓̀', + 'ὔ' => 'Υ̓́', + 'ὖ' => 'Υ̓͂', + 'ᾶ' => 'Α͂', + 'ῆ' => 'Η͂', + 'ῒ' => 'Ϊ̀', + 'ΐ' => 'Ϊ́', + 'ῖ' => 'Ι͂', + 'ῗ' => 'Ϊ͂', + 'ῢ' => 'Ϋ̀', + 'ΰ' => 'Ϋ́', + 'ῤ' => 'Ρ̓', + 'ῦ' => 'Υ͂', + 'ῧ' => 'Ϋ͂', + 'ῶ' => 'Ω͂', + 'ᾈ' => 'ἈΙ', + 'ᾉ' => 'ἉΙ', + 'ᾊ' => 'ἊΙ', + 'ᾋ' => 'ἋΙ', + 'ᾌ' => 'ἌΙ', + 'ᾍ' => 'ἍΙ', + 'ᾎ' => 'ἎΙ', + 'ᾏ' => 'ἏΙ', + 'ᾘ' => 'ἨΙ', + 'ᾙ' => 'ἩΙ', + 'ᾚ' => 'ἪΙ', + 'ᾛ' => 'ἫΙ', + 'ᾜ' => 'ἬΙ', + 'ᾝ' => 'ἭΙ', + 'ᾞ' => 'ἮΙ', + 'ᾟ' => 'ἯΙ', + 'ᾨ' => 'ὨΙ', + 'ᾩ' => 'ὩΙ', + 'ᾪ' => 'ὪΙ', + 'ᾫ' => 'ὫΙ', + 'ᾬ' => 'ὬΙ', + 'ᾭ' => 'ὭΙ', + 'ᾮ' => 'ὮΙ', + 'ᾯ' => 'ὯΙ', + 'ᾼ' => 'ΑΙ', + 'ῌ' => 'ΗΙ', + 'ῼ' => 'ΩΙ', + 'ᾲ' => 'ᾺΙ', + 'ᾴ' => 'ΆΙ', + 'ῂ' => 'ῊΙ', + 'ῄ' => 'ΉΙ', + 'ῲ' => 'ῺΙ', + 'ῴ' => 'ΏΙ', + 'ᾷ' => 'Α͂Ι', + 'ῇ' => 'Η͂Ι', + 'ῷ' => 'Ω͂Ι', +); diff --git a/vendor/symfony/polyfill-mbstring/bootstrap.php b/vendor/symfony/polyfill-mbstring/bootstrap.php index ff51ae0..75bea04 100644 --- a/vendor/symfony/polyfill-mbstring/bootstrap.php +++ b/vendor/symfony/polyfill-mbstring/bootstrap.php @@ -1,172 +1,172 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Mbstring as p; - -if (\PHP_VERSION_ID >= 80000) { - return require __DIR__.'/bootstrap80.php'; -} - -if (!function_exists('mb_convert_encoding')) { - function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); } -} -if (!function_exists('mb_decode_mimeheader')) { - function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); } -} -if (!function_exists('mb_encode_mimeheader')) { - function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); } -} -if (!function_exists('mb_decode_numericentity')) { - function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); } -} -if (!function_exists('mb_encode_numericentity')) { - function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); } -} -if (!function_exists('mb_convert_case')) { - function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); } -} -if (!function_exists('mb_internal_encoding')) { - function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); } -} -if (!function_exists('mb_language')) { - function mb_language($language = null) { return p\Mbstring::mb_language($language); } -} -if (!function_exists('mb_list_encodings')) { - function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } -} -if (!function_exists('mb_encoding_aliases')) { - function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } -} -if (!function_exists('mb_check_encoding')) { - function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); } -} -if (!function_exists('mb_detect_encoding')) { - function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); } -} -if (!function_exists('mb_detect_order')) { - function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); } -} -if (!function_exists('mb_parse_str')) { - function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; } -} -if (!function_exists('mb_strlen')) { - function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); } -} -if (!function_exists('mb_strpos')) { - function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); } -} -if (!function_exists('mb_strtolower')) { - function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); } -} -if (!function_exists('mb_strtoupper')) { - function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); } -} -if (!function_exists('mb_substitute_character')) { - function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); } -} -if (!function_exists('mb_substr')) { - function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); } -} -if (!function_exists('mb_stripos')) { - function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); } -} -if (!function_exists('mb_stristr')) { - function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); } -} -if (!function_exists('mb_strrchr')) { - function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); } -} -if (!function_exists('mb_strrichr')) { - function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); } -} -if (!function_exists('mb_strripos')) { - function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); } -} -if (!function_exists('mb_strrpos')) { - function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); } -} -if (!function_exists('mb_strstr')) { - function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); } -} -if (!function_exists('mb_get_info')) { - function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } -} -if (!function_exists('mb_http_output')) { - function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); } -} -if (!function_exists('mb_strwidth')) { - function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); } -} -if (!function_exists('mb_substr_count')) { - function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); } -} -if (!function_exists('mb_output_handler')) { - function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); } -} -if (!function_exists('mb_http_input')) { - function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); } -} - -if (!function_exists('mb_convert_variables')) { - function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); } -} - -if (!function_exists('mb_ord')) { - function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); } -} -if (!function_exists('mb_chr')) { - function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); } -} -if (!function_exists('mb_scrub')) { - function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); } -} -if (!function_exists('mb_str_split')) { - function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); } -} - -if (!function_exists('mb_str_pad')) { - function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } -} - -if (!function_exists('mb_ucfirst')) { - function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); } -} - -if (!function_exists('mb_lcfirst')) { - function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); } -} - -if (!function_exists('mb_trim')) { - function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); } -} - -if (!function_exists('mb_ltrim')) { - function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); } -} - -if (!function_exists('mb_rtrim')) { - function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); } -} - - -if (extension_loaded('mbstring')) { - return; -} - -if (!defined('MB_CASE_UPPER')) { - define('MB_CASE_UPPER', 0); -} -if (!defined('MB_CASE_LOWER')) { - define('MB_CASE_LOWER', 1); -} -if (!defined('MB_CASE_TITLE')) { - define('MB_CASE_TITLE', 2); -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Mbstring as p; + +if (\PHP_VERSION_ID >= 80000) { + return require __DIR__.'/bootstrap80.php'; +} + +if (!function_exists('mb_convert_encoding')) { + function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); } +} +if (!function_exists('mb_decode_mimeheader')) { + function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); } +} +if (!function_exists('mb_encode_mimeheader')) { + function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); } +} +if (!function_exists('mb_decode_numericentity')) { + function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); } +} +if (!function_exists('mb_encode_numericentity')) { + function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); } +} +if (!function_exists('mb_convert_case')) { + function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); } +} +if (!function_exists('mb_internal_encoding')) { + function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); } +} +if (!function_exists('mb_language')) { + function mb_language($language = null) { return p\Mbstring::mb_language($language); } +} +if (!function_exists('mb_list_encodings')) { + function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } +} +if (!function_exists('mb_encoding_aliases')) { + function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } +} +if (!function_exists('mb_check_encoding')) { + function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); } +} +if (!function_exists('mb_detect_encoding')) { + function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); } +} +if (!function_exists('mb_detect_order')) { + function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); } +} +if (!function_exists('mb_parse_str')) { + function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; } +} +if (!function_exists('mb_strlen')) { + function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); } +} +if (!function_exists('mb_strpos')) { + function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); } +} +if (!function_exists('mb_strtolower')) { + function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); } +} +if (!function_exists('mb_strtoupper')) { + function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); } +} +if (!function_exists('mb_substitute_character')) { + function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); } +} +if (!function_exists('mb_substr')) { + function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); } +} +if (!function_exists('mb_stripos')) { + function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); } +} +if (!function_exists('mb_stristr')) { + function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); } +} +if (!function_exists('mb_strrchr')) { + function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); } +} +if (!function_exists('mb_strrichr')) { + function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); } +} +if (!function_exists('mb_strripos')) { + function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); } +} +if (!function_exists('mb_strrpos')) { + function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); } +} +if (!function_exists('mb_strstr')) { + function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); } +} +if (!function_exists('mb_get_info')) { + function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } +} +if (!function_exists('mb_http_output')) { + function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); } +} +if (!function_exists('mb_strwidth')) { + function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); } +} +if (!function_exists('mb_substr_count')) { + function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); } +} +if (!function_exists('mb_output_handler')) { + function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); } +} +if (!function_exists('mb_http_input')) { + function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); } +} + +if (!function_exists('mb_convert_variables')) { + function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); } +} + +if (!function_exists('mb_ord')) { + function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); } +} +if (!function_exists('mb_chr')) { + function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); } +} +if (!function_exists('mb_scrub')) { + function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); } +} +if (!function_exists('mb_str_split')) { + function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); } +} + +if (!function_exists('mb_str_pad')) { + function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } +} + +if (!function_exists('mb_ucfirst')) { + function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); } +} + +if (!function_exists('mb_lcfirst')) { + function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); } +} + +if (!function_exists('mb_trim')) { + function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); } +} + +if (!function_exists('mb_ltrim')) { + function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); } +} + +if (!function_exists('mb_rtrim')) { + function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); } +} + + +if (extension_loaded('mbstring')) { + return; +} + +if (!defined('MB_CASE_UPPER')) { + define('MB_CASE_UPPER', 0); +} +if (!defined('MB_CASE_LOWER')) { + define('MB_CASE_LOWER', 1); +} +if (!defined('MB_CASE_TITLE')) { + define('MB_CASE_TITLE', 2); +} diff --git a/vendor/symfony/polyfill-mbstring/bootstrap80.php b/vendor/symfony/polyfill-mbstring/bootstrap80.php index 5be7d20..7817d21 100644 --- a/vendor/symfony/polyfill-mbstring/bootstrap80.php +++ b/vendor/symfony/polyfill-mbstring/bootstrap80.php @@ -1,167 +1,167 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Mbstring as p; - -if (!function_exists('mb_convert_encoding')) { - function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); } -} -if (!function_exists('mb_decode_mimeheader')) { - function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); } -} -if (!function_exists('mb_encode_mimeheader')) { - function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); } -} -if (!function_exists('mb_decode_numericentity')) { - function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); } -} -if (!function_exists('mb_encode_numericentity')) { - function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); } -} -if (!function_exists('mb_convert_case')) { - function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); } -} -if (!function_exists('mb_internal_encoding')) { - function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); } -} -if (!function_exists('mb_language')) { - function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); } -} -if (!function_exists('mb_list_encodings')) { - function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); } -} -if (!function_exists('mb_encoding_aliases')) { - function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); } -} -if (!function_exists('mb_check_encoding')) { - function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); } -} -if (!function_exists('mb_detect_encoding')) { - function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); } -} -if (!function_exists('mb_detect_order')) { - function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); } -} -if (!function_exists('mb_parse_str')) { - function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; } -} -if (!function_exists('mb_strlen')) { - function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); } -} -if (!function_exists('mb_strpos')) { - function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } -} -if (!function_exists('mb_strtolower')) { - function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); } -} -if (!function_exists('mb_strtoupper')) { - function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); } -} -if (!function_exists('mb_substitute_character')) { - function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); } -} -if (!function_exists('mb_substr')) { - function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); } -} -if (!function_exists('mb_stripos')) { - function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } -} -if (!function_exists('mb_stristr')) { - function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } -} -if (!function_exists('mb_strrchr')) { - function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } -} -if (!function_exists('mb_strrichr')) { - function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } -} -if (!function_exists('mb_strripos')) { - function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } -} -if (!function_exists('mb_strrpos')) { - function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } -} -if (!function_exists('mb_strstr')) { - function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } -} -if (!function_exists('mb_get_info')) { - function mb_get_info(?string $type = 'all'): array|string|int|false|null { return p\Mbstring::mb_get_info((string) $type); } -} -if (!function_exists('mb_http_output')) { - function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); } -} -if (!function_exists('mb_strwidth')) { - function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); } -} -if (!function_exists('mb_substr_count')) { - function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); } -} -if (!function_exists('mb_output_handler')) { - function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); } -} -if (!function_exists('mb_http_input')) { - function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); } -} - -if (!function_exists('mb_convert_variables')) { - function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); } -} - -if (!function_exists('mb_ord')) { - function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); } -} -if (!function_exists('mb_chr')) { - function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } -} -if (!function_exists('mb_scrub')) { - function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); } -} -if (!function_exists('mb_str_split')) { - function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); } -} - -if (!function_exists('mb_str_pad')) { - function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } -} - -if (!function_exists('mb_ucfirst')) { - function mb_ucfirst($string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); } -} - -if (!function_exists('mb_lcfirst')) { - function mb_lcfirst($string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); } -} - -if (!function_exists('mb_trim')) { - function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); } -} - -if (!function_exists('mb_ltrim')) { - function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); } -} - -if (!function_exists('mb_rtrim')) { - function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); } -} - -if (extension_loaded('mbstring')) { - return; -} - -if (!defined('MB_CASE_UPPER')) { - define('MB_CASE_UPPER', 0); -} -if (!defined('MB_CASE_LOWER')) { - define('MB_CASE_LOWER', 1); -} -if (!defined('MB_CASE_TITLE')) { - define('MB_CASE_TITLE', 2); -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Mbstring as p; + +if (!function_exists('mb_convert_encoding')) { + function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); } +} +if (!function_exists('mb_decode_mimeheader')) { + function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); } +} +if (!function_exists('mb_encode_mimeheader')) { + function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); } +} +if (!function_exists('mb_decode_numericentity')) { + function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); } +} +if (!function_exists('mb_encode_numericentity')) { + function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); } +} +if (!function_exists('mb_convert_case')) { + function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); } +} +if (!function_exists('mb_internal_encoding')) { + function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); } +} +if (!function_exists('mb_language')) { + function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); } +} +if (!function_exists('mb_list_encodings')) { + function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); } +} +if (!function_exists('mb_encoding_aliases')) { + function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); } +} +if (!function_exists('mb_check_encoding')) { + function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); } +} +if (!function_exists('mb_detect_encoding')) { + function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); } +} +if (!function_exists('mb_detect_order')) { + function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); } +} +if (!function_exists('mb_parse_str')) { + function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; } +} +if (!function_exists('mb_strlen')) { + function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); } +} +if (!function_exists('mb_strpos')) { + function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } +} +if (!function_exists('mb_strtolower')) { + function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); } +} +if (!function_exists('mb_strtoupper')) { + function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); } +} +if (!function_exists('mb_substitute_character')) { + function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); } +} +if (!function_exists('mb_substr')) { + function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); } +} +if (!function_exists('mb_stripos')) { + function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } +} +if (!function_exists('mb_stristr')) { + function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } +} +if (!function_exists('mb_strrchr')) { + function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } +} +if (!function_exists('mb_strrichr')) { + function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } +} +if (!function_exists('mb_strripos')) { + function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } +} +if (!function_exists('mb_strrpos')) { + function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } +} +if (!function_exists('mb_strstr')) { + function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } +} +if (!function_exists('mb_get_info')) { + function mb_get_info(?string $type = 'all'): array|string|int|false|null { return p\Mbstring::mb_get_info((string) $type); } +} +if (!function_exists('mb_http_output')) { + function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); } +} +if (!function_exists('mb_strwidth')) { + function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); } +} +if (!function_exists('mb_substr_count')) { + function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); } +} +if (!function_exists('mb_output_handler')) { + function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); } +} +if (!function_exists('mb_http_input')) { + function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); } +} + +if (!function_exists('mb_convert_variables')) { + function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); } +} + +if (!function_exists('mb_ord')) { + function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); } +} +if (!function_exists('mb_chr')) { + function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } +} +if (!function_exists('mb_scrub')) { + function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); } +} +if (!function_exists('mb_str_split')) { + function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); } +} + +if (!function_exists('mb_str_pad')) { + function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } +} + +if (!function_exists('mb_ucfirst')) { + function mb_ucfirst($string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); } +} + +if (!function_exists('mb_lcfirst')) { + function mb_lcfirst($string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); } +} + +if (!function_exists('mb_trim')) { + function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); } +} + +if (!function_exists('mb_ltrim')) { + function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); } +} + +if (!function_exists('mb_rtrim')) { + function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); } +} + +if (extension_loaded('mbstring')) { + return; +} + +if (!defined('MB_CASE_UPPER')) { + define('MB_CASE_UPPER', 0); +} +if (!defined('MB_CASE_LOWER')) { + define('MB_CASE_LOWER', 1); +} +if (!defined('MB_CASE_TITLE')) { + define('MB_CASE_TITLE', 2); +} diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index 4ed241a..4dbb5ee 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -1,38 +1,38 @@ -{ - "name": "symfony/polyfill-mbstring", - "type": "library", - "description": "Symfony polyfill for the Mbstring extension", - "keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"], - "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" - }, - "provide": { - "ext-mbstring": "*" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} +{ + "name": "symfony/polyfill-mbstring", + "type": "library", + "description": "Symfony polyfill for the Mbstring extension", + "keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"], + "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" + }, + "provide": { + "ext-mbstring": "*" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" }, + "files": [ "bootstrap.php" ] + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "minimum-stability": "dev", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + } +} diff --git a/vendor/symfony/polyfill-php81/LICENSE b/vendor/symfony/polyfill-php81/LICENSE index 99c6bdf..84dadef 100644 --- a/vendor/symfony/polyfill-php81/LICENSE +++ b/vendor/symfony/polyfill-php81/LICENSE @@ -1,19 +1,19 @@ -Copyright (c) 2021-present 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. +Copyright (c) 2021-present 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-php81/Php81.php b/vendor/symfony/polyfill-php81/Php81.php index f0507b7..96c2491 100644 --- a/vendor/symfony/polyfill-php81/Php81.php +++ b/vendor/symfony/polyfill-php81/Php81.php @@ -1,37 +1,37 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Php81; - -/** - * @author Nicolas Grekas - * - * @internal - */ -final class Php81 -{ - public static function array_is_list(array $array): bool - { - if ([] === $array || $array === array_values($array)) { - return true; - } - - $nextKey = -1; - - foreach ($array as $k => $v) { - if ($k !== ++$nextKey) { - return false; - } - } - - return true; - } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Php81; + +/** + * @author Nicolas Grekas + * + * @internal + */ +final class Php81 +{ + public static function array_is_list(array $array): bool + { + if ([] === $array || $array === array_values($array)) { + return true; + } + + $nextKey = -1; + + foreach ($array as $k => $v) { + if ($k !== ++$nextKey) { + return false; + } + } + + return true; + } +} diff --git a/vendor/symfony/polyfill-php81/README.md b/vendor/symfony/polyfill-php81/README.md index c07ef78..5a7d21e 100644 --- a/vendor/symfony/polyfill-php81/README.md +++ b/vendor/symfony/polyfill-php81/README.md @@ -1,18 +1,18 @@ -Symfony Polyfill / Php81 -======================== - -This component provides features added to PHP 8.1 core: - -- [`array_is_list`](https://php.net/array_is_list) -- [`enum_exists`](https://php.net/enum-exists) -- [`MYSQLI_REFRESH_REPLICA`](https://php.net/mysqli.constants#constantmysqli-refresh-replica) constant -- [`ReturnTypeWillChange`](https://wiki.php.net/rfc/internal_method_return_types) -- [`CURLStringFile`](https://php.net/CURLStringFile) (but only if PHP >= 7.4 is used) - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). +Symfony Polyfill / Php81 +======================== + +This component provides features added to PHP 8.1 core: + +- [`array_is_list`](https://php.net/array_is_list) +- [`enum_exists`](https://php.net/enum-exists) +- [`MYSQLI_REFRESH_REPLICA`](https://php.net/mysqli.constants#constantmysqli-refresh-replica) constant +- [`ReturnTypeWillChange`](https://wiki.php.net/rfc/internal_method_return_types) +- [`CURLStringFile`](https://php.net/CURLStringFile) (but only if PHP >= 7.4 is used) + +More information can be found in the +[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). + +License +======= + +This library is released under the [MIT license](LICENSE). diff --git a/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php b/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php index 5ff93fc..e35db46 100644 --- a/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php +++ b/vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php @@ -1,51 +1,51 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (\PHP_VERSION_ID >= 70400 && extension_loaded('curl')) { - /** - * @property string $data - */ - class CURLStringFile extends CURLFile - { - private $data; - - public function __construct(string $data, string $postname, string $mime = 'application/octet-stream') - { - $this->data = $data; - parent::__construct('data://application/octet-stream;base64,'.base64_encode($data), $mime, $postname); - } - - public function __set(string $name, $value): void - { - if ('data' !== $name) { - $this->$name = $value; - - return; - } - - if (is_object($value) ? !method_exists($value, '__toString') : !is_scalar($value)) { - throw new TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string'); - } - - $this->name = 'data://application/octet-stream;base64,'.base64_encode($value); - } - - public function __isset(string $name): bool - { - return isset($this->$name); - } - - public function &__get(string $name) - { - return $this->$name; - } - } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID >= 70400 && extension_loaded('curl')) { + /** + * @property string $data + */ + class CURLStringFile extends CURLFile + { + private $data; + + public function __construct(string $data, string $postname, string $mime = 'application/octet-stream') + { + $this->data = $data; + parent::__construct('data://application/octet-stream;base64,'.base64_encode($data), $mime, $postname); + } + + public function __set(string $name, $value): void + { + if ('data' !== $name) { + $this->$name = $value; + + return; + } + + if (is_object($value) ? !method_exists($value, '__toString') : !is_scalar($value)) { + throw new TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string'); + } + + $this->name = 'data://application/octet-stream;base64,'.base64_encode($value); + } + + public function __isset(string $name): bool + { + return isset($this->$name); + } + + public function &__get(string $name) + { + return $this->$name; + } + } +} diff --git a/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php b/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php index cb7720a..52918b3 100644 --- a/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php +++ b/vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php @@ -1,20 +1,20 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (\PHP_VERSION_ID < 80100) { - #[Attribute(Attribute::TARGET_METHOD)] - final class ReturnTypeWillChange - { - public function __construct() - { - } - } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID < 80100) { + #[Attribute(Attribute::TARGET_METHOD)] + final class ReturnTypeWillChange + { + public function __construct() + { + } + } +} diff --git a/vendor/symfony/polyfill-php81/bootstrap.php b/vendor/symfony/polyfill-php81/bootstrap.php index 9f872e0..32229a9 100644 --- a/vendor/symfony/polyfill-php81/bootstrap.php +++ b/vendor/symfony/polyfill-php81/bootstrap.php @@ -1,28 +1,28 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Php81 as p; - -if (\PHP_VERSION_ID >= 80100) { - return; -} - -if (defined('MYSQLI_REFRESH_SLAVE') && !defined('MYSQLI_REFRESH_REPLICA')) { - define('MYSQLI_REFRESH_REPLICA', 64); -} - -if (!function_exists('array_is_list')) { - function array_is_list(array $array): bool { return p\Php81::array_is_list($array); } -} - -if (!function_exists('enum_exists')) { - function enum_exists(string $enum, bool $autoload = true): bool { return $autoload && class_exists($enum) && false; } -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Php81 as p; + +if (\PHP_VERSION_ID >= 80100) { + return; +} + +if (defined('MYSQLI_REFRESH_SLAVE') && !defined('MYSQLI_REFRESH_REPLICA')) { + define('MYSQLI_REFRESH_REPLICA', 64); +} + +if (!function_exists('array_is_list')) { + function array_is_list(array $array): bool { return p\Php81::array_is_list($array); } +} + +if (!function_exists('enum_exists')) { + function enum_exists(string $enum, bool $autoload = true): bool { return $autoload && class_exists($enum) && false; } +} diff --git a/vendor/symfony/polyfill-php81/composer.json b/vendor/symfony/polyfill-php81/composer.json index 28b6408..be4904d 100644 --- a/vendor/symfony/polyfill-php81/composer.json +++ b/vendor/symfony/polyfill-php81/composer.json @@ -1,33 +1,33 @@ -{ - "name": "symfony/polyfill-php81", - "type": "library", - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", - "keywords": ["polyfill", "shim", "compatibility", "portable"], - "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" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Php81\\": "" }, - "files": [ "bootstrap.php" ], - "classmap": [ "Resources/stubs" ] - }, - "minimum-stability": "dev", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} +{ + "name": "symfony/polyfill-php81", + "type": "library", + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "keywords": ["polyfill", "shim", "compatibility", "portable"], + "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" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Php81\\": "" }, + "files": [ "bootstrap.php" ], + "classmap": [ "Resources/stubs" ] + }, + "minimum-stability": "dev", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + } +} diff --git a/vendor/twig/twig/CHANGELOG b/vendor/twig/twig/CHANGELOG index 44c79b1..f0da9a9 100644 --- a/vendor/twig/twig/CHANGELOG +++ b/vendor/twig/twig/CHANGELOG @@ -1,325 +1,325 @@ -# 3.14.0 (2024-09-09) - - * Fix a security issue when an included sandboxed template has been loaded before without the sandbox context - * Add the possibility to reset globals via `Environment::resetGlobals()` - * Deprecate `Environment::mergeGlobals()` - -# 3.13.0 (2024-09-07) - - * Add the `types` tag (experimental) - * Deprecate the `Twig\Test\NodeTestCase::getTests()` data provider, override `provideTests()` instead. - * Mark `Twig\Test\NodeTestCase::getEnvironment()` as final, override `createEnvironment()` instead. - * Deprecate `Twig\Test\NodeTestCase::getVariableGetter()`, call `createVariableGetter()` instead. - * Deprecate `Twig\Test\NodeTestCase::getAttributeGetter()`, call `createAttributeGetter()` instead. - * Deprecate not overriding `Twig\Test\IntegrationTestCase::getFixturesDirectory()`, this method will be abstract in 4.0 - * Marked `Twig\Test\IntegrationTestCase::getTests()` and `getLegacyTests()` as final - -# 3.12.0 (2024-08-29) - - * Deprecate the fact that the `extends` and `use` tags are always allowed in a sandboxed template. - This behavior will change in 4.0 where these tags will need to be explicitly allowed like any other tag. - * Deprecate the "tag" constructor argument of the "Twig\Node\Node" class as the tag is now automatically set by the Parser when needed - * Fix precedence of two-word tests when the first word is a valid test - * Deprecate the `spaceless` filter - * Deprecate some internal methods from `Parser`: `getBlockStack()`, `hasBlock()`, `getBlock()`, `hasMacro()`, `hasTraits()`, `getParent()` - * Deprecate passing `null` to `Twig\Parser::setParent()` - * Update `Node::__toString()` to include the node tag if set - * Add support for integers in methods of `Twig\Node\Node` that take a Node name - * Deprecate not passing a `BodyNode` instance as the body of a `ModuleNode` or `MacroNode` constructor - * Deprecate returning "null" from "TokenParserInterface::parse()". - * Deprecate `OptimizerNodeVisitor::OPTIMIZE_TEXT_NODES` - * Fix performance regression when `use_yield` is `false` (which is the default) - * Improve compatibility when `use_yield` is `false` (as extensions still using `echo` will work as is) - * Accept colons (`:`) in addition to equals (`=`) to separate argument names and values in named arguments - * Add the `html_cva` function (in the HTML extra package) - * Add support for named arguments to the `block` and `attribute` functions - * Throw a SyntaxError exception at compile time when a Twig callable has not the minimum number of required arguments - * Add a `CallableArgumentsExtractor` class - * Deprecate passing a name to `FunctionExpression`, `FilterExpression`, and `TestExpression`; - pass a `TwigFunction`, `TwigFilter`, or `TestFilter` instead - * Deprecate all Twig callable attributes on `FunctionExpression`, `FilterExpression`, and `TestExpression` - * Deprecate the `filter` node of `FilterExpression` - * Add the notion of Twig callables (functions, filters, and tests) - * Bump minimum PHP version to 8.0 - * Fix integration tests when a test has more than one data/expect section and deprecations - * Add the `enum_cases` function - -# 3.11.0 (2024-08-08) - - * Deprecate `OptimizerNodeVisitor::OPTIMIZE_RAW_FILTER` - * Add `Twig\Cache\ChainCache` and `Twig\Cache\ReadOnlyFilesystemCache` - * Add the possibility to deprecate attributes and nodes on `Node` - * Add the possibility to add a package and a version to the `deprecated` tag - * Add the possibility to add a package for filter/function/test deprecations - * Mark `ConstantExpression` as being `@final` - * Add the `find` filter - * Fix optimizer mode validation in `OptimizerNodeVisitor` - * Add the possibility to yield from a generator in `PrintNode` - * Add the `shuffle` filter - * Add the `singular` and `plural` filters in `StringExtension` - * Deprecate the second argument of `Twig\Node\Expression\CallExpression::compileArguments()` - * Deprecate `Twig\ExpressionParser\parseHashExpression()` in favor of - `Twig\ExpressionParser::parseMappingExpression()` - * Deprecate `Twig\ExpressionParser\parseArrayExpression()` in favor of - `Twig\ExpressionParser::parseSequenceExpression()` - * Add `sequence` and `mapping` tests - * Deprecate `Twig\Node\Expression\NameExpression::isSimple()` and - `Twig\Node\Expression\NameExpression::isSpecial()` - -# 3.10.3 (2024-05-16) - - * Fix missing ; in generated code - -# 3.10.2 (2024-05-14) - - * Fix support for the deprecated escaper signature - -# 3.10.1 (2024-05-12) - - * Fix BC break on escaper extension - * Fix constant return type - -# 3.10.0 (2024-05-11) - - * Make `CoreExtension::formatDate`, `CoreExtension::convertDate`, and - `CoreExtension::formatNumber` part of the public API - * Add `needs_charset` option for filters and functions - * Extract the escaping logic from the `EscaperExtension` class to a new - `EscaperRuntime` class. - - The following methods from ``Twig\\Extension\\EscaperExtension`` are - deprecated: ``setEscaper()``, ``getEscapers()``, ``setSafeClasses``, - ``addSafeClasses()``. Use the same methods on the - ``Twig\\Runtime\\EscaperRuntime`` class instead. - * Fix capturing output from extensions that still use echo - * Fix a PHP warning in the Lexer on malformed templates - * Fix blocks not available under some circumstances - * Synchronize source context in templates when setting a Node on a Node - -# 3.9.3 (2024-04-18) - - * Add missing `twig_escape_filter_is_safe` deprecated function - * Fix yield usage with CaptureNode - * Add missing unwrap call when using a TemplateWrapper instance internally - * Ensure Lexer is initialized early on - -# 3.9.2 (2024-04-17) - - * Fix usage of display_end hook - -# 3.9.1 (2024-04-17) - - * Fix missing `$blocks` variable in `CaptureNode` - -# 3.9.0 (2024-04-16) - - * Add support for PHP 8.4 - * Deprecate AbstractNodeVisitor - * Deprecate passing Template to Environment::resolveTemplate(), Environment::load(), and Template::loadTemplate() - * Add a new "yield" mode for output generation; - Node implementations that use "echo" or "print" should use "yield" instead; - all Node implementations should be flagged with `#[YieldReady]` once they've been made ready for "yield"; - the "use_yield" Environment option can be turned on when all nodes have been made `#[YieldReady]`; - "yield" will be the only strategy supported in the next major version - * Add return type for Symfony 7 compatibility - * Fix premature loop exit in Security Policy lookup of allowed methods/properties - * Deprecate all internal extension functions in favor of methods on the extension classes - * Mark all extension functions as @internal - * Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source - * Throw a proper Twig exception when using cycle on an empty array - -# 3.8.0 (2023-11-21) - - * Catch errors thrown during template rendering - * Fix IntlExtension::formatDateTime use of date formatter prototype - * Fix premature loop exit in Security Policy lookup of allowed methods/properties - * Remove NumberFormatter::TYPE_CURRENCY (deprecated in PHP 8.3) - * Restore return type annotations - * Allow Symfony 7 packages to be installed - * Deprecate `twig_test_iterable` function. Use the native `is_iterable` instead. - -# 3.7.1 (2023-08-28) - - * Fix some phpdocs - -# 3.7.0 (2023-07-26) - - * Add support for the ...spread operator on arrays and hashes - -# 3.6.1 (2023-06-08) - - * Suppress some native return type deprecation messages - -# 3.6.0 (2023-05-03) - - * Allow psr/container 2.0 - * Add the new PHP 8.0 IntlDateFormatter::RELATIVE_* constants for date formatting - * Make the Lexer initialize itself lazily - -# 3.5.1 (2023-02-08) - - * Arrow functions passed to the "reduce" filter now accept the current key as a third argument - * Restores the leniency of the matches twig comparison - * Fix error messages in sandboxed mode for "has some" and "has every" - -# 3.5.0 (2022-12-27) - - * Make Twig\ExpressionParser non-internal - * Add "has some" and "has every" operators - * Add Compile::reset() - * Throw a better runtime error when the "matches" regexp is not valid - * Add "twig *_names" intl functions - * Fix optimizing closures callbacks - * Add a better exception when getting an undefined constant via `constant` - * Fix `if` nodes when outside of a block and with an empty body - -# 3.4.3 (2022-09-28) - - * Fix a security issue on filesystem loader (possibility to load a template outside a configured directory) - -# 3.4.2 (2022-08-12) - - * Allow inherited magic method to still run with calling class - * Fix CallExpression::reflectCallable() throwing TypeError - * Fix typo in naming (currency_code) - -# 3.4.1 (2022-05-17) - -* Fix optimizing non-public named closures - -# 3.4.0 (2022-05-22) - - * Add support for named closures - -# 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 marked 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 +# 3.14.0 (2024-09-09) + + * Fix a security issue when an included sandboxed template has been loaded before without the sandbox context + * Add the possibility to reset globals via `Environment::resetGlobals()` + * Deprecate `Environment::mergeGlobals()` + +# 3.13.0 (2024-09-07) + + * Add the `types` tag (experimental) + * Deprecate the `Twig\Test\NodeTestCase::getTests()` data provider, override `provideTests()` instead. + * Mark `Twig\Test\NodeTestCase::getEnvironment()` as final, override `createEnvironment()` instead. + * Deprecate `Twig\Test\NodeTestCase::getVariableGetter()`, call `createVariableGetter()` instead. + * Deprecate `Twig\Test\NodeTestCase::getAttributeGetter()`, call `createAttributeGetter()` instead. + * Deprecate not overriding `Twig\Test\IntegrationTestCase::getFixturesDirectory()`, this method will be abstract in 4.0 + * Marked `Twig\Test\IntegrationTestCase::getTests()` and `getLegacyTests()` as final + +# 3.12.0 (2024-08-29) + + * Deprecate the fact that the `extends` and `use` tags are always allowed in a sandboxed template. + This behavior will change in 4.0 where these tags will need to be explicitly allowed like any other tag. + * Deprecate the "tag" constructor argument of the "Twig\Node\Node" class as the tag is now automatically set by the Parser when needed + * Fix precedence of two-word tests when the first word is a valid test + * Deprecate the `spaceless` filter + * Deprecate some internal methods from `Parser`: `getBlockStack()`, `hasBlock()`, `getBlock()`, `hasMacro()`, `hasTraits()`, `getParent()` + * Deprecate passing `null` to `Twig\Parser::setParent()` + * Update `Node::__toString()` to include the node tag if set + * Add support for integers in methods of `Twig\Node\Node` that take a Node name + * Deprecate not passing a `BodyNode` instance as the body of a `ModuleNode` or `MacroNode` constructor + * Deprecate returning "null" from "TokenParserInterface::parse()". + * Deprecate `OptimizerNodeVisitor::OPTIMIZE_TEXT_NODES` + * Fix performance regression when `use_yield` is `false` (which is the default) + * Improve compatibility when `use_yield` is `false` (as extensions still using `echo` will work as is) + * Accept colons (`:`) in addition to equals (`=`) to separate argument names and values in named arguments + * Add the `html_cva` function (in the HTML extra package) + * Add support for named arguments to the `block` and `attribute` functions + * Throw a SyntaxError exception at compile time when a Twig callable has not the minimum number of required arguments + * Add a `CallableArgumentsExtractor` class + * Deprecate passing a name to `FunctionExpression`, `FilterExpression`, and `TestExpression`; + pass a `TwigFunction`, `TwigFilter`, or `TestFilter` instead + * Deprecate all Twig callable attributes on `FunctionExpression`, `FilterExpression`, and `TestExpression` + * Deprecate the `filter` node of `FilterExpression` + * Add the notion of Twig callables (functions, filters, and tests) + * Bump minimum PHP version to 8.0 + * Fix integration tests when a test has more than one data/expect section and deprecations + * Add the `enum_cases` function + +# 3.11.0 (2024-08-08) + + * Deprecate `OptimizerNodeVisitor::OPTIMIZE_RAW_FILTER` + * Add `Twig\Cache\ChainCache` and `Twig\Cache\ReadOnlyFilesystemCache` + * Add the possibility to deprecate attributes and nodes on `Node` + * Add the possibility to add a package and a version to the `deprecated` tag + * Add the possibility to add a package for filter/function/test deprecations + * Mark `ConstantExpression` as being `@final` + * Add the `find` filter + * Fix optimizer mode validation in `OptimizerNodeVisitor` + * Add the possibility to yield from a generator in `PrintNode` + * Add the `shuffle` filter + * Add the `singular` and `plural` filters in `StringExtension` + * Deprecate the second argument of `Twig\Node\Expression\CallExpression::compileArguments()` + * Deprecate `Twig\ExpressionParser\parseHashExpression()` in favor of + `Twig\ExpressionParser::parseMappingExpression()` + * Deprecate `Twig\ExpressionParser\parseArrayExpression()` in favor of + `Twig\ExpressionParser::parseSequenceExpression()` + * Add `sequence` and `mapping` tests + * Deprecate `Twig\Node\Expression\NameExpression::isSimple()` and + `Twig\Node\Expression\NameExpression::isSpecial()` + +# 3.10.3 (2024-05-16) + + * Fix missing ; in generated code + +# 3.10.2 (2024-05-14) + + * Fix support for the deprecated escaper signature + +# 3.10.1 (2024-05-12) + + * Fix BC break on escaper extension + * Fix constant return type + +# 3.10.0 (2024-05-11) + + * Make `CoreExtension::formatDate`, `CoreExtension::convertDate`, and + `CoreExtension::formatNumber` part of the public API + * Add `needs_charset` option for filters and functions + * Extract the escaping logic from the `EscaperExtension` class to a new + `EscaperRuntime` class. + + The following methods from ``Twig\\Extension\\EscaperExtension`` are + deprecated: ``setEscaper()``, ``getEscapers()``, ``setSafeClasses``, + ``addSafeClasses()``. Use the same methods on the + ``Twig\\Runtime\\EscaperRuntime`` class instead. + * Fix capturing output from extensions that still use echo + * Fix a PHP warning in the Lexer on malformed templates + * Fix blocks not available under some circumstances + * Synchronize source context in templates when setting a Node on a Node + +# 3.9.3 (2024-04-18) + + * Add missing `twig_escape_filter_is_safe` deprecated function + * Fix yield usage with CaptureNode + * Add missing unwrap call when using a TemplateWrapper instance internally + * Ensure Lexer is initialized early on + +# 3.9.2 (2024-04-17) + + * Fix usage of display_end hook + +# 3.9.1 (2024-04-17) + + * Fix missing `$blocks` variable in `CaptureNode` + +# 3.9.0 (2024-04-16) + + * Add support for PHP 8.4 + * Deprecate AbstractNodeVisitor + * Deprecate passing Template to Environment::resolveTemplate(), Environment::load(), and Template::loadTemplate() + * Add a new "yield" mode for output generation; + Node implementations that use "echo" or "print" should use "yield" instead; + all Node implementations should be flagged with `#[YieldReady]` once they've been made ready for "yield"; + the "use_yield" Environment option can be turned on when all nodes have been made `#[YieldReady]`; + "yield" will be the only strategy supported in the next major version + * Add return type for Symfony 7 compatibility + * Fix premature loop exit in Security Policy lookup of allowed methods/properties + * Deprecate all internal extension functions in favor of methods on the extension classes + * Mark all extension functions as @internal + * Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source + * Throw a proper Twig exception when using cycle on an empty array + +# 3.8.0 (2023-11-21) + + * Catch errors thrown during template rendering + * Fix IntlExtension::formatDateTime use of date formatter prototype + * Fix premature loop exit in Security Policy lookup of allowed methods/properties + * Remove NumberFormatter::TYPE_CURRENCY (deprecated in PHP 8.3) + * Restore return type annotations + * Allow Symfony 7 packages to be installed + * Deprecate `twig_test_iterable` function. Use the native `is_iterable` instead. + +# 3.7.1 (2023-08-28) + + * Fix some phpdocs + +# 3.7.0 (2023-07-26) + + * Add support for the ...spread operator on arrays and hashes + +# 3.6.1 (2023-06-08) + + * Suppress some native return type deprecation messages + +# 3.6.0 (2023-05-03) + + * Allow psr/container 2.0 + * Add the new PHP 8.0 IntlDateFormatter::RELATIVE_* constants for date formatting + * Make the Lexer initialize itself lazily + +# 3.5.1 (2023-02-08) + + * Arrow functions passed to the "reduce" filter now accept the current key as a third argument + * Restores the leniency of the matches twig comparison + * Fix error messages in sandboxed mode for "has some" and "has every" + +# 3.5.0 (2022-12-27) + + * Make Twig\ExpressionParser non-internal + * Add "has some" and "has every" operators + * Add Compile::reset() + * Throw a better runtime error when the "matches" regexp is not valid + * Add "twig *_names" intl functions + * Fix optimizing closures callbacks + * Add a better exception when getting an undefined constant via `constant` + * Fix `if` nodes when outside of a block and with an empty body + +# 3.4.3 (2022-09-28) + + * Fix a security issue on filesystem loader (possibility to load a template outside a configured directory) + +# 3.4.2 (2022-08-12) + + * Allow inherited magic method to still run with calling class + * Fix CallExpression::reflectCallable() throwing TypeError + * Fix typo in naming (currency_code) + +# 3.4.1 (2022-05-17) + +* Fix optimizing non-public named closures + +# 3.4.0 (2022-05-22) + + * Add support for named closures + +# 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 marked 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 index fd8234e..639b98b 100644 --- a/vendor/twig/twig/LICENSE +++ b/vendor/twig/twig/LICENSE @@ -1,27 +1,27 @@ -Copyright (c) 2009-present 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. +Copyright (c) 2009-present 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 index 7bf8c67..4886e6f 100644 --- a/vendor/twig/twig/README.rst +++ b/vendor/twig/twig/README.rst @@ -1,23 +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 +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 index e0c3e6c..96f1708 100644 --- a/vendor/twig/twig/composer.json +++ b/vendor/twig/twig/composer.json @@ -1,53 +1,53 @@ -{ - "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": ">=8.0.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php81": "^1.29" - }, - "require-dev": { - "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0", - "psr/container": "^1.0|^2.0" - }, - "autoload": { - "files": [ - "src/Resources/core.php", - "src/Resources/debug.php", - "src/Resources/escaper.php", - "src/Resources/string_loader.php" - ], - "psr-4" : { - "Twig\\" : "src/" - } - }, - "autoload-dev": { - "psr-4" : { - "Twig\\Tests\\" : "tests/" - } - } -} +{ + "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": ">=8.0.2", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php81": "^1.29" + }, + "require-dev": { + "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0", + "psr/container": "^1.0|^2.0" + }, + "autoload": { + "files": [ + "src/Resources/core.php", + "src/Resources/debug.php", + "src/Resources/escaper.php", + "src/Resources/string_loader.php" + ], + "psr-4" : { + "Twig\\" : "src/" + } + }, + "autoload-dev": { + "psr-4" : { + "Twig\\Tests\\" : "tests/" + } + } +} diff --git a/vendor/twig/twig/src/AbstractTwigCallable.php b/vendor/twig/twig/src/AbstractTwigCallable.php index f671843..8989d0e 100644 --- a/vendor/twig/twig/src/AbstractTwigCallable.php +++ b/vendor/twig/twig/src/AbstractTwigCallable.php @@ -1,136 +1,136 @@ - - */ -abstract class AbstractTwigCallable implements TwigCallableInterface -{ - protected $options; - - private $name; - private $dynamicName; - private $callable; - private $arguments; - - public function __construct(string $name, $callable = null, array $options = []) - { - $this->name = $this->dynamicName = $name; - $this->callable = $callable; - $this->arguments = []; - $this->options = array_merge([ - 'needs_environment' => false, - 'needs_context' => false, - 'needs_charset' => false, - 'is_variadic' => false, - 'deprecated' => false, - 'deprecating_package' => '', - 'alternative' => null, - ], $options); - } - - public function __toString(): string - { - return \sprintf('%s(%s)', static::class, $this->name); - } - - public function getName(): string - { - return $this->name; - } - - public function getDynamicName(): string - { - return $this->dynamicName; - } - - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass(): string - { - return $this->options['node_class']; - } - - public function needsCharset(): bool - { - return $this->options['needs_charset']; - } - - public function needsEnvironment(): bool - { - return $this->options['needs_environment']; - } - - public function needsContext(): bool - { - return $this->options['needs_context']; - } - - public function withDynamicArguments(string $name, string $dynamicName, array $arguments): self - { - $new = clone $this; - $new->name = $name; - $new->dynamicName = $dynamicName; - $new->arguments = $arguments; - - return $new; - } - - /** - * @deprecated since Twig 3.12, use withDynamicArguments() instead - */ - public function setArguments(array $arguments): void - { - trigger_deprecation('twig/twig', '3.12', 'The "%s::setArguments()" method is deprecated, use "%s::withDynamicArguments()" instead.', static::class, static::class); - - $this->arguments = $arguments; - } - - public function getArguments(): array - { - return $this->arguments; - } - - public function isVariadic(): bool - { - return $this->options['is_variadic']; - } - - public function isDeprecated(): bool - { - return (bool) $this->options['deprecated']; - } - - public function getDeprecatingPackage(): string - { - return $this->options['deprecating_package']; - } - - public function getDeprecatedVersion(): string - { - return \is_bool($this->options['deprecated']) ? '' : $this->options['deprecated']; - } - - public function getAlternative(): ?string - { - return $this->options['alternative']; - } - - public function getMinimalNumberOfRequiredArguments(): int - { - return ($this->options['needs_charset'] ? 1 : 0) + ($this->options['needs_environment'] ? 1 : 0) + ($this->options['needs_context'] ? 1 : 0) + \count($this->arguments); - } -} + + */ +abstract class AbstractTwigCallable implements TwigCallableInterface +{ + protected $options; + + private $name; + private $dynamicName; + private $callable; + private $arguments; + + public function __construct(string $name, $callable = null, array $options = []) + { + $this->name = $this->dynamicName = $name; + $this->callable = $callable; + $this->arguments = []; + $this->options = array_merge([ + 'needs_environment' => false, + 'needs_context' => false, + 'needs_charset' => false, + 'is_variadic' => false, + 'deprecated' => false, + 'deprecating_package' => '', + 'alternative' => null, + ], $options); + } + + public function __toString(): string + { + return \sprintf('%s(%s)', static::class, $this->name); + } + + public function getName(): string + { + return $this->name; + } + + public function getDynamicName(): string + { + return $this->dynamicName; + } + + public function getCallable() + { + return $this->callable; + } + + public function getNodeClass(): string + { + return $this->options['node_class']; + } + + public function needsCharset(): bool + { + return $this->options['needs_charset']; + } + + public function needsEnvironment(): bool + { + return $this->options['needs_environment']; + } + + public function needsContext(): bool + { + return $this->options['needs_context']; + } + + public function withDynamicArguments(string $name, string $dynamicName, array $arguments): self + { + $new = clone $this; + $new->name = $name; + $new->dynamicName = $dynamicName; + $new->arguments = $arguments; + + return $new; + } + + /** + * @deprecated since Twig 3.12, use withDynamicArguments() instead + */ + public function setArguments(array $arguments): void + { + trigger_deprecation('twig/twig', '3.12', 'The "%s::setArguments()" method is deprecated, use "%s::withDynamicArguments()" instead.', static::class, static::class); + + $this->arguments = $arguments; + } + + public function getArguments(): array + { + return $this->arguments; + } + + public function isVariadic(): bool + { + return $this->options['is_variadic']; + } + + public function isDeprecated(): bool + { + return (bool) $this->options['deprecated']; + } + + public function getDeprecatingPackage(): string + { + return $this->options['deprecating_package']; + } + + public function getDeprecatedVersion(): string + { + return \is_bool($this->options['deprecated']) ? '' : $this->options['deprecated']; + } + + public function getAlternative(): ?string + { + return $this->options['alternative']; + } + + public function getMinimalNumberOfRequiredArguments(): int + { + return ($this->options['needs_charset'] ? 1 : 0) + ($this->options['needs_environment'] ? 1 : 0) + ($this->options['needs_context'] ? 1 : 0) + \count($this->arguments); + } +} diff --git a/vendor/twig/twig/src/Attribute/FirstClassTwigCallableReady.php b/vendor/twig/twig/src/Attribute/FirstClassTwigCallableReady.php index ffd8cff..5702c23 100644 --- a/vendor/twig/twig/src/Attribute/FirstClassTwigCallableReady.php +++ b/vendor/twig/twig/src/Attribute/FirstClassTwigCallableReady.php @@ -1,20 +1,20 @@ - - */ -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; -} + + */ +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/ChainCache.php b/vendor/twig/twig/src/Cache/ChainCache.php index c94afdb..ae52d9d 100644 --- a/vendor/twig/twig/src/Cache/ChainCache.php +++ b/vendor/twig/twig/src/Cache/ChainCache.php @@ -1,79 +1,79 @@ - - */ -final class ChainCache implements CacheInterface -{ - /** - * @param iterable $caches The ordered list of caches used to store and fetch cached items - */ - public function __construct( - private iterable $caches, - ) { - } - - public function generateKey(string $name, string $className): string - { - return $className.'#'.$name; - } - - public function write(string $key, string $content): void - { - $splitKey = $this->splitKey($key); - - foreach ($this->caches as $cache) { - $cache->write($cache->generateKey(...$splitKey), $content); - } - } - - public function load(string $key): void - { - [$name, $className] = $this->splitKey($key); - - foreach ($this->caches as $cache) { - $cache->load($cache->generateKey($name, $className)); - - if (class_exists($className, false)) { - break; - } - } - } - - public function getTimestamp(string $key): int - { - $splitKey = $this->splitKey($key); - - foreach ($this->caches as $cache) { - if (0 < $timestamp = $cache->getTimestamp($cache->generateKey(...$splitKey))) { - return $timestamp; - } - } - - return 0; - } - - /** - * @return string[] - */ - private function splitKey(string $key): array - { - return array_reverse(explode('#', $key, 2)); - } -} + + */ +final class ChainCache implements CacheInterface +{ + /** + * @param iterable $caches The ordered list of caches used to store and fetch cached items + */ + public function __construct( + private iterable $caches, + ) { + } + + public function generateKey(string $name, string $className): string + { + return $className.'#'.$name; + } + + public function write(string $key, string $content): void + { + $splitKey = $this->splitKey($key); + + foreach ($this->caches as $cache) { + $cache->write($cache->generateKey(...$splitKey), $content); + } + } + + public function load(string $key): void + { + [$name, $className] = $this->splitKey($key); + + foreach ($this->caches as $cache) { + $cache->load($cache->generateKey($name, $className)); + + if (class_exists($className, false)) { + break; + } + } + } + + public function getTimestamp(string $key): int + { + $splitKey = $this->splitKey($key); + + foreach ($this->caches as $cache) { + if (0 < $timestamp = $cache->getTimestamp($cache->generateKey(...$splitKey))) { + return $timestamp; + } + } + + return 0; + } + + /** + * @return string[] + */ + private function splitKey(string $key): array + { + return array_reverse(explode('#', $key, 2)); + } +} diff --git a/vendor/twig/twig/src/Cache/FilesystemCache.php b/vendor/twig/twig/src/Cache/FilesystemCache.php index 2e79fac..8c914af 100644 --- a/vendor/twig/twig/src/Cache/FilesystemCache.php +++ b/vendor/twig/twig/src/Cache/FilesystemCache.php @@ -1,87 +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); - } -} + + */ +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 index 8d20d59..01af507 100644 --- a/vendor/twig/twig/src/Cache/NullCache.php +++ b/vendor/twig/twig/src/Cache/NullCache.php @@ -1,38 +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; - } -} + + */ +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/Cache/ReadOnlyFilesystemCache.php b/vendor/twig/twig/src/Cache/ReadOnlyFilesystemCache.php index 3ba6514..c91f120 100644 --- a/vendor/twig/twig/src/Cache/ReadOnlyFilesystemCache.php +++ b/vendor/twig/twig/src/Cache/ReadOnlyFilesystemCache.php @@ -1,25 +1,25 @@ - - */ -class ReadOnlyFilesystemCache extends FilesystemCache -{ - public function write(string $key, string $content): void - { - // Do nothing with the content, it's a read-only filesystem. - } -} + + */ +class ReadOnlyFilesystemCache extends FilesystemCache +{ + public function write(string $key, string $content): void + { + // Do nothing with the content, it's a read-only filesystem. + } +} diff --git a/vendor/twig/twig/src/Compiler.php b/vendor/twig/twig/src/Compiler.php index 1a43aa7..824cdf5 100644 --- a/vendor/twig/twig/src/Compiler.php +++ b/vendor/twig/twig/src/Compiler.php @@ -1,257 +1,257 @@ - - */ -class Compiler -{ - private $lastLine; - private $source; - private $indentation; - private $debugInfo = []; - private $sourceOffset; - private $sourceLine; - private $varNameSalt = 0; - private $didUseEcho = false; - private $didUseEchoStack = []; - - public function __construct( - private Environment $env, - ) { - } - - public function getEnvironment(): Environment - { - return $this->env; - } - - public function getSource(): string - { - return $this->source; - } - - /** - * @return $this - */ - public function reset(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; - - return $this; - } - - /** - * @return $this - */ - public function compile(Node $node, int $indentation = 0) - { - $this->reset($indentation); - $this->didUseEchoStack[] = $this->didUseEcho; - - try { - $this->didUseEcho = false; - $node->compile($this); - - if ($this->didUseEcho) { - trigger_deprecation('twig/twig', '3.9', 'Using "%s" is deprecated, use "yield" instead in "%s", then flag the class with #[YieldReady].', $this->didUseEcho, \get_class($node)); - } - - return $this; - } finally { - $this->didUseEcho = array_pop($this->didUseEchoStack); - } - } - - /** - * @return $this - */ - public function subcompile(Node $node, bool $raw = true) - { - if (!$raw) { - $this->source .= str_repeat(' ', $this->indentation * 4); - } - - $this->didUseEchoStack[] = $this->didUseEcho; - - try { - $this->didUseEcho = false; - $node->compile($this); - - if ($this->didUseEcho) { - trigger_deprecation('twig/twig', '3.9', 'Using "%s" is deprecated, use "yield" instead in "%s", then flag the class with #[YieldReady].', $this->didUseEcho, \get_class($node)); - } - - return $this; - } finally { - $this->didUseEcho = array_pop($this->didUseEchoStack); - } - } - - /** - * Adds a raw string to the compiled code. - * - * @return $this - */ - public function raw(string $string) - { - $this->checkForEcho($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->checkForEcho($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++); - } - - private function checkForEcho(string $string): void - { - if ($this->didUseEcho) { - return; - } - - $this->didUseEcho = preg_match('/^\s*+(echo|print)\b/', $string, $m) ? $m[1] : false; - } -} + + */ +class Compiler +{ + private $lastLine; + private $source; + private $indentation; + private $debugInfo = []; + private $sourceOffset; + private $sourceLine; + private $varNameSalt = 0; + private $didUseEcho = false; + private $didUseEchoStack = []; + + public function __construct( + private Environment $env, + ) { + } + + public function getEnvironment(): Environment + { + return $this->env; + } + + public function getSource(): string + { + return $this->source; + } + + /** + * @return $this + */ + public function reset(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; + + return $this; + } + + /** + * @return $this + */ + public function compile(Node $node, int $indentation = 0) + { + $this->reset($indentation); + $this->didUseEchoStack[] = $this->didUseEcho; + + try { + $this->didUseEcho = false; + $node->compile($this); + + if ($this->didUseEcho) { + trigger_deprecation('twig/twig', '3.9', 'Using "%s" is deprecated, use "yield" instead in "%s", then flag the class with #[YieldReady].', $this->didUseEcho, \get_class($node)); + } + + return $this; + } finally { + $this->didUseEcho = array_pop($this->didUseEchoStack); + } + } + + /** + * @return $this + */ + public function subcompile(Node $node, bool $raw = true) + { + if (!$raw) { + $this->source .= str_repeat(' ', $this->indentation * 4); + } + + $this->didUseEchoStack[] = $this->didUseEcho; + + try { + $this->didUseEcho = false; + $node->compile($this); + + if ($this->didUseEcho) { + trigger_deprecation('twig/twig', '3.9', 'Using "%s" is deprecated, use "yield" instead in "%s", then flag the class with #[YieldReady].', $this->didUseEcho, \get_class($node)); + } + + return $this; + } finally { + $this->didUseEcho = array_pop($this->didUseEchoStack); + } + } + + /** + * Adds a raw string to the compiled code. + * + * @return $this + */ + public function raw(string $string) + { + $this->checkForEcho($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->checkForEcho($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++); + } + + private function checkForEcho(string $string): void + { + if ($this->didUseEcho) { + return; + } + + $this->didUseEcho = preg_match('/^\s*+(echo|print)\b/', $string, $m) ? $m[1] : false; + } +} diff --git a/vendor/twig/twig/src/Environment.php b/vendor/twig/twig/src/Environment.php index 24e55e9..d250637 100644 --- a/vendor/twig/twig/src/Environment.php +++ b/vendor/twig/twig/src/Environment.php @@ -1,881 +1,881 @@ - - */ -class Environment -{ - public const VERSION = '3.14.0'; - public const VERSION_ID = 31400; - public const MAJOR_VERSION = 3; - public const MINOR_VERSION = 14; - public const RELEASE_VERSION = 0; - public const EXTRA_VERSION = ''; - - private $charset; - private $loader; - private $debug; - private $autoReload; - private $cache; - private $lexer; - private $parser; - private $compiler; - /** @var array */ - private $globals = []; - private $resolvedGlobals; - private $loadedTemplates; - private $strictVariables; - private $originalCache; - private $extensionSet; - private $runtimeLoaders = []; - private $runtimes = []; - private $optionsHash; - /** @var bool */ - private $useYield; - private $defaultRuntimeLoader; - - /** - * 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). - * - * * use_yield: true: forces templates to exclusively use "yield" instead of "echo" (all extensions must be yield ready) - * false (default): allows templates to use a mix of "yield" and "echo" calls to allow for a progressive migration - * Switch to "true" when possible as this will be the only supported mode in Twig 4.0 - */ - public function __construct(LoaderInterface $loader, array $options = []) - { - $this->setLoader($loader); - - $options = array_merge([ - 'debug' => false, - 'charset' => 'UTF-8', - 'strict_variables' => false, - 'autoescape' => 'html', - 'cache' => false, - 'auto_reload' => null, - 'optimizations' => -1, - 'use_yield' => false, - ], $options); - - $this->useYield = (bool) $options['use_yield']; - $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->defaultRuntimeLoader = new FactoryRuntimeLoader([ - EscaperRuntime::class => function () { return new EscaperRuntime($this->charset); }, - ]); - - $this->addExtension(new CoreExtension()); - $escaperExt = new EscaperExtension($options['autoescape']); - $escaperExt->setEnvironment($this, false); - $this->addExtension($escaperExt); - if (\PHP_VERSION_ID >= 80000) { - $this->addExtension(new YieldNotReadyExtension($this->useYield)); - } - $this->addExtension(new OptimizerExtension($options['optimizations'])); - } - - /** - * @internal - */ - public function useYield(): bool - { - return $this->useYield; - } - - /** - * 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; - * * 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 '__TwigTemplate_'.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; - } - if ($name instanceof Template) { - trigger_deprecation('twig/twig', '3.9', 'Passing a "%s" instance to "%s" is deprecated.', self::class, __METHOD__); - - 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|null $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); - } - - 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|null $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\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) { - trigger_deprecation('twig/twig', '3.9', 'Passing a "%s" instance to "%s" is deprecated.', Template::class, __METHOD__); - - return new TemplateWrapper($this, $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 = 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; - } - } - - if (null !== $runtime = $this->defaultRuntimeLoader->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 - * - * @return array - */ - 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 resetGlobals(): void - { - $this->resolvedGlobals = null; - $this->extensionSet->resetGlobals(); - } - - /** - * @deprecated since Twig 3.14 - */ - public function mergeGlobals(array $context): array - { - trigger_deprecation('twig/twig', '3.14', 'The "%s" method is deprecated.', __METHOD__); - - return $context + $this->getGlobals(); - } - - /** - * @internal - * - * @return array}> - */ - public function getUnaryOperators(): array - { - return $this->extensionSet->getUnaryOperators(); - } - - /** - * @internal - * - * @return array, associativity: ExpressionParser::OPERATOR_*}> - */ - 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, - $this->useYield ? '1' : '0', - ]); - } -} + + */ +class Environment +{ + public const VERSION = '3.14.0'; + public const VERSION_ID = 31400; + public const MAJOR_VERSION = 3; + public const MINOR_VERSION = 14; + public const RELEASE_VERSION = 0; + public const EXTRA_VERSION = ''; + + private $charset; + private $loader; + private $debug; + private $autoReload; + private $cache; + private $lexer; + private $parser; + private $compiler; + /** @var array */ + private $globals = []; + private $resolvedGlobals; + private $loadedTemplates; + private $strictVariables; + private $originalCache; + private $extensionSet; + private $runtimeLoaders = []; + private $runtimes = []; + private $optionsHash; + /** @var bool */ + private $useYield; + private $defaultRuntimeLoader; + + /** + * 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). + * + * * use_yield: true: forces templates to exclusively use "yield" instead of "echo" (all extensions must be yield ready) + * false (default): allows templates to use a mix of "yield" and "echo" calls to allow for a progressive migration + * Switch to "true" when possible as this will be the only supported mode in Twig 4.0 + */ + public function __construct(LoaderInterface $loader, array $options = []) + { + $this->setLoader($loader); + + $options = array_merge([ + 'debug' => false, + 'charset' => 'UTF-8', + 'strict_variables' => false, + 'autoescape' => 'html', + 'cache' => false, + 'auto_reload' => null, + 'optimizations' => -1, + 'use_yield' => false, + ], $options); + + $this->useYield = (bool) $options['use_yield']; + $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->defaultRuntimeLoader = new FactoryRuntimeLoader([ + EscaperRuntime::class => function () { return new EscaperRuntime($this->charset); }, + ]); + + $this->addExtension(new CoreExtension()); + $escaperExt = new EscaperExtension($options['autoescape']); + $escaperExt->setEnvironment($this, false); + $this->addExtension($escaperExt); + if (\PHP_VERSION_ID >= 80000) { + $this->addExtension(new YieldNotReadyExtension($this->useYield)); + } + $this->addExtension(new OptimizerExtension($options['optimizations'])); + } + + /** + * @internal + */ + public function useYield(): bool + { + return $this->useYield; + } + + /** + * 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; + * * 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 '__TwigTemplate_'.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; + } + if ($name instanceof Template) { + trigger_deprecation('twig/twig', '3.9', 'Passing a "%s" instance to "%s" is deprecated.', self::class, __METHOD__); + + 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|null $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); + } + + 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|null $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\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) { + trigger_deprecation('twig/twig', '3.9', 'Passing a "%s" instance to "%s" is deprecated.', Template::class, __METHOD__); + + return new TemplateWrapper($this, $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 = 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; + } + } + + if (null !== $runtime = $this->defaultRuntimeLoader->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 + * + * @return array + */ + 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 resetGlobals(): void + { + $this->resolvedGlobals = null; + $this->extensionSet->resetGlobals(); + } + + /** + * @deprecated since Twig 3.14 + */ + public function mergeGlobals(array $context): array + { + trigger_deprecation('twig/twig', '3.14', 'The "%s" method is deprecated.', __METHOD__); + + return $context + $this->getGlobals(); + } + + /** + * @internal + * + * @return array}> + */ + public function getUnaryOperators(): array + { + return $this->extensionSet->getUnaryOperators(); + } + + /** + * @internal + * + * @return array, associativity: ExpressionParser::OPERATOR_*}> + */ + 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, + $this->useYield ? '1' : '0', + ]); + } +} diff --git a/vendor/twig/twig/src/Error/Error.php b/vendor/twig/twig/src/Error/Error.php index 61c309f..3f0af70 100644 --- a/vendor/twig/twig/src/Error/Error.php +++ b/vendor/twig/twig/src/Error/Error.php @@ -1,227 +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, ?\Throwable $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 (str_ends_with($this->message, '.')) { - $this->message = substr($this->message, 0, -1); - $dot = true; - } - - $questionMark = false; - if (str_ends_with($this->message, '?')) { - $this->message = substr($this->message, 0, -1); - $questionMark = true; - } - - if ($this->name) { - if (\is_string($this->name) || $this->name instanceof \Stringable) { - $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 : str_starts_with($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; - } - } - } - } - } -} + + */ +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, ?\Throwable $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 (str_ends_with($this->message, '.')) { + $this->message = substr($this->message, 0, -1); + $dot = true; + } + + $questionMark = false; + if (str_ends_with($this->message, '?')) { + $this->message = substr($this->message, 0, -1); + $questionMark = true; + } + + if ($this->name) { + if (\is_string($this->name) || $this->name instanceof \Stringable) { + $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 : str_starts_with($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 index 7c8c23c..73c680d 100644 --- a/vendor/twig/twig/src/Error/LoaderError.php +++ b/vendor/twig/twig/src/Error/LoaderError.php @@ -1,21 +1,21 @@ - - */ -class LoaderError extends Error -{ -} + + */ +class LoaderError extends Error +{ +} diff --git a/vendor/twig/twig/src/Error/RuntimeError.php b/vendor/twig/twig/src/Error/RuntimeError.php index f6b8476..8a5abe1 100644 --- a/vendor/twig/twig/src/Error/RuntimeError.php +++ b/vendor/twig/twig/src/Error/RuntimeError.php @@ -1,22 +1,22 @@ - - */ -class RuntimeError extends Error -{ -} + + */ +class RuntimeError extends Error +{ +} diff --git a/vendor/twig/twig/src/Error/SyntaxError.php b/vendor/twig/twig/src/Error/SyntaxError.php index 841b653..ac08535 100644 --- a/vendor/twig/twig/src/Error/SyntaxError.php +++ b/vendor/twig/twig/src/Error/SyntaxError.php @@ -1,46 +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 || str_contains($item, $name)) { - $alternatives[$item] = $lev; - } - } - - if (!$alternatives) { - return; - } - - asort($alternatives); - - $this->appendMessage(\sprintf(' Did you mean "%s"?', implode('", "', array_keys($alternatives)))); - } -} + + */ +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 || str_contains($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 index dc4a601..b6d1e86 100644 --- a/vendor/twig/twig/src/ExpressionParser.php +++ b/vendor/twig/twig/src/ExpressionParser.php @@ -1,853 +1,853 @@ - - */ -class ExpressionParser -{ - public const OPERATOR_LEFT = 1; - public const OPERATOR_RIGHT = 2; - - /** @var array}> */ - private $unaryOperators; - /** @var array, associativity: self::OPERATOR_*}> */ - private $binaryOperators; - private $readyNodes = []; - - public function __construct( - private Parser $parser, - private Environment $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'], true); - $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)) { - $line = $stream->getCurrent()->getLine(); - $token = $stream->expect(Token::NAME_TYPE); - $names = [new AssignNameExpression($token->getValue(), $token->getLine())]; - $stream->expect(Token::ARROW_TYPE); - - 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, '(')) { - return null; - } - ++$i; - while (true) { - // variable name - ++$i; - if (!$stream->look($i)->test(Token::PUNCTUATION_TYPE, ',')) { - break; - } - ++$i; - } - if (!$stream->look($i)->test(Token::PUNCTUATION_TYPE, ')')) { - return null; - } - ++$i; - if (!$stream->look($i)->test(Token::ARROW_TYPE)) { - return null; - } - - // yes, let's parse it properly - $token = $stream->expect(Token::PUNCTUATION_TYPE, '('); - $line = $token->getLine(); - - $names = []; - while (true) { - $token = $stream->expect(Token::NAME_TYPE); - $names[] = new AssignNameExpression($token->getValue(), $token->getLine()); - - if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { - break; - } - } - $stream->expect(Token::PUNCTUATION_TYPE, ')'); - $stream->expect(Token::ARROW_TYPE); - - 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, '(')) { - $this->parser->getStream()->next(); - $expr = $this->parseExpression(); - $this->parser->getStream()->expect(Token::PUNCTUATION_TYPE, ')', '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, '?')) { - if (!$this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ':')) { - $expr2 = $this->parseExpression(); - if ($this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ':')) { - // Ternary operator (expr ? expr2 : expr3) - $expr3 = $this->parseExpression(); - } else { - // Ternary without else (expr ? expr2) - $expr3 = new ConstantExpression('', $this->parser->getCurrentToken()->getLine()); - } - } else { - // Ternary without then (expr ?: expr3) - $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) && isset($this->unaryOperators[$token->getValue()]); - } - - private function isBinary(Token $token): bool - { - return $token->test(Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]); - } - - public function parsePrimaryExpression() - { - $token = $this->parser->getCurrentToken(); - switch ($token->getType()) { - case Token::NAME_TYPE: - $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: - $this->parser->getStream()->next(); - $node = new ConstantExpression($token->getValue(), $token->getLine()); - break; - - case Token::STRING_TYPE: - case Token::INTERPOLATION_START_TYPE: - $node = $this->parseStringExpression(); - break; - - case Token::OPERATOR_TYPE: - 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, '[')) { - $node = $this->parseSequenceExpression(); - } elseif ($token->test(Token::PUNCTUATION_TYPE, '{')) { - $node = $this->parseMappingExpression(); - } elseif ($token->test(Token::OPERATOR_TYPE, '=') && ('==' === $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)) { - $nodes[] = new ConstantExpression($token->getValue(), $token->getLine()); - $nextCanBeString = false; - } elseif ($stream->nextIf(Token::INTERPOLATION_START_TYPE)) { - $nodes[] = $this->parseExpression(); - $stream->expect(Token::INTERPOLATION_END_TYPE); - $nextCanBeString = true; - } else { - break; - } - } - - $expr = array_shift($nodes); - foreach ($nodes as $node) { - $expr = new ConcatBinary($expr, $node, $node->getTemplateLine()); - } - - return $expr; - } - - /** - * @deprecated since 3.11, use parseSequenceExpression() instead - */ - public function parseArrayExpression() - { - trigger_deprecation('twig/twig', '3.11', 'Calling "%s()" is deprecated, use "parseSequenceExpression()" instead.', __METHOD__); - - return $this->parseSequenceExpression(); - } - - public function parseSequenceExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(Token::PUNCTUATION_TYPE, '[', 'A sequence element was expected'); - - $node = new ArrayExpression([], $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(Token::PUNCTUATION_TYPE, ']')) { - if (!$first) { - $stream->expect(Token::PUNCTUATION_TYPE, ',', 'A sequence element must be followed by a comma'); - - // trailing ,? - if ($stream->test(Token::PUNCTUATION_TYPE, ']')) { - break; - } - } - $first = false; - - if ($stream->test(Token::SPREAD_TYPE)) { - $stream->next(); - $expr = $this->parseExpression(); - $expr->setAttribute('spread', true); - $node->addElement($expr); - } else { - $node->addElement($this->parseExpression()); - } - } - $stream->expect(Token::PUNCTUATION_TYPE, ']', 'An opened sequence is not properly closed'); - - return $node; - } - - /** - * @deprecated since 3.11, use parseMappingExpression() instead - */ - public function parseHashExpression() - { - trigger_deprecation('twig/twig', '3.11', 'Calling "%s()" is deprecated, use "parseMappingExpression()" instead.', __METHOD__); - - return $this->parseMappingExpression(); - } - - public function parseMappingExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(Token::PUNCTUATION_TYPE, '{', 'A mapping element was expected'); - - $node = new ArrayExpression([], $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(Token::PUNCTUATION_TYPE, '}')) { - if (!$first) { - $stream->expect(Token::PUNCTUATION_TYPE, ',', 'A mapping value must be followed by a comma'); - - // trailing ,? - if ($stream->test(Token::PUNCTUATION_TYPE, '}')) { - break; - } - } - $first = false; - - if ($stream->test(Token::SPREAD_TYPE)) { - $stream->next(); - $value = $this->parseExpression(); - $value->setAttribute('spread', true); - $node->addElement($value); - continue; - } - - // a mapping 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)) { - $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)) || $token = $stream->nextIf(Token::NUMBER_TYPE)) { - $key = new ConstantExpression($token->getValue(), $token->getLine()); - } elseif ($stream->test(Token::PUNCTUATION_TYPE, '(')) { - $key = $this->parseExpression(); - } else { - $current = $stream->getCurrent(); - - throw new SyntaxError(\sprintf('A mapping 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, ':', 'A mapping key must be followed by a colon (:)'); - $value = $this->parseExpression(); - - $node->addElement($value, $key); - } - $stream->expect(Token::PUNCTUATION_TYPE, '}', 'An opened mapping is not properly closed'); - - return $node; - } - - public function parsePostfixExpression($node) - { - while (true) { - $token = $this->parser->getCurrentToken(); - if (Token::PUNCTUATION_TYPE == $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) - { - 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); - $function = $this->getFunction($name, $line); - - if ($function->getParserCallable()) { - $fakeNode = new Node(lineno: $line); - $fakeNode->setSourceContext($this->parser->getStream()->getSourceContext()); - - return ($function->getParserCallable())($this->parser, $fakeNode, $args, $line); - } - - if (!isset($this->readyNodes[$class = $function->getNodeClass()])) { - $this->readyNodes[$class] = (bool) (new \ReflectionClass($class))->getConstructor()->getAttributes(FirstClassTwigCallableReady::class); - } - - if (!$ready = $this->readyNodes[$class]) { - trigger_deprecation('twig/twig', '3.12', 'Twig node "%s" is not marked as ready for passing a "TwigFunction" in the constructor instead of its name; please update your code and then add #[FirstClassTwigCallableReady] attribute to the constructor.', $class); - } - - return new $class($ready ? $function : $function->getName(), $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 == $token->getType() - || - Token::NUMBER_TYPE == $token->getType() - || - (Token::OPERATOR_TYPE == $token->getType() && preg_match(Lexer::REGEX_NAME, $token->getValue())) - ) { - $arg = new ConstantExpression($token->getValue(), $lineno); - - if ($stream->test(Token::PUNCTUATION_TYPE, '(')) { - $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'))) { - $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, ':')) { - $slice = true; - $arg = new ConstantExpression(0, $token->getLine()); - } else { - $arg = $this->parseExpression(); - } - - if ($stream->nextIf(Token::PUNCTUATION_TYPE, ':')) { - $slice = true; - } - - if ($slice) { - if ($stream->test(Token::PUNCTUATION_TYPE, ']')) { - $length = new ConstantExpression(null, $token->getLine()); - } else { - $length = $this->parseExpression(); - } - - $filter = $this->getFilter('slice', $token->getLine()); - $arguments = new Node([$arg, $length]); - $filter = new ($filter->getNodeClass())($node, $filter, $arguments, $token->getLine()); - - $stream->expect(Token::PUNCTUATION_TYPE, ']'); - - return $filter; - } - - $stream->expect(Token::PUNCTUATION_TYPE, ']'); - } - - return new GetAttrExpression($node, $arg, $arguments, $type, $lineno); - } - - public function parseFilterExpression($node) - { - $this->parser->getStream()->next(); - - return $this->parseFilterExpressionRaw($node); - } - - public function parseFilterExpressionRaw($node) - { - if (\func_num_args() > 1) { - trigger_deprecation('twig/twig', '3.12', 'Passing a second argument to "%s()" is deprecated.', __METHOD__); - } - - while (true) { - $token = $this->parser->getStream()->expect(Token::NAME_TYPE); - - if (!$this->parser->getStream()->test(Token::PUNCTUATION_TYPE, '(')) { - $arguments = new Node(); - } else { - $arguments = $this->parseArguments(true, false, true); - } - - $filter = $this->getFilter($token->getValue(), $token->getLine()); - - $ready = true; - if (!isset($this->readyNodes[$class = $filter->getNodeClass()])) { - $this->readyNodes[$class] = (bool) (new \ReflectionClass($class))->getConstructor()->getAttributes(FirstClassTwigCallableReady::class); - } - - if (!$ready = $this->readyNodes[$class]) { - trigger_deprecation('twig/twig', '3.12', 'Twig node "%s" is not marked as ready for passing a "TwigFilter" in the constructor instead of its name; please update your code and then add #[FirstClassTwigCallableReady] attribute to the constructor.', $class); - } - - $node = new $class($node, $ready ? $filter : new ConstantExpression($filter->getName(), $token->getLine()), $arguments, $token->getLine()); - - if (!$this->parser->getStream()->test(Token::PUNCTUATION_TYPE, '|')) { - 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 (or macro) definition - * - * @return Node - * - * @throws SyntaxError - */ - public function parseArguments($namedArguments = false, $definition = false, $allowArrow = false) - { - $args = []; - $stream = $this->parser->getStream(); - - $stream->expect(Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); - while (!$stream->test(Token::PUNCTUATION_TYPE, ')')) { - if (!empty($args)) { - $stream->expect(Token::PUNCTUATION_TYPE, ',', '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, ')')) { - break; - } - } - - if ($definition) { - $token = $stream->expect(Token::NAME_TYPE, 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, '=')) || ($token = $stream->nextIf(Token::PUNCTUATION_TYPE, ':')))) { - 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, a sequence, or a mapping).', $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()); - $value->setAttribute('is_implicit', true); - } - $args[$name] = $value; - } else { - if (null === $name) { - $args[] = $value; - } else { - $args[$name] = $value; - } - } - } - $stream->expect(Token::PUNCTUATION_TYPE, ')', '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) && 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, 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, ',')) { - break; - } - } - - return new Node($targets); - } - - public function parseMultitargetExpression() - { - $targets = []; - while (true) { - $targets[] = $this->parseExpression(); - if (!$this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ',')) { - 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(); - $test = $this->getTest($node->getTemplateLine()); - - $arguments = null; - if ($stream->test(Token::PUNCTUATION_TYPE, '(')) { - $arguments = $this->parseArguments(true); - } elseif ($test->hasOneMandatoryArgument()) { - $arguments = new Node([0 => $this->parsePrimaryExpression()]); - } - - if ('defined' === $test->getName() && $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); - } - - $ready = $test instanceof TwigTest; - if (!isset($this->readyNodes[$class = $test->getNodeClass()])) { - $this->readyNodes[$class] = (bool) (new \ReflectionClass($class))->getConstructor()->getAttributes(FirstClassTwigCallableReady::class); - } - - if (!$ready = $this->readyNodes[$class]) { - trigger_deprecation('twig/twig', '3.12', 'Twig node "%s" is not marked as ready for passing a "TwigTest" in the constructor instead of its name; please update your code and then add #[FirstClassTwigCallableReady] attribute to the constructor.', $class); - } - - return new $class($node, $ready ? $test : $test->getName(), $arguments, $this->parser->getCurrentToken()->getLine()); - } - - private function getTest(int $line): TwigTest - { - $stream = $this->parser->getStream(); - $name = $stream->expect(Token::NAME_TYPE)->getValue(); - - if ($stream->test(Token::NAME_TYPE)) { - // try 2-words tests - $name = $name.' '.$this->parser->getCurrentToken()->getValue(); - - if ($test = $this->env->getTest($name)) { - $stream->next(); - } - } else { - $test = $this->env->getTest($name); - } - - if (!$test) { - $e = new SyntaxError(\sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getTests())); - - throw $e; - } - - if ($test->isDeprecated()) { - $stream = $this->parser->getStream(); - $message = \sprintf('Twig Test "%s" is deprecated', $test->getName()); - - 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_deprecation($test->getDeprecatingPackage(), $test->getDeprecatedVersion(), $message); - } - - return $test; - } - - private function getFunction(string $name, int $line): TwigFunction - { - 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->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_deprecation($function->getDeprecatingPackage(), $function->getDeprecatedVersion(), $message); - } - - return $function; - } - - private function getFilter(string $name, int $line): TwigFilter - { - 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->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_deprecation($filter->getDeprecatingPackage(), $filter->getDeprecatedVersion(), $message); - } - - return $filter; - } - - // 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; - } -} + + */ +class ExpressionParser +{ + public const OPERATOR_LEFT = 1; + public const OPERATOR_RIGHT = 2; + + /** @var array}> */ + private $unaryOperators; + /** @var array, associativity: self::OPERATOR_*}> */ + private $binaryOperators; + private $readyNodes = []; + + public function __construct( + private Parser $parser, + private Environment $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'], true); + $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)) { + $line = $stream->getCurrent()->getLine(); + $token = $stream->expect(Token::NAME_TYPE); + $names = [new AssignNameExpression($token->getValue(), $token->getLine())]; + $stream->expect(Token::ARROW_TYPE); + + 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, '(')) { + return null; + } + ++$i; + while (true) { + // variable name + ++$i; + if (!$stream->look($i)->test(Token::PUNCTUATION_TYPE, ',')) { + break; + } + ++$i; + } + if (!$stream->look($i)->test(Token::PUNCTUATION_TYPE, ')')) { + return null; + } + ++$i; + if (!$stream->look($i)->test(Token::ARROW_TYPE)) { + return null; + } + + // yes, let's parse it properly + $token = $stream->expect(Token::PUNCTUATION_TYPE, '('); + $line = $token->getLine(); + + $names = []; + while (true) { + $token = $stream->expect(Token::NAME_TYPE); + $names[] = new AssignNameExpression($token->getValue(), $token->getLine()); + + if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } + $stream->expect(Token::PUNCTUATION_TYPE, ')'); + $stream->expect(Token::ARROW_TYPE); + + 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, '(')) { + $this->parser->getStream()->next(); + $expr = $this->parseExpression(); + $this->parser->getStream()->expect(Token::PUNCTUATION_TYPE, ')', '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, '?')) { + if (!$this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ':')) { + $expr2 = $this->parseExpression(); + if ($this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ':')) { + // Ternary operator (expr ? expr2 : expr3) + $expr3 = $this->parseExpression(); + } else { + // Ternary without else (expr ? expr2) + $expr3 = new ConstantExpression('', $this->parser->getCurrentToken()->getLine()); + } + } else { + // Ternary without then (expr ?: expr3) + $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) && isset($this->unaryOperators[$token->getValue()]); + } + + private function isBinary(Token $token): bool + { + return $token->test(Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]); + } + + public function parsePrimaryExpression() + { + $token = $this->parser->getCurrentToken(); + switch ($token->getType()) { + case Token::NAME_TYPE: + $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: + $this->parser->getStream()->next(); + $node = new ConstantExpression($token->getValue(), $token->getLine()); + break; + + case Token::STRING_TYPE: + case Token::INTERPOLATION_START_TYPE: + $node = $this->parseStringExpression(); + break; + + case Token::OPERATOR_TYPE: + 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, '[')) { + $node = $this->parseSequenceExpression(); + } elseif ($token->test(Token::PUNCTUATION_TYPE, '{')) { + $node = $this->parseMappingExpression(); + } elseif ($token->test(Token::OPERATOR_TYPE, '=') && ('==' === $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)) { + $nodes[] = new ConstantExpression($token->getValue(), $token->getLine()); + $nextCanBeString = false; + } elseif ($stream->nextIf(Token::INTERPOLATION_START_TYPE)) { + $nodes[] = $this->parseExpression(); + $stream->expect(Token::INTERPOLATION_END_TYPE); + $nextCanBeString = true; + } else { + break; + } + } + + $expr = array_shift($nodes); + foreach ($nodes as $node) { + $expr = new ConcatBinary($expr, $node, $node->getTemplateLine()); + } + + return $expr; + } + + /** + * @deprecated since 3.11, use parseSequenceExpression() instead + */ + public function parseArrayExpression() + { + trigger_deprecation('twig/twig', '3.11', 'Calling "%s()" is deprecated, use "parseSequenceExpression()" instead.', __METHOD__); + + return $this->parseSequenceExpression(); + } + + public function parseSequenceExpression() + { + $stream = $this->parser->getStream(); + $stream->expect(Token::PUNCTUATION_TYPE, '[', 'A sequence element was expected'); + + $node = new ArrayExpression([], $stream->getCurrent()->getLine()); + $first = true; + while (!$stream->test(Token::PUNCTUATION_TYPE, ']')) { + if (!$first) { + $stream->expect(Token::PUNCTUATION_TYPE, ',', 'A sequence element must be followed by a comma'); + + // trailing ,? + if ($stream->test(Token::PUNCTUATION_TYPE, ']')) { + break; + } + } + $first = false; + + if ($stream->test(Token::SPREAD_TYPE)) { + $stream->next(); + $expr = $this->parseExpression(); + $expr->setAttribute('spread', true); + $node->addElement($expr); + } else { + $node->addElement($this->parseExpression()); + } + } + $stream->expect(Token::PUNCTUATION_TYPE, ']', 'An opened sequence is not properly closed'); + + return $node; + } + + /** + * @deprecated since 3.11, use parseMappingExpression() instead + */ + public function parseHashExpression() + { + trigger_deprecation('twig/twig', '3.11', 'Calling "%s()" is deprecated, use "parseMappingExpression()" instead.', __METHOD__); + + return $this->parseMappingExpression(); + } + + public function parseMappingExpression() + { + $stream = $this->parser->getStream(); + $stream->expect(Token::PUNCTUATION_TYPE, '{', 'A mapping element was expected'); + + $node = new ArrayExpression([], $stream->getCurrent()->getLine()); + $first = true; + while (!$stream->test(Token::PUNCTUATION_TYPE, '}')) { + if (!$first) { + $stream->expect(Token::PUNCTUATION_TYPE, ',', 'A mapping value must be followed by a comma'); + + // trailing ,? + if ($stream->test(Token::PUNCTUATION_TYPE, '}')) { + break; + } + } + $first = false; + + if ($stream->test(Token::SPREAD_TYPE)) { + $stream->next(); + $value = $this->parseExpression(); + $value->setAttribute('spread', true); + $node->addElement($value); + continue; + } + + // a mapping 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)) { + $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)) || $token = $stream->nextIf(Token::NUMBER_TYPE)) { + $key = new ConstantExpression($token->getValue(), $token->getLine()); + } elseif ($stream->test(Token::PUNCTUATION_TYPE, '(')) { + $key = $this->parseExpression(); + } else { + $current = $stream->getCurrent(); + + throw new SyntaxError(\sprintf('A mapping 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, ':', 'A mapping key must be followed by a colon (:)'); + $value = $this->parseExpression(); + + $node->addElement($value, $key); + } + $stream->expect(Token::PUNCTUATION_TYPE, '}', 'An opened mapping is not properly closed'); + + return $node; + } + + public function parsePostfixExpression($node) + { + while (true) { + $token = $this->parser->getCurrentToken(); + if (Token::PUNCTUATION_TYPE == $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) + { + 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); + $function = $this->getFunction($name, $line); + + if ($function->getParserCallable()) { + $fakeNode = new Node(lineno: $line); + $fakeNode->setSourceContext($this->parser->getStream()->getSourceContext()); + + return ($function->getParserCallable())($this->parser, $fakeNode, $args, $line); + } + + if (!isset($this->readyNodes[$class = $function->getNodeClass()])) { + $this->readyNodes[$class] = (bool) (new \ReflectionClass($class))->getConstructor()->getAttributes(FirstClassTwigCallableReady::class); + } + + if (!$ready = $this->readyNodes[$class]) { + trigger_deprecation('twig/twig', '3.12', 'Twig node "%s" is not marked as ready for passing a "TwigFunction" in the constructor instead of its name; please update your code and then add #[FirstClassTwigCallableReady] attribute to the constructor.', $class); + } + + return new $class($ready ? $function : $function->getName(), $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 == $token->getType() + || + Token::NUMBER_TYPE == $token->getType() + || + (Token::OPERATOR_TYPE == $token->getType() && preg_match(Lexer::REGEX_NAME, $token->getValue())) + ) { + $arg = new ConstantExpression($token->getValue(), $lineno); + + if ($stream->test(Token::PUNCTUATION_TYPE, '(')) { + $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'))) { + $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, ':')) { + $slice = true; + $arg = new ConstantExpression(0, $token->getLine()); + } else { + $arg = $this->parseExpression(); + } + + if ($stream->nextIf(Token::PUNCTUATION_TYPE, ':')) { + $slice = true; + } + + if ($slice) { + if ($stream->test(Token::PUNCTUATION_TYPE, ']')) { + $length = new ConstantExpression(null, $token->getLine()); + } else { + $length = $this->parseExpression(); + } + + $filter = $this->getFilter('slice', $token->getLine()); + $arguments = new Node([$arg, $length]); + $filter = new ($filter->getNodeClass())($node, $filter, $arguments, $token->getLine()); + + $stream->expect(Token::PUNCTUATION_TYPE, ']'); + + return $filter; + } + + $stream->expect(Token::PUNCTUATION_TYPE, ']'); + } + + return new GetAttrExpression($node, $arg, $arguments, $type, $lineno); + } + + public function parseFilterExpression($node) + { + $this->parser->getStream()->next(); + + return $this->parseFilterExpressionRaw($node); + } + + public function parseFilterExpressionRaw($node) + { + if (\func_num_args() > 1) { + trigger_deprecation('twig/twig', '3.12', 'Passing a second argument to "%s()" is deprecated.', __METHOD__); + } + + while (true) { + $token = $this->parser->getStream()->expect(Token::NAME_TYPE); + + if (!$this->parser->getStream()->test(Token::PUNCTUATION_TYPE, '(')) { + $arguments = new Node(); + } else { + $arguments = $this->parseArguments(true, false, true); + } + + $filter = $this->getFilter($token->getValue(), $token->getLine()); + + $ready = true; + if (!isset($this->readyNodes[$class = $filter->getNodeClass()])) { + $this->readyNodes[$class] = (bool) (new \ReflectionClass($class))->getConstructor()->getAttributes(FirstClassTwigCallableReady::class); + } + + if (!$ready = $this->readyNodes[$class]) { + trigger_deprecation('twig/twig', '3.12', 'Twig node "%s" is not marked as ready for passing a "TwigFilter" in the constructor instead of its name; please update your code and then add #[FirstClassTwigCallableReady] attribute to the constructor.', $class); + } + + $node = new $class($node, $ready ? $filter : new ConstantExpression($filter->getName(), $token->getLine()), $arguments, $token->getLine()); + + if (!$this->parser->getStream()->test(Token::PUNCTUATION_TYPE, '|')) { + 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 (or macro) definition + * + * @return Node + * + * @throws SyntaxError + */ + public function parseArguments($namedArguments = false, $definition = false, $allowArrow = false) + { + $args = []; + $stream = $this->parser->getStream(); + + $stream->expect(Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); + while (!$stream->test(Token::PUNCTUATION_TYPE, ')')) { + if (!empty($args)) { + $stream->expect(Token::PUNCTUATION_TYPE, ',', '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, ')')) { + break; + } + } + + if ($definition) { + $token = $stream->expect(Token::NAME_TYPE, 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, '=')) || ($token = $stream->nextIf(Token::PUNCTUATION_TYPE, ':')))) { + 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, a sequence, or a mapping).', $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()); + $value->setAttribute('is_implicit', true); + } + $args[$name] = $value; + } else { + if (null === $name) { + $args[] = $value; + } else { + $args[$name] = $value; + } + } + } + $stream->expect(Token::PUNCTUATION_TYPE, ')', '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) && 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, 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, ',')) { + break; + } + } + + return new Node($targets); + } + + public function parseMultitargetExpression() + { + $targets = []; + while (true) { + $targets[] = $this->parseExpression(); + if (!$this->parser->getStream()->nextIf(Token::PUNCTUATION_TYPE, ',')) { + 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(); + $test = $this->getTest($node->getTemplateLine()); + + $arguments = null; + if ($stream->test(Token::PUNCTUATION_TYPE, '(')) { + $arguments = $this->parseArguments(true); + } elseif ($test->hasOneMandatoryArgument()) { + $arguments = new Node([0 => $this->parsePrimaryExpression()]); + } + + if ('defined' === $test->getName() && $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); + } + + $ready = $test instanceof TwigTest; + if (!isset($this->readyNodes[$class = $test->getNodeClass()])) { + $this->readyNodes[$class] = (bool) (new \ReflectionClass($class))->getConstructor()->getAttributes(FirstClassTwigCallableReady::class); + } + + if (!$ready = $this->readyNodes[$class]) { + trigger_deprecation('twig/twig', '3.12', 'Twig node "%s" is not marked as ready for passing a "TwigTest" in the constructor instead of its name; please update your code and then add #[FirstClassTwigCallableReady] attribute to the constructor.', $class); + } + + return new $class($node, $ready ? $test : $test->getName(), $arguments, $this->parser->getCurrentToken()->getLine()); + } + + private function getTest(int $line): TwigTest + { + $stream = $this->parser->getStream(); + $name = $stream->expect(Token::NAME_TYPE)->getValue(); + + if ($stream->test(Token::NAME_TYPE)) { + // try 2-words tests + $name = $name.' '.$this->parser->getCurrentToken()->getValue(); + + if ($test = $this->env->getTest($name)) { + $stream->next(); + } + } else { + $test = $this->env->getTest($name); + } + + if (!$test) { + $e = new SyntaxError(\sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext()); + $e->addSuggestions($name, array_keys($this->env->getTests())); + + throw $e; + } + + if ($test->isDeprecated()) { + $stream = $this->parser->getStream(); + $message = \sprintf('Twig Test "%s" is deprecated', $test->getName()); + + 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_deprecation($test->getDeprecatingPackage(), $test->getDeprecatedVersion(), $message); + } + + return $test; + } + + private function getFunction(string $name, int $line): TwigFunction + { + 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->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_deprecation($function->getDeprecatingPackage(), $function->getDeprecatedVersion(), $message); + } + + return $function; + } + + private function getFilter(string $name, int $line): TwigFilter + { + 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->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_deprecation($filter->getDeprecatingPackage(), $filter->getDeprecatedVersion(), $message); + } + + return $filter; + } + + // 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 index a1b083b..473f409 100644 --- a/vendor/twig/twig/src/Extension/AbstractExtension.php +++ b/vendor/twig/twig/src/Extension/AbstractExtension.php @@ -1,45 +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 TypesTokenParser(), - new FlushTokenParser(), - new DoTokenParser(), - new EmbedTokenParser(), - new WithTokenParser(), - new DeprecatedTokenParser(), - ]; - } - - public function getFilters(): array - { - return [ - // formatting filters - new TwigFilter('date', [$this, 'formatDate']), - new TwigFilter('date_modify', [$this, 'modifyDate']), - new TwigFilter('format', [self::class, 'sprintf']), - new TwigFilter('replace', [self::class, 'replace']), - new TwigFilter('number_format', [$this, 'formatNumber']), - new TwigFilter('abs', 'abs'), - new TwigFilter('round', [self::class, 'round']), - - // encoding - new TwigFilter('url_encode', [self::class, 'urlencode']), - new TwigFilter('json_encode', 'json_encode'), - new TwigFilter('convert_encoding', [self::class, 'convertEncoding']), - - // string filters - new TwigFilter('title', [self::class, 'titleCase'], ['needs_charset' => true]), - new TwigFilter('capitalize', [self::class, 'capitalize'], ['needs_charset' => true]), - new TwigFilter('upper', [self::class, 'upper'], ['needs_charset' => true]), - new TwigFilter('lower', [self::class, 'lower'], ['needs_charset' => true]), - new TwigFilter('striptags', [self::class, 'striptags']), - new TwigFilter('trim', [self::class, 'trim']), - new TwigFilter('nl2br', [self::class, 'nl2br'], ['pre_escape' => 'html', 'is_safe' => ['html']]), - new TwigFilter('spaceless', [self::class, 'spaceless'], ['is_safe' => ['html'], 'deprecated' => '3.12', 'deprecating_package' => 'twig/twig']), - - // array helpers - new TwigFilter('join', [self::class, 'join']), - new TwigFilter('split', [self::class, 'split'], ['needs_charset' => true]), - new TwigFilter('sort', [self::class, 'sort'], ['needs_environment' => true]), - new TwigFilter('merge', [self::class, 'merge']), - new TwigFilter('batch', [self::class, 'batch']), - new TwigFilter('column', [self::class, 'column']), - new TwigFilter('filter', [self::class, 'filter'], ['needs_environment' => true]), - new TwigFilter('map', [self::class, 'map'], ['needs_environment' => true]), - new TwigFilter('reduce', [self::class, 'reduce'], ['needs_environment' => true]), - new TwigFilter('find', [self::class, 'find'], ['needs_environment' => true]), - - // string/array filters - new TwigFilter('reverse', [self::class, 'reverse'], ['needs_charset' => true]), - new TwigFilter('shuffle', [self::class, 'shuffle'], ['needs_charset' => true]), - new TwigFilter('length', [self::class, 'length'], ['needs_charset' => true]), - new TwigFilter('slice', [self::class, 'slice'], ['needs_charset' => true]), - new TwigFilter('first', [self::class, 'first'], ['needs_charset' => true]), - new TwigFilter('last', [self::class, 'last'], ['needs_charset' => true]), - - // iteration and runtime - new TwigFilter('default', [self::class, 'default'], ['node_class' => DefaultFilter::class]), - new TwigFilter('keys', [self::class, 'keys']), - ]; - } - - public function getFunctions(): array - { - return [ - new TwigFunction('parent', null, ['parser_callable' => [self::class, 'parseParentFunction']]), - new TwigFunction('block', null, ['parser_callable' => [self::class, 'parseBlockFunction']]), - new TwigFunction('attribute', null, ['parser_callable' => [self::class, 'parseAttributeFunction']]), - new TwigFunction('max', 'max'), - new TwigFunction('min', 'min'), - new TwigFunction('range', 'range'), - new TwigFunction('constant', [self::class, 'constant']), - new TwigFunction('cycle', [self::class, 'cycle']), - new TwigFunction('random', [self::class, 'random'], ['needs_charset' => true]), - new TwigFunction('date', [$this, 'convertDate']), - new TwigFunction('include', [self::class, 'include'], ['needs_environment' => true, 'needs_context' => true, 'is_safe' => ['all']]), - new TwigFunction('source', [self::class, 'source'], ['needs_environment' => true, 'is_safe' => ['all']]), - new TwigFunction('enum_cases', [self::class, 'enumCases'], ['node_class' => EnumCasesFunction::class]), - ]; - } - - 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', [self::class, 'testEmpty']), - new TwigTest('iterable', 'is_iterable'), - new TwigTest('sequence', [self::class, 'testSequence']), - new TwigTest('mapping', [self::class, 'testMapping']), - ]; - } - - 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], - 'has some' => ['precedence' => 20, 'class' => HasSomeBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], - 'has every' => ['precedence' => 20, 'class' => HasEveryBinary::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], - ], - ]; - } - - /** - * Cycles over a sequence. - * - * @param array|\ArrayAccess $values A non-empty sequence of values - * @param positive-int $position The position of the value to return in the cycle - * - * @return mixed The value at the given position in the sequence, wrapping around as needed - * - * @internal - */ - public static function cycle($values, $position): mixed - { - if (!\is_array($values)) { - if (!$values instanceof \ArrayAccess) { - throw new RuntimeError('The "cycle" function expects an array or "ArrayAccess" as first argument.'); - } - - if (!is_countable($values)) { - // To be uncommented in 4.0 - // throw new RuntimeError('The "cycle" function expects a countable sequence as first argument.'); - - trigger_deprecation('twig/twig', '3.12', 'Passing a non-countable sequence of values to "%s()" is deprecated.', __METHOD__); - - return $values; - } - - $values = self::toArray($values, false); - } - - if (!$count = \count($values)) { - throw new RuntimeError('The "cycle" function does not work on empty sequences.'); - } - - return $values[$position % $count]; - } - - /** - * 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 - * - * @return mixed A random value from the given sequence - * - * @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is) - * - * @internal - */ - public static function random(string $charset, $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; - } - - return mt_rand((int) $min, (int) $max); - } - - if (\is_string($values)) { - if ('' === $values) { - return ''; - } - - if ('UTF-8' !== $charset) { - $values = self::convertEncoding($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] = self::convertEncoding($value, $charset, 'UTF-8'); - } - } - } - - if (!is_iterable($values)) { - return $values; - } - - $values = self::toArray($values); - - if (0 === \count($values)) { - throw new RuntimeError('The random function cannot pick from an empty sequence/mapping.'); - } - - return $values[array_rand($values, 1)]; - } - - /** - * Formats a date. - * - * {{ 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 - */ - public function formatDate($date, $format = null, $timezone = null): string - { - if (null === $format) { - $formats = $this->getDateFormat(); - $format = $date instanceof \DateInterval ? $formats[1] : $formats[0]; - } - - if ($date instanceof \DateInterval) { - return $date->format($format); - } - - return $this->convertDate($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 \DateTime|\DateTimeImmutable - * - * @internal - */ - public function modifyDate($date, $modifier) - { - return $this->convertDate($date, false)->modify($modifier); - } - - /** - * Returns a formatted string. - * - * @param string|null $format - * @param ...$values - * - * @internal - */ - public static function sprintf($format, ...$values): string - { - return \sprintf($format ?? '', ...$values); - } - - /** - * @internal - */ - public static function dateConverter(Environment $env, $date, $format = null, $timezone = null): string - { - return $env->getExtension(self::class)->formatDate($date, $format, $timezone); - } - - /** - * 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 \DateTime|\DateTimeImmutable - */ - public function convertDate($date = null, $timezone = null) - { - // determine the timezone - if (false !== $timezone) { - if (null === $timezone) { - $timezone = $this->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 \DateTime) { - $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 : $this->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, $this->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 - * - * @internal - */ - public static function replace($str, $from): string - { - if (!is_iterable($from)) { - throw new RuntimeError(\sprintf('The "replace" filter expects a sequence/mapping or "Traversable" as replace values, got "%s".', \is_object($from) ? \get_class($from) : \gettype($from))); - } - - return strtr($str ?? '', self::toArray($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 - * - * @internal - */ - public static function 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; - } - - /** - * Formats a number. - * - * 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|null $decimal the number of decimal points to display - * @param string|null $decimalPoint the character(s) to use for the decimal point - * @param string|null $thousandSep the character(s) to use for the thousands separator - */ - public function formatNumber($number, $decimal = null, $decimalPoint = null, $thousandSep = null): string - { - $defaults = $this->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 - * - * @internal - */ - public static function urlencode($url): string - { - if (\is_array($url)) { - return http_build_query($url, '', '&', \PHP_QUERY_RFC3986); - } - - return rawurlencode($url ?? ''); - } - - /** - * Merges any number of arrays or Traversable objects. - * - * {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} - * - * {% set items = items|merge({ 'peugeot': 'car' }, { 'banana': 'fruit' }) %} - * - * {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car', 'banana': 'fruit' } #} - * - * @param array|\Traversable ...$arrays Any number of arrays or Traversable objects to merge - * - * @internal - */ - public static function merge(...$arrays): array - { - $result = []; - - foreach ($arrays as $argNumber => $array) { - if (!is_iterable($array)) { - throw new RuntimeError(\sprintf('The merge filter only works with sequences/mappings or "Traversable", got "%s" for argument %d.', \gettype($array), $argNumber + 1)); - } - - $result = array_merge($result, self::toArray($array)); - } - - return $result; - } - - /** - * 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 - * - * @internal - */ - public static function slice(string $charset, $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, $length ?? -1), $preserveKeys); - } catch (\OutOfBoundsException $e) { - return []; - } - } - - $item = iterator_to_array($item, $preserveKeys); - } - - if (\is_array($item)) { - return \array_slice($item, $start, $length, $preserveKeys); - } - - return mb_substr((string) $item, $start, $length, $charset); - } - - /** - * Returns the first element of the item. - * - * @param mixed $item A variable - * - * @return mixed The first element of the item - * - * @internal - */ - public static function first(string $charset, $item) - { - $elements = self::slice($charset, $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 - * - * @internal - */ - public static function last(string $charset, $item) - { - $elements = self::slice($charset, $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 - * - * @internal - */ - public static function join($value, $glue = '', $and = null): string - { - if (!is_iterable($value)) { - $value = (array) $value; - } - - $value = self::toArray($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|null $limit The limit - * - * @internal - */ - public static function split(string $charset, $value, $delimiter, $limit = null): array - { - $value = $value ?? ''; - - if ('' !== $delimiter) { - return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); - } - - if ($limit <= 1) { - return preg_split('/(?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 - * - * @internal - */ - public static function reverse(string $charset, $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; - - if ('UTF-8' !== $charset) { - $string = self::convertEncoding($string, 'UTF-8', $charset); - } - - preg_match_all('/./us', $string, $matches); - - $string = implode('', array_reverse($matches[0])); - - if ('UTF-8' !== $charset) { - $string = self::convertEncoding($string, $charset, 'UTF-8'); - } - - return $string; - } - - /** - * Shuffles an array, a \Traversable instance, or a string. - * The function does not preserve keys. - * - * @param array|\Traversable|string|null $item - * - * @return mixed - * - * @internal - */ - public static function shuffle(string $charset, $item) - { - if (\is_string($item)) { - if ('UTF-8' !== $charset) { - $item = self::convertEncoding($item, 'UTF-8', $charset); - } - - $item = preg_split('/(? 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; - } - - /** - * @throws RuntimeError When an invalid pattern is used - * - * @internal - */ - public static function matches(string $regexp, ?string $str): int - { - set_error_handler(function ($t, $m) use ($regexp) { - throw new RuntimeError(\sprintf('Regexp "%s" passed to "matches" is not valid', $regexp).substr($m, 12)); - }); - try { - return preg_match($regexp, $str ?? ''); - } finally { - restore_error_handler(); - } - } - - /** - * Returns a trimmed string. - * - * @param string|null $string - * @param string|null $characterMask - * @param string $side - * - * @throws RuntimeError When an invalid trimming side is used (not a string or not 'left', 'right', or 'both') - * - * @internal - */ - public static function trim($string, $characterMask = null, $side = 'both'): string - { - 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 - * - * @internal - */ - public static function nl2br($string): string - { - return nl2br($string ?? ''); - } - - /** - * Removes whitespaces between HTML tags. - * - * @param string|null $content - * - * @internal - */ - public static function spaceless($content): string - { - return trim(preg_replace('/>\s+<', $content ?? '')); - } - - /** - * @param string|null $string - * @param string $to - * @param string $from - * - * @internal - */ - public static function convertEncoding($string, $to, $from): string - { - 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 - * - * @internal - */ - public static function length(string $charset, $thing): int - { - if (null === $thing) { - return 0; - } - - if (\is_scalar($thing)) { - return mb_strlen($thing, $charset); - } - - if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) { - return \count($thing); - } - - if ($thing instanceof \Traversable) { - return iterator_count($thing); - } - - if ($thing instanceof \Stringable) { - return mb_strlen((string) $thing, $charset); - } - - return 1; - } - - /** - * Converts a string to uppercase. - * - * @param string|null $string A string - * - * @internal - */ - public static function upper(string $charset, $string): string - { - return mb_strtoupper($string ?? '', $charset); - } - - /** - * Converts a string to lowercase. - * - * @param string|null $string A string - * - * @internal - */ - public static function lower(string $charset, $string): string - { - return mb_strtolower($string ?? '', $charset); - } - - /** - * Strips HTML and PHP tags from a string. - * - * @param string|null $string - * @param string[]|string|null $allowable_tags - * - * @internal - */ - public static function striptags($string, $allowable_tags = null): string - { - return strip_tags($string ?? '', $allowable_tags); - } - - /** - * Returns a titlecased string. - * - * @param string|null $string A string - * - * @internal - */ - public static function titleCase(string $charset, $string): string - { - return mb_convert_case($string ?? '', \MB_CASE_TITLE, $charset); - } - - /** - * Returns a capitalized string. - * - * @param string|null $string A string - * - * @internal - */ - public static function capitalize(string $charset, $string): string - { - return mb_strtoupper(mb_substr($string ?? '', 0, 1, $charset), $charset).mb_strtolower(mb_substr($string ?? '', 1, null, $charset), $charset); - } - - /** - * @internal - */ - public static function callMacro(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); - } - - /** - * @template TSequence - * - * @param TSequence $seq - * - * @return ($seq is iterable ? TSequence : array{}) - * - * @internal - */ - public static function ensureTraversable($seq) - { - if (is_iterable($seq)) { - return $seq; - } - - return []; - } - - /** - * @internal - */ - public static function toArray($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 - * - * @internal - */ - public static function testEmpty($value): bool - { - if ($value instanceof \Countable) { - return 0 === \count($value); - } - - if ($value instanceof \Traversable) { - return !iterator_count($value); - } - - if ($value instanceof \Stringable) { - return '' === (string) $value; - } - - return '' === $value || false === $value || null === $value || [] === $value; - } - - /** - * Checks if a variable is a sequence. - * - * {# evaluates to true if the foo variable is a sequence #} - * {% if foo is sequence %} - * {# ... #} - * {% endif %} - * - * @param mixed $value - * - * @internal - */ - public static function testSequence($value): bool - { - if ($value instanceof \ArrayObject) { - $value = $value->getArrayCopy(); - } - - if ($value instanceof \Traversable) { - $value = iterator_to_array($value); - } - - return \is_array($value) && array_is_list($value); - } - - /** - * Checks if a variable is a mapping. - * - * {# evaluates to true if the foo variable is a mapping #} - * {% if foo is mapping %} - * {# ... #} - * {% endif %} - * - * @param mixed $value - * - * @internal - */ - public static function testMapping($value): bool - { - if ($value instanceof \ArrayObject) { - $value = $value->getArrayCopy(); - } - - if ($value instanceof \Traversable) { - $value = iterator_to_array($value); - } - - return (\is_array($value) && !array_is_list($value)) || \is_object($value); - } - - /** - * Renders a template. - * - * @param array $context - * @param string|array|TemplateWrapper $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 - * - * @internal - */ - public static function include(Environment $env, $context, $template, $variables = [], $withContext = true, $ignoreMissing = false, $sandboxed = false): string - { - $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(); - } - } - - try { - $loaded = null; - try { - $loaded = $env->resolveTemplate($template); - } catch (LoaderError $e) { - if (!$ignoreMissing) { - throw $e; - } - - return ''; - } - - if ($isSandboxed) { - $loaded->unwrap()->checkSecurity(); - } - - return $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 - * - * @internal - */ - public static function source(Environment $env, $name, $ignoreMissing = false): string - { - $loader = $env->getLoader(); - try { - return $loader->getSourceContext($name)->getCode(); - } catch (LoaderError $e) { - if (!$ignoreMissing) { - throw $e; - } - - return ''; - } - } - - /** - * Returns the list of cases of the enum. - * - * @template T of \UnitEnum - * - * @param class-string $enum - * - * @return list - * - * @internal - */ - public static function enumCases(string $enum): array - { - if (!enum_exists($enum)) { - throw new RuntimeError(\sprintf('Enum "%s" does not exist.', $enum)); - } - - return $enum::cases(); - } - - /** - * 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 - * @param bool $checkDefined Whether to check if the constant is defined or not - * - * @return mixed Class constants can return many types like scalars, arrays, and - * objects depending on the PHP version (\BackedEnum, \UnitEnum, etc.) - * When $checkDefined is true, returns true when the constant is defined, false otherwise - * - * @internal - */ - public static function constant($constant, $object = null, bool $checkDefined = false) - { - if (null !== $object) { - if ('class' === $constant) { - return $checkDefined ? true : \get_class($object); - } - - $constant = \get_class($object).'::'.$constant; - } - - if (!\defined($constant)) { - if ($checkDefined) { - return false; - } - - if ('::class' === strtolower(substr($constant, -7))) { - throw new RuntimeError(\sprintf('You cannot use the Twig function "constant()" to access "%s". You could provide an object and call constant("class", $object) or use the class name directly as a string.', $constant)); - } - - throw new RuntimeError(\sprintf('Constant "%s" is undefined.', $constant)); - } - - return $checkDefined ? true : \constant($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 - * - * @internal - */ - public static function batch($items, $size, $fill = null, $preserveKeys = true): array - { - if (!is_iterable($items)) { - throw new RuntimeError(\sprintf('The "batch" filter expects a sequence/mapping or "Traversable", got "%s".', \is_object($items) ? \get_class($items) : \gettype($items))); - } - - $size = (int) ceil($size); - - $result = array_chunk(self::toArray($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 - */ - public static function getAttribute(Environment $env, Source $source, $object, $item, array $arguments = [], $type = Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false, $sandboxed = false, int $lineno = -1) - { - // array - if (Template::METHOD_CALL !== $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 === $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 sequence/mapping is empty.', $arrayItem); - } else { - $message = \sprintf('Key "%s" for sequence/mapping with keys "%s" does not exist.', $arrayItem, implode(', ', array_keys($object))); - } - } elseif (Template::ARRAY_CALL === $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 a sequence/mapping.', $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 !== $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] && str_starts_with($lcName, 'get')) { - $name = substr($method, 3); - $lcName = substr($lcName, 3); - } elseif ('i' === $lcName[0] && str_starts_with($lcName, 'is')) { - $name = substr($method, 2); - $lcName = substr($lcName, 2); - } elseif ('h' === $lcName[0] && str_starts_with($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 int|string $name The column name - * @param int|string|null $index The column to use as the index/keys for the returned array - * - * @return array The array of values - * - * @internal - */ - public static function 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 sequences/mappings or "Traversable", got "%s" as first argument.', \gettype($array))); - } - - return array_column($array, $name, $index); - } - - /** - * @internal - */ - public static function filter(Environment $env, $array, $arrow) - { - if (!is_iterable($array)) { - throw new RuntimeError(\sprintf('The "filter" filter expects a sequence/mapping or "Traversable", got "%s".', \is_object($array) ? \get_class($array) : \gettype($array))); - } - - self::checkArrowInSandbox($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); - } - - /** - * @internal - */ - public static function find(Environment $env, $array, $arrow) - { - self::checkArrowInSandbox($env, $arrow, 'find', 'filter'); - - foreach ($array as $k => $v) { - if ($arrow($v, $k)) { - return $v; - } - } - - return null; - } - - /** - * @internal - */ - public static function map(Environment $env, $array, $arrow) - { - if (!is_iterable($array)) { - throw new RuntimeError(\sprintf('The "map" filter expects a sequence/mapping or "Traversable", got "%s".', get_debug_type($array))); - } - - self::checkArrowInSandbox($env, $arrow, 'map', 'filter'); - - $r = []; - foreach ($array as $k => $v) { - $r[$k] = $arrow($v, $k); - } - - return $r; - } - - /** - * @internal - */ - public static function reduce(Environment $env, $array, $arrow, $initial = null) - { - self::checkArrowInSandbox($env, $arrow, 'reduce', 'filter'); - - if (!\is_array($array) && !$array instanceof \Traversable) { - throw new RuntimeError(\sprintf('The "reduce" filter only works with sequences/mappings or "Traversable", got "%s" as first argument.', \gettype($array))); - } - - $accumulator = $initial; - foreach ($array as $key => $value) { - $accumulator = $arrow($accumulator, $value, $key); - } - - return $accumulator; - } - - /** - * @internal - */ - public static function arraySome(Environment $env, $array, $arrow) - { - self::checkArrowInSandbox($env, $arrow, 'has some', 'operator'); - - foreach ($array as $k => $v) { - if ($arrow($v, $k)) { - return true; - } - } - - return false; - } - - /** - * @internal - */ - public static function arrayEvery(Environment $env, $array, $arrow) - { - self::checkArrowInSandbox($env, $arrow, 'has every', 'operator'); - - foreach ($array as $k => $v) { - if (!$arrow($v, $k)) { - return false; - } - } - - return true; - } - - /** - * @internal - */ - public static function checkArrowInSandbox(Environment $env, $arrow, $thing, $type) - { - if (!$arrow instanceof \Closure && $env->hasExtension(SandboxExtension::class) && $env->getExtension(SandboxExtension::class)->isSandboxed()) { - throw new RuntimeError(\sprintf('The callable passed to the "%s" %s must be a Closure in sandbox mode.', $thing, $type)); - } - } - - /** - * @internal to be removed in Twig 4 - */ - public static function captureOutput(iterable $body): string - { - $level = ob_get_level(); - ob_start(); - - try { - foreach ($body as $data) { - echo $data; - } - } catch (\Throwable $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - /** - * @internal - */ - public static function parseParentFunction(Parser $parser, Node $fakeNode, $args, int $line): AbstractExpression - { - if (!$blockName = $parser->peekBlockStack()) { - throw new SyntaxError('Calling the "parent" function outside of a block is forbidden.', $line, $parser->getStream()->getSourceContext()); - } - - if (!$parser->hasInheritance()) { - throw new SyntaxError('Calling the "parent" function on a template that does not call "extends" or "use" is forbidden.', $line, $parser->getStream()->getSourceContext()); - } - - return new ParentExpression($blockName, $line); - } - - /** - * @internal - */ - public static function parseBlockFunction(Parser $parser, Node $fakeNode, $args, int $line): AbstractExpression - { - $fakeFunction = new TwigFunction('block', fn ($name, $template = null) => null); - $args = (new CallableArgumentsExtractor($fakeNode, $fakeFunction))->extractArguments($args); - - return new BlockReferenceExpression($args[0], $args[1] ?? null, $line); - } - - /** - * @internal - */ - public static function parseAttributeFunction(Parser $parser, Node $fakeNode, $args, int $line): AbstractExpression - { - $fakeFunction = new TwigFunction('attribute', fn ($variable, $attribute, $arguments = null) => null); - $args = (new CallableArgumentsExtractor($fakeNode, $fakeFunction))->extractArguments($args); - - return new GetAttrExpression($args[0], $args[1], $args[2] ?? null, Template::ANY_CALL, $line); - } -} +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 TypesTokenParser(), + new FlushTokenParser(), + new DoTokenParser(), + new EmbedTokenParser(), + new WithTokenParser(), + new DeprecatedTokenParser(), + ]; + } + + public function getFilters(): array + { + return [ + // formatting filters + new TwigFilter('date', [$this, 'formatDate']), + new TwigFilter('date_modify', [$this, 'modifyDate']), + new TwigFilter('format', [self::class, 'sprintf']), + new TwigFilter('replace', [self::class, 'replace']), + new TwigFilter('number_format', [$this, 'formatNumber']), + new TwigFilter('abs', 'abs'), + new TwigFilter('round', [self::class, 'round']), + + // encoding + new TwigFilter('url_encode', [self::class, 'urlencode']), + new TwigFilter('json_encode', 'json_encode'), + new TwigFilter('convert_encoding', [self::class, 'convertEncoding']), + + // string filters + new TwigFilter('title', [self::class, 'titleCase'], ['needs_charset' => true]), + new TwigFilter('capitalize', [self::class, 'capitalize'], ['needs_charset' => true]), + new TwigFilter('upper', [self::class, 'upper'], ['needs_charset' => true]), + new TwigFilter('lower', [self::class, 'lower'], ['needs_charset' => true]), + new TwigFilter('striptags', [self::class, 'striptags']), + new TwigFilter('trim', [self::class, 'trim']), + new TwigFilter('nl2br', [self::class, 'nl2br'], ['pre_escape' => 'html', 'is_safe' => ['html']]), + new TwigFilter('spaceless', [self::class, 'spaceless'], ['is_safe' => ['html'], 'deprecated' => '3.12', 'deprecating_package' => 'twig/twig']), + + // array helpers + new TwigFilter('join', [self::class, 'join']), + new TwigFilter('split', [self::class, 'split'], ['needs_charset' => true]), + new TwigFilter('sort', [self::class, 'sort'], ['needs_environment' => true]), + new TwigFilter('merge', [self::class, 'merge']), + new TwigFilter('batch', [self::class, 'batch']), + new TwigFilter('column', [self::class, 'column']), + new TwigFilter('filter', [self::class, 'filter'], ['needs_environment' => true]), + new TwigFilter('map', [self::class, 'map'], ['needs_environment' => true]), + new TwigFilter('reduce', [self::class, 'reduce'], ['needs_environment' => true]), + new TwigFilter('find', [self::class, 'find'], ['needs_environment' => true]), + + // string/array filters + new TwigFilter('reverse', [self::class, 'reverse'], ['needs_charset' => true]), + new TwigFilter('shuffle', [self::class, 'shuffle'], ['needs_charset' => true]), + new TwigFilter('length', [self::class, 'length'], ['needs_charset' => true]), + new TwigFilter('slice', [self::class, 'slice'], ['needs_charset' => true]), + new TwigFilter('first', [self::class, 'first'], ['needs_charset' => true]), + new TwigFilter('last', [self::class, 'last'], ['needs_charset' => true]), + + // iteration and runtime + new TwigFilter('default', [self::class, 'default'], ['node_class' => DefaultFilter::class]), + new TwigFilter('keys', [self::class, 'keys']), + ]; + } + + public function getFunctions(): array + { + return [ + new TwigFunction('parent', null, ['parser_callable' => [self::class, 'parseParentFunction']]), + new TwigFunction('block', null, ['parser_callable' => [self::class, 'parseBlockFunction']]), + new TwigFunction('attribute', null, ['parser_callable' => [self::class, 'parseAttributeFunction']]), + new TwigFunction('max', 'max'), + new TwigFunction('min', 'min'), + new TwigFunction('range', 'range'), + new TwigFunction('constant', [self::class, 'constant']), + new TwigFunction('cycle', [self::class, 'cycle']), + new TwigFunction('random', [self::class, 'random'], ['needs_charset' => true]), + new TwigFunction('date', [$this, 'convertDate']), + new TwigFunction('include', [self::class, 'include'], ['needs_environment' => true, 'needs_context' => true, 'is_safe' => ['all']]), + new TwigFunction('source', [self::class, 'source'], ['needs_environment' => true, 'is_safe' => ['all']]), + new TwigFunction('enum_cases', [self::class, 'enumCases'], ['node_class' => EnumCasesFunction::class]), + ]; + } + + 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', [self::class, 'testEmpty']), + new TwigTest('iterable', 'is_iterable'), + new TwigTest('sequence', [self::class, 'testSequence']), + new TwigTest('mapping', [self::class, 'testMapping']), + ]; + } + + 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], + 'has some' => ['precedence' => 20, 'class' => HasSomeBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'has every' => ['precedence' => 20, 'class' => HasEveryBinary::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], + ], + ]; + } + + /** + * Cycles over a sequence. + * + * @param array|\ArrayAccess $values A non-empty sequence of values + * @param positive-int $position The position of the value to return in the cycle + * + * @return mixed The value at the given position in the sequence, wrapping around as needed + * + * @internal + */ + public static function cycle($values, $position): mixed + { + if (!\is_array($values)) { + if (!$values instanceof \ArrayAccess) { + throw new RuntimeError('The "cycle" function expects an array or "ArrayAccess" as first argument.'); + } + + if (!is_countable($values)) { + // To be uncommented in 4.0 + // throw new RuntimeError('The "cycle" function expects a countable sequence as first argument.'); + + trigger_deprecation('twig/twig', '3.12', 'Passing a non-countable sequence of values to "%s()" is deprecated.', __METHOD__); + + return $values; + } + + $values = self::toArray($values, false); + } + + if (!$count = \count($values)) { + throw new RuntimeError('The "cycle" function does not work on empty sequences.'); + } + + return $values[$position % $count]; + } + + /** + * 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 + * + * @return mixed A random value from the given sequence + * + * @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is) + * + * @internal + */ + public static function random(string $charset, $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; + } + + return mt_rand((int) $min, (int) $max); + } + + if (\is_string($values)) { + if ('' === $values) { + return ''; + } + + if ('UTF-8' !== $charset) { + $values = self::convertEncoding($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] = self::convertEncoding($value, $charset, 'UTF-8'); + } + } + } + + if (!is_iterable($values)) { + return $values; + } + + $values = self::toArray($values); + + if (0 === \count($values)) { + throw new RuntimeError('The random function cannot pick from an empty sequence/mapping.'); + } + + return $values[array_rand($values, 1)]; + } + + /** + * Formats a date. + * + * {{ 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 + */ + public function formatDate($date, $format = null, $timezone = null): string + { + if (null === $format) { + $formats = $this->getDateFormat(); + $format = $date instanceof \DateInterval ? $formats[1] : $formats[0]; + } + + if ($date instanceof \DateInterval) { + return $date->format($format); + } + + return $this->convertDate($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 \DateTime|\DateTimeImmutable + * + * @internal + */ + public function modifyDate($date, $modifier) + { + return $this->convertDate($date, false)->modify($modifier); + } + + /** + * Returns a formatted string. + * + * @param string|null $format + * @param ...$values + * + * @internal + */ + public static function sprintf($format, ...$values): string + { + return \sprintf($format ?? '', ...$values); + } + + /** + * @internal + */ + public static function dateConverter(Environment $env, $date, $format = null, $timezone = null): string + { + return $env->getExtension(self::class)->formatDate($date, $format, $timezone); + } + + /** + * 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 \DateTime|\DateTimeImmutable + */ + public function convertDate($date = null, $timezone = null) + { + // determine the timezone + if (false !== $timezone) { + if (null === $timezone) { + $timezone = $this->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 \DateTime) { + $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 : $this->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, $this->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 + * + * @internal + */ + public static function replace($str, $from): string + { + if (!is_iterable($from)) { + throw new RuntimeError(\sprintf('The "replace" filter expects a sequence/mapping or "Traversable" as replace values, got "%s".', \is_object($from) ? \get_class($from) : \gettype($from))); + } + + return strtr($str ?? '', self::toArray($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 + * + * @internal + */ + public static function 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; + } + + /** + * Formats a number. + * + * 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|null $decimal the number of decimal points to display + * @param string|null $decimalPoint the character(s) to use for the decimal point + * @param string|null $thousandSep the character(s) to use for the thousands separator + */ + public function formatNumber($number, $decimal = null, $decimalPoint = null, $thousandSep = null): string + { + $defaults = $this->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 + * + * @internal + */ + public static function urlencode($url): string + { + if (\is_array($url)) { + return http_build_query($url, '', '&', \PHP_QUERY_RFC3986); + } + + return rawurlencode($url ?? ''); + } + + /** + * Merges any number of arrays or Traversable objects. + * + * {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} + * + * {% set items = items|merge({ 'peugeot': 'car' }, { 'banana': 'fruit' }) %} + * + * {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car', 'banana': 'fruit' } #} + * + * @param array|\Traversable ...$arrays Any number of arrays or Traversable objects to merge + * + * @internal + */ + public static function merge(...$arrays): array + { + $result = []; + + foreach ($arrays as $argNumber => $array) { + if (!is_iterable($array)) { + throw new RuntimeError(\sprintf('The merge filter only works with sequences/mappings or "Traversable", got "%s" for argument %d.', \gettype($array), $argNumber + 1)); + } + + $result = array_merge($result, self::toArray($array)); + } + + return $result; + } + + /** + * 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 + * + * @internal + */ + public static function slice(string $charset, $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, $length ?? -1), $preserveKeys); + } catch (\OutOfBoundsException $e) { + return []; + } + } + + $item = iterator_to_array($item, $preserveKeys); + } + + if (\is_array($item)) { + return \array_slice($item, $start, $length, $preserveKeys); + } + + return mb_substr((string) $item, $start, $length, $charset); + } + + /** + * Returns the first element of the item. + * + * @param mixed $item A variable + * + * @return mixed The first element of the item + * + * @internal + */ + public static function first(string $charset, $item) + { + $elements = self::slice($charset, $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 + * + * @internal + */ + public static function last(string $charset, $item) + { + $elements = self::slice($charset, $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 + * + * @internal + */ + public static function join($value, $glue = '', $and = null): string + { + if (!is_iterable($value)) { + $value = (array) $value; + } + + $value = self::toArray($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|null $limit The limit + * + * @internal + */ + public static function split(string $charset, $value, $delimiter, $limit = null): array + { + $value = $value ?? ''; + + if ('' !== $delimiter) { + return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); + } + + if ($limit <= 1) { + return preg_split('/(?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 + * + * @internal + */ + public static function reverse(string $charset, $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; + + if ('UTF-8' !== $charset) { + $string = self::convertEncoding($string, 'UTF-8', $charset); + } + + preg_match_all('/./us', $string, $matches); + + $string = implode('', array_reverse($matches[0])); + + if ('UTF-8' !== $charset) { + $string = self::convertEncoding($string, $charset, 'UTF-8'); + } + + return $string; + } + + /** + * Shuffles an array, a \Traversable instance, or a string. + * The function does not preserve keys. + * + * @param array|\Traversable|string|null $item + * + * @return mixed + * + * @internal + */ + public static function shuffle(string $charset, $item) + { + if (\is_string($item)) { + if ('UTF-8' !== $charset) { + $item = self::convertEncoding($item, 'UTF-8', $charset); + } + + $item = preg_split('/(? 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; + } + + /** + * @throws RuntimeError When an invalid pattern is used + * + * @internal + */ + public static function matches(string $regexp, ?string $str): int + { + set_error_handler(function ($t, $m) use ($regexp) { + throw new RuntimeError(\sprintf('Regexp "%s" passed to "matches" is not valid', $regexp).substr($m, 12)); + }); + try { + return preg_match($regexp, $str ?? ''); + } finally { + restore_error_handler(); + } + } + + /** + * Returns a trimmed string. + * + * @param string|null $string + * @param string|null $characterMask + * @param string $side + * + * @throws RuntimeError When an invalid trimming side is used (not a string or not 'left', 'right', or 'both') + * + * @internal + */ + public static function trim($string, $characterMask = null, $side = 'both'): string + { + 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 + * + * @internal + */ + public static function nl2br($string): string + { + return nl2br($string ?? ''); + } + + /** + * Removes whitespaces between HTML tags. + * + * @param string|null $content + * + * @internal + */ + public static function spaceless($content): string + { + return trim(preg_replace('/>\s+<', $content ?? '')); + } + + /** + * @param string|null $string + * @param string $to + * @param string $from + * + * @internal + */ + public static function convertEncoding($string, $to, $from): string + { + 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 + * + * @internal + */ + public static function length(string $charset, $thing): int + { + if (null === $thing) { + return 0; + } + + if (\is_scalar($thing)) { + return mb_strlen($thing, $charset); + } + + if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) { + return \count($thing); + } + + if ($thing instanceof \Traversable) { + return iterator_count($thing); + } + + if ($thing instanceof \Stringable) { + return mb_strlen((string) $thing, $charset); + } + + return 1; + } + + /** + * Converts a string to uppercase. + * + * @param string|null $string A string + * + * @internal + */ + public static function upper(string $charset, $string): string + { + return mb_strtoupper($string ?? '', $charset); + } + + /** + * Converts a string to lowercase. + * + * @param string|null $string A string + * + * @internal + */ + public static function lower(string $charset, $string): string + { + return mb_strtolower($string ?? '', $charset); + } + + /** + * Strips HTML and PHP tags from a string. + * + * @param string|null $string + * @param string[]|string|null $allowable_tags + * + * @internal + */ + public static function striptags($string, $allowable_tags = null): string + { + return strip_tags($string ?? '', $allowable_tags); + } + + /** + * Returns a titlecased string. + * + * @param string|null $string A string + * + * @internal + */ + public static function titleCase(string $charset, $string): string + { + return mb_convert_case($string ?? '', \MB_CASE_TITLE, $charset); + } + + /** + * Returns a capitalized string. + * + * @param string|null $string A string + * + * @internal + */ + public static function capitalize(string $charset, $string): string + { + return mb_strtoupper(mb_substr($string ?? '', 0, 1, $charset), $charset).mb_strtolower(mb_substr($string ?? '', 1, null, $charset), $charset); + } + + /** + * @internal + */ + public static function callMacro(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); + } + + /** + * @template TSequence + * + * @param TSequence $seq + * + * @return ($seq is iterable ? TSequence : array{}) + * + * @internal + */ + public static function ensureTraversable($seq) + { + if (is_iterable($seq)) { + return $seq; + } + + return []; + } + + /** + * @internal + */ + public static function toArray($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 + * + * @internal + */ + public static function testEmpty($value): bool + { + if ($value instanceof \Countable) { + return 0 === \count($value); + } + + if ($value instanceof \Traversable) { + return !iterator_count($value); + } + + if ($value instanceof \Stringable) { + return '' === (string) $value; + } + + return '' === $value || false === $value || null === $value || [] === $value; + } + + /** + * Checks if a variable is a sequence. + * + * {# evaluates to true if the foo variable is a sequence #} + * {% if foo is sequence %} + * {# ... #} + * {% endif %} + * + * @param mixed $value + * + * @internal + */ + public static function testSequence($value): bool + { + if ($value instanceof \ArrayObject) { + $value = $value->getArrayCopy(); + } + + if ($value instanceof \Traversable) { + $value = iterator_to_array($value); + } + + return \is_array($value) && array_is_list($value); + } + + /** + * Checks if a variable is a mapping. + * + * {# evaluates to true if the foo variable is a mapping #} + * {% if foo is mapping %} + * {# ... #} + * {% endif %} + * + * @param mixed $value + * + * @internal + */ + public static function testMapping($value): bool + { + if ($value instanceof \ArrayObject) { + $value = $value->getArrayCopy(); + } + + if ($value instanceof \Traversable) { + $value = iterator_to_array($value); + } + + return (\is_array($value) && !array_is_list($value)) || \is_object($value); + } + + /** + * Renders a template. + * + * @param array $context + * @param string|array|TemplateWrapper $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 + * + * @internal + */ + public static function include(Environment $env, $context, $template, $variables = [], $withContext = true, $ignoreMissing = false, $sandboxed = false): string + { + $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(); + } + } + + try { + $loaded = null; + try { + $loaded = $env->resolveTemplate($template); + } catch (LoaderError $e) { + if (!$ignoreMissing) { + throw $e; + } + + return ''; + } + + if ($isSandboxed) { + $loaded->unwrap()->checkSecurity(); + } + + return $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 + * + * @internal + */ + public static function source(Environment $env, $name, $ignoreMissing = false): string + { + $loader = $env->getLoader(); + try { + return $loader->getSourceContext($name)->getCode(); + } catch (LoaderError $e) { + if (!$ignoreMissing) { + throw $e; + } + + return ''; + } + } + + /** + * Returns the list of cases of the enum. + * + * @template T of \UnitEnum + * + * @param class-string $enum + * + * @return list + * + * @internal + */ + public static function enumCases(string $enum): array + { + if (!enum_exists($enum)) { + throw new RuntimeError(\sprintf('Enum "%s" does not exist.', $enum)); + } + + return $enum::cases(); + } + + /** + * 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 + * @param bool $checkDefined Whether to check if the constant is defined or not + * + * @return mixed Class constants can return many types like scalars, arrays, and + * objects depending on the PHP version (\BackedEnum, \UnitEnum, etc.) + * When $checkDefined is true, returns true when the constant is defined, false otherwise + * + * @internal + */ + public static function constant($constant, $object = null, bool $checkDefined = false) + { + if (null !== $object) { + if ('class' === $constant) { + return $checkDefined ? true : \get_class($object); + } + + $constant = \get_class($object).'::'.$constant; + } + + if (!\defined($constant)) { + if ($checkDefined) { + return false; + } + + if ('::class' === strtolower(substr($constant, -7))) { + throw new RuntimeError(\sprintf('You cannot use the Twig function "constant()" to access "%s". You could provide an object and call constant("class", $object) or use the class name directly as a string.', $constant)); + } + + throw new RuntimeError(\sprintf('Constant "%s" is undefined.', $constant)); + } + + return $checkDefined ? true : \constant($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 + * + * @internal + */ + public static function batch($items, $size, $fill = null, $preserveKeys = true): array + { + if (!is_iterable($items)) { + throw new RuntimeError(\sprintf('The "batch" filter expects a sequence/mapping or "Traversable", got "%s".', \is_object($items) ? \get_class($items) : \gettype($items))); + } + + $size = (int) ceil($size); + + $result = array_chunk(self::toArray($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 + */ + public static function getAttribute(Environment $env, Source $source, $object, $item, array $arguments = [], $type = Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false, $sandboxed = false, int $lineno = -1) + { + // array + if (Template::METHOD_CALL !== $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 === $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 sequence/mapping is empty.', $arrayItem); + } else { + $message = \sprintf('Key "%s" for sequence/mapping with keys "%s" does not exist.', $arrayItem, implode(', ', array_keys($object))); + } + } elseif (Template::ARRAY_CALL === $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 a sequence/mapping.', $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 !== $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] && str_starts_with($lcName, 'get')) { + $name = substr($method, 3); + $lcName = substr($lcName, 3); + } elseif ('i' === $lcName[0] && str_starts_with($lcName, 'is')) { + $name = substr($method, 2); + $lcName = substr($lcName, 2); + } elseif ('h' === $lcName[0] && str_starts_with($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 int|string $name The column name + * @param int|string|null $index The column to use as the index/keys for the returned array + * + * @return array The array of values + * + * @internal + */ + public static function 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 sequences/mappings or "Traversable", got "%s" as first argument.', \gettype($array))); + } + + return array_column($array, $name, $index); + } + + /** + * @internal + */ + public static function filter(Environment $env, $array, $arrow) + { + if (!is_iterable($array)) { + throw new RuntimeError(\sprintf('The "filter" filter expects a sequence/mapping or "Traversable", got "%s".', \is_object($array) ? \get_class($array) : \gettype($array))); + } + + self::checkArrowInSandbox($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); + } + + /** + * @internal + */ + public static function find(Environment $env, $array, $arrow) + { + self::checkArrowInSandbox($env, $arrow, 'find', 'filter'); + + foreach ($array as $k => $v) { + if ($arrow($v, $k)) { + return $v; + } + } + + return null; + } + + /** + * @internal + */ + public static function map(Environment $env, $array, $arrow) + { + if (!is_iterable($array)) { + throw new RuntimeError(\sprintf('The "map" filter expects a sequence/mapping or "Traversable", got "%s".', get_debug_type($array))); + } + + self::checkArrowInSandbox($env, $arrow, 'map', 'filter'); + + $r = []; + foreach ($array as $k => $v) { + $r[$k] = $arrow($v, $k); + } + + return $r; + } + + /** + * @internal + */ + public static function reduce(Environment $env, $array, $arrow, $initial = null) + { + self::checkArrowInSandbox($env, $arrow, 'reduce', 'filter'); + + if (!\is_array($array) && !$array instanceof \Traversable) { + throw new RuntimeError(\sprintf('The "reduce" filter only works with sequences/mappings or "Traversable", got "%s" as first argument.', \gettype($array))); + } + + $accumulator = $initial; + foreach ($array as $key => $value) { + $accumulator = $arrow($accumulator, $value, $key); + } + + return $accumulator; + } + + /** + * @internal + */ + public static function arraySome(Environment $env, $array, $arrow) + { + self::checkArrowInSandbox($env, $arrow, 'has some', 'operator'); + + foreach ($array as $k => $v) { + if ($arrow($v, $k)) { + return true; + } + } + + return false; + } + + /** + * @internal + */ + public static function arrayEvery(Environment $env, $array, $arrow) + { + self::checkArrowInSandbox($env, $arrow, 'has every', 'operator'); + + foreach ($array as $k => $v) { + if (!$arrow($v, $k)) { + return false; + } + } + + return true; + } + + /** + * @internal + */ + public static function checkArrowInSandbox(Environment $env, $arrow, $thing, $type) + { + if (!$arrow instanceof \Closure && $env->hasExtension(SandboxExtension::class) && $env->getExtension(SandboxExtension::class)->isSandboxed()) { + throw new RuntimeError(\sprintf('The callable passed to the "%s" %s must be a Closure in sandbox mode.', $thing, $type)); + } + } + + /** + * @internal to be removed in Twig 4 + */ + public static function captureOutput(iterable $body): string + { + $level = ob_get_level(); + ob_start(); + + try { + foreach ($body as $data) { + echo $data; + } + } catch (\Throwable $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } + + return ob_get_clean(); + } + + /** + * @internal + */ + public static function parseParentFunction(Parser $parser, Node $fakeNode, $args, int $line): AbstractExpression + { + if (!$blockName = $parser->peekBlockStack()) { + throw new SyntaxError('Calling the "parent" function outside of a block is forbidden.', $line, $parser->getStream()->getSourceContext()); + } + + if (!$parser->hasInheritance()) { + throw new SyntaxError('Calling the "parent" function on a template that does not call "extends" or "use" is forbidden.', $line, $parser->getStream()->getSourceContext()); + } + + return new ParentExpression($blockName, $line); + } + + /** + * @internal + */ + public static function parseBlockFunction(Parser $parser, Node $fakeNode, $args, int $line): AbstractExpression + { + $fakeFunction = new TwigFunction('block', fn ($name, $template = null) => null); + $args = (new CallableArgumentsExtractor($fakeNode, $fakeFunction))->extractArguments($args); + + return new BlockReferenceExpression($args[0], $args[1] ?? null, $line); + } + + /** + * @internal + */ + public static function parseAttributeFunction(Parser $parser, Node $fakeNode, $args, int $line): AbstractExpression + { + $fakeFunction = new TwigFunction('attribute', fn ($variable, $attribute, $arguments = null) => null); + $args = (new CallableArgumentsExtractor($fakeNode, $fakeFunction))->extractArguments($args); + + return new GetAttrExpression($args[0], $args[1], $args[2] ?? null, Template::ANY_CALL, $line); + } +} diff --git a/vendor/twig/twig/src/Extension/DebugExtension.php b/vendor/twig/twig/src/Extension/DebugExtension.php index dac21c3..143a75a 100644 --- a/vendor/twig/twig/src/Extension/DebugExtension.php +++ b/vendor/twig/twig/src/Extension/DebugExtension.php @@ -1,62 +1,62 @@ - $isDumpOutputHtmlSafe ? ['html'] : [], 'needs_context' => true, 'needs_environment' => true, 'is_variadic' => true]), - ]; - } - - /** - * @internal - */ - public static function 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(); - } -} + $isDumpOutputHtmlSafe ? ['html'] : [], 'needs_context' => true, 'needs_environment' => true, 'is_variadic' => true]), + ]; + } + + /** + * @internal + */ + public static function 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 index 52531c4..dd6c45f 100644 --- a/vendor/twig/twig/src/Extension/EscaperExtension.php +++ b/vendor/twig/twig/src/Extension/EscaperExtension.php @@ -1,200 +1,200 @@ -setDefaultStrategy($defaultStrategy); - } - - public function getTokenParsers(): array - { - return [new AutoEscapeTokenParser()]; - } - - public function getNodeVisitors(): array - { - return [new EscaperNodeVisitor()]; - } - - public function getFilters(): array - { - return [ - new TwigFilter('escape', [EscaperRuntime::class, 'escape'], ['is_safe_callback' => [self::class, 'escapeFilterIsSafe']]), - new TwigFilter('e', [EscaperRuntime::class, 'escape'], ['is_safe_callback' => [self::class, 'escapeFilterIsSafe']]), - new TwigFilter('raw', null, ['is_safe' => ['all'], 'node_class' => RawFilter::class]), - ]; - } - - /** - * @deprecated since Twig 3.10 - */ - public function setEnvironment(Environment $environment): void - { - $triggerDeprecation = \func_num_args() > 1 ? func_get_arg(1) : true; - if ($triggerDeprecation) { - trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated and not needed if you are using methods from "Twig\Runtime\EscaperRuntime".', __METHOD__); - } - - $this->environment = $environment; - $this->escaper = $environment->getRuntime(EscaperRuntime::class); - } - - /** - * @deprecated since Twig 3.10 - */ - public function setEscaperRuntime(EscaperRuntime $escaper) - { - trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated and not needed if you are using methods from "Twig\Runtime\EscaperRuntime".', __METHOD__); - - $this->escaper = $escaper; - } - - /** - * 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(string $templateName): string $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(Environment, string, string): string $callable A valid PHP callable - * - * @deprecated since Twig 3.10 - */ - public function setEscaper($strategy, callable $callable) - { - trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated, use the "Twig\Runtime\EscaperRuntime::setEscaper()" method instead (be warned that Environment is not passed anymore to the callable).', __METHOD__); - - if (!isset($this->environment)) { - throw new \LogicException(\sprintf('You must call "setEnvironment()" before calling "%s()".', __METHOD__)); - } - - $this->escapers[$strategy] = $callable; - $callable = function ($string, $charset) use ($callable) { - return $callable($this->environment, $string, $charset); - }; - - $this->escaper->setEscaper($strategy, $callable); - } - - /** - * Gets all defined escapers. - * - * @return array An array of escapers - * - * @deprecated since Twig 3.10 - */ - public function getEscapers() - { - trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated, use the "Twig\Runtime\EscaperRuntime::getEscaper()" method instead.', __METHOD__); - - return $this->escapers; - } - - /** - * @deprecated since Twig 3.10 - */ - public function setSafeClasses(array $safeClasses = []) - { - trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated, use the "Twig\Runtime\EscaperRuntime::setSafeClasses()" method instead.', __METHOD__); - - if (!isset($this->escaper)) { - throw new \LogicException(\sprintf('You must call "setEnvironment()" before calling "%s()".', __METHOD__)); - } - - $this->escaper->setSafeClasses($safeClasses); - } - - /** - * @deprecated since Twig 3.10 - */ - public function addSafeClass(string $class, array $strategies) - { - trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated, use the "Twig\Runtime\EscaperRuntime::addSafeClass()" method instead.', __METHOD__); - - if (!isset($this->escaper)) { - throw new \LogicException(\sprintf('You must call "setEnvironment()" before calling "%s()".', __METHOD__)); - } - - $this->escaper->addSafeClass($class, $strategies); - } - - /** - * @internal - */ - public static function escapeFilterIsSafe(Node $filterArgs) - { - foreach ($filterArgs as $arg) { - if ($arg instanceof ConstantExpression) { - return [$arg->getAttribute('value')]; - } - - return []; - } - - return ['html']; - } -} +setDefaultStrategy($defaultStrategy); + } + + public function getTokenParsers(): array + { + return [new AutoEscapeTokenParser()]; + } + + public function getNodeVisitors(): array + { + return [new EscaperNodeVisitor()]; + } + + public function getFilters(): array + { + return [ + new TwigFilter('escape', [EscaperRuntime::class, 'escape'], ['is_safe_callback' => [self::class, 'escapeFilterIsSafe']]), + new TwigFilter('e', [EscaperRuntime::class, 'escape'], ['is_safe_callback' => [self::class, 'escapeFilterIsSafe']]), + new TwigFilter('raw', null, ['is_safe' => ['all'], 'node_class' => RawFilter::class]), + ]; + } + + /** + * @deprecated since Twig 3.10 + */ + public function setEnvironment(Environment $environment): void + { + $triggerDeprecation = \func_num_args() > 1 ? func_get_arg(1) : true; + if ($triggerDeprecation) { + trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated and not needed if you are using methods from "Twig\Runtime\EscaperRuntime".', __METHOD__); + } + + $this->environment = $environment; + $this->escaper = $environment->getRuntime(EscaperRuntime::class); + } + + /** + * @deprecated since Twig 3.10 + */ + public function setEscaperRuntime(EscaperRuntime $escaper) + { + trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated and not needed if you are using methods from "Twig\Runtime\EscaperRuntime".', __METHOD__); + + $this->escaper = $escaper; + } + + /** + * 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(string $templateName): string $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(Environment, string, string): string $callable A valid PHP callable + * + * @deprecated since Twig 3.10 + */ + public function setEscaper($strategy, callable $callable) + { + trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated, use the "Twig\Runtime\EscaperRuntime::setEscaper()" method instead (be warned that Environment is not passed anymore to the callable).', __METHOD__); + + if (!isset($this->environment)) { + throw new \LogicException(\sprintf('You must call "setEnvironment()" before calling "%s()".', __METHOD__)); + } + + $this->escapers[$strategy] = $callable; + $callable = function ($string, $charset) use ($callable) { + return $callable($this->environment, $string, $charset); + }; + + $this->escaper->setEscaper($strategy, $callable); + } + + /** + * Gets all defined escapers. + * + * @return array An array of escapers + * + * @deprecated since Twig 3.10 + */ + public function getEscapers() + { + trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated, use the "Twig\Runtime\EscaperRuntime::getEscaper()" method instead.', __METHOD__); + + return $this->escapers; + } + + /** + * @deprecated since Twig 3.10 + */ + public function setSafeClasses(array $safeClasses = []) + { + trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated, use the "Twig\Runtime\EscaperRuntime::setSafeClasses()" method instead.', __METHOD__); + + if (!isset($this->escaper)) { + throw new \LogicException(\sprintf('You must call "setEnvironment()" before calling "%s()".', __METHOD__)); + } + + $this->escaper->setSafeClasses($safeClasses); + } + + /** + * @deprecated since Twig 3.10 + */ + public function addSafeClass(string $class, array $strategies) + { + trigger_deprecation('twig/twig', '3.10', 'The "%s()" method is deprecated, use the "Twig\Runtime\EscaperRuntime::addSafeClass()" method instead.', __METHOD__); + + if (!isset($this->escaper)) { + throw new \LogicException(\sprintf('You must call "setEnvironment()" before calling "%s()".', __METHOD__)); + } + + $this->escaper->addSafeClass($class, $strategies); + } + + /** + * @internal + */ + public static function escapeFilterIsSafe(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 index 10a42b6..38719d2 100644 --- a/vendor/twig/twig/src/Extension/ExtensionInterface.php +++ b/vendor/twig/twig/src/Extension/ExtensionInterface.php @@ -1,75 +1,75 @@ - - */ -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 - * - * @psalm-return array{ - * array}>, - * array, associativity: ExpressionParser::OPERATOR_*}> - * } - */ - public function getOperators(); -} + + */ +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 + * + * @psalm-return array{ + * array}>, + * array, associativity: ExpressionParser::OPERATOR_*}> + * } + */ + public function getOperators(); +} diff --git a/vendor/twig/twig/src/Extension/GlobalsInterface.php b/vendor/twig/twig/src/Extension/GlobalsInterface.php index d52cd10..b04697e 100644 --- a/vendor/twig/twig/src/Extension/GlobalsInterface.php +++ b/vendor/twig/twig/src/Extension/GlobalsInterface.php @@ -1,25 +1,25 @@ - - */ -interface GlobalsInterface -{ - /** - * @return array - */ - public function getGlobals(): array; -} + + */ +interface GlobalsInterface +{ + /** + * @return array + */ + public function getGlobals(): array; +} diff --git a/vendor/twig/twig/src/Extension/OptimizerExtension.php b/vendor/twig/twig/src/Extension/OptimizerExtension.php index d3fe46a..1f56d9b 100644 --- a/vendor/twig/twig/src/Extension/OptimizerExtension.php +++ b/vendor/twig/twig/src/Extension/OptimizerExtension.php @@ -1,27 +1,27 @@ -optimizers)]; - } -} +optimizers)]; + } +} diff --git a/vendor/twig/twig/src/Extension/ProfilerExtension.php b/vendor/twig/twig/src/Extension/ProfilerExtension.php index 43e4a44..8169ae4 100644 --- a/vendor/twig/twig/src/Extension/ProfilerExtension.php +++ b/vendor/twig/twig/src/Extension/ProfilerExtension.php @@ -1,52 +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)]; - } -} +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 index 63bc3b1..d908912 100644 --- a/vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php +++ b/vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php @@ -1,19 +1,19 @@ - - */ -interface RuntimeExtensionInterface -{ -} + + */ +interface RuntimeExtensionInterface +{ +} diff --git a/vendor/twig/twig/src/Extension/SandboxExtension.php b/vendor/twig/twig/src/Extension/SandboxExtension.php index 4e96760..8b94cc1 100644 --- a/vendor/twig/twig/src/Extension/SandboxExtension.php +++ b/vendor/twig/twig/src/Extension/SandboxExtension.php @@ -1,135 +1,135 @@ -policy = $policy; - $this->sandboxedGlobally = $sandboxed; - $this->sourcePolicy = $sourcePolicy; - } - - 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(?Source $source = null): bool - { - return $this->sandboxedGlobally || $this->sandboxed || $this->isSourceSandboxed($source); - } - - public function isSandboxedGlobally(): bool - { - return $this->sandboxedGlobally; - } - - private function isSourceSandboxed(?Source $source): bool - { - if (null === $source || null === $this->sourcePolicy) { - return false; - } - - return $this->sourcePolicy->enableSandbox($source); - } - - public function setSecurityPolicy(SecurityPolicyInterface $policy) - { - $this->policy = $policy; - } - - public function getSecurityPolicy(): SecurityPolicyInterface - { - return $this->policy; - } - - public function checkSecurity($tags, $filters, $functions, ?Source $source = null): void - { - if ($this->isSandboxed($source)) { - $this->policy->checkSecurity($tags, $filters, $functions); - } - } - - public function checkMethodAllowed($obj, $method, int $lineno = -1, ?Source $source = null): void - { - if ($this->isSandboxed($source)) { - 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($source)) { - 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($source) && $obj instanceof \Stringable) { - try { - $this->policy->checkMethodAllowed($obj, '__toString'); - } catch (SecurityNotAllowedMethodError $e) { - $e->setSourceContext($source); - $e->setTemplateLine($lineno); - - throw $e; - } - } - - return $obj; - } -} +policy = $policy; + $this->sandboxedGlobally = $sandboxed; + $this->sourcePolicy = $sourcePolicy; + } + + 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(?Source $source = null): bool + { + return $this->sandboxedGlobally || $this->sandboxed || $this->isSourceSandboxed($source); + } + + public function isSandboxedGlobally(): bool + { + return $this->sandboxedGlobally; + } + + private function isSourceSandboxed(?Source $source): bool + { + if (null === $source || null === $this->sourcePolicy) { + return false; + } + + return $this->sourcePolicy->enableSandbox($source); + } + + public function setSecurityPolicy(SecurityPolicyInterface $policy) + { + $this->policy = $policy; + } + + public function getSecurityPolicy(): SecurityPolicyInterface + { + return $this->policy; + } + + public function checkSecurity($tags, $filters, $functions, ?Source $source = null): void + { + if ($this->isSandboxed($source)) { + $this->policy->checkSecurity($tags, $filters, $functions); + } + } + + public function checkMethodAllowed($obj, $method, int $lineno = -1, ?Source $source = null): void + { + if ($this->isSandboxed($source)) { + 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($source)) { + 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($source) && $obj instanceof \Stringable) { + 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 index 59db2ca..1fc0096 100644 --- a/vendor/twig/twig/src/Extension/StagingExtension.php +++ b/vendor/twig/twig/src/Extension/StagingExtension.php @@ -1,100 +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; - } -} + + * + * @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 index 698d181..335704c 100644 --- a/vendor/twig/twig/src/Extension/StringLoaderExtension.php +++ b/vendor/twig/twig/src/Extension/StringLoaderExtension.php @@ -1,40 +1,40 @@ - true]), - ]; - } - - /** - * Loads a template from a string. - * - * {{ include(template_from_string("Hello {{ name }}")) }} - * - * @param string|null $name An optional name of the template to be used in error messages - * - * @internal - */ - public static function templateFromString(Environment $env, string|\Stringable $template, ?string $name = null): TemplateWrapper - { - return $env->createTemplate((string) $template, $name); - } -} + true]), + ]; + } + + /** + * Loads a template from a string. + * + * {{ include(template_from_string("Hello {{ name }}")) }} + * + * @param string|null $name An optional name of the template to be used in error messages + * + * @internal + */ + public static function templateFromString(Environment $env, string|\Stringable $template, ?string $name = null): TemplateWrapper + { + return $env->createTemplate((string) $template, $name); + } +} diff --git a/vendor/twig/twig/src/Extension/YieldNotReadyExtension.php b/vendor/twig/twig/src/Extension/YieldNotReadyExtension.php index 49dfb80..5e81d64 100644 --- a/vendor/twig/twig/src/Extension/YieldNotReadyExtension.php +++ b/vendor/twig/twig/src/Extension/YieldNotReadyExtension.php @@ -1,30 +1,30 @@ -useYield)]; - } -} +useYield)]; + } +} diff --git a/vendor/twig/twig/src/ExtensionSet.php b/vendor/twig/twig/src/ExtensionSet.php index 28d57a4..3ac9e59 100644 --- a/vendor/twig/twig/src/ExtensionSet.php +++ b/vendor/twig/twig/src/ExtensionSet.php @@ -1,488 +1,488 @@ - - * - * @internal - */ -final class ExtensionSet -{ - private $extensions; - private $initialized = false; - private $runtimeInitialized = false; - private $staging; - private $parsers; - private $visitors; - /** @var array */ - private $filters; - /** @var array */ - private $dynamicFilters; - /** @var array */ - private $tests; - /** @var array */ - private $dynamicTests; - /** @var array */ - private $functions; - /** @var array */ - private $dynamicFunctions; - /** @var array}> */ - private $unaryOperators; - /** @var array, associativity: ExpressionParser::OPERATOR_*}> */ - private $binaryOperators; - /** @var array */ - 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->dynamicFunctions as $pattern => $function) { - if (preg_match($pattern, $name, $matches)) { - array_shift($matches); - - return $function->withDynamicArguments($name, $function->getName(), $matches); - } - } - - 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->dynamicFilters as $pattern => $filter) { - if (preg_match($pattern, $name, $matches)) { - array_shift($matches); - - return $filter->withDynamicArguments($name, $filter->getName(), $matches); - } - } - - 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; - } - - /** - * @return array - */ - public function getGlobals(): array - { - if (null !== $this->globals) { - return $this->globals; - } - - $globals = []; - foreach ($this->extensions as $extension) { - if (!$extension instanceof GlobalsInterface) { - continue; - } - - $globals = array_merge($globals, $extension->getGlobals()); - } - - if ($this->initialized) { - $this->globals = $globals; - } - - return $globals; - } - - public function resetGlobals(): void - { - $this->globals = null; - } - - 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->dynamicTests as $pattern => $test) { - if (preg_match($pattern, $name, $matches)) { - array_shift($matches); - - return $test->withDynamicArguments($name, $test->getName(), $matches); - } - } - - return null; - } - - /** - * @return array}> - */ - public function getUnaryOperators(): array - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->unaryOperators; - } - - /** - * @return array, associativity: ExpressionParser::OPERATOR_*}> - */ - 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->dynamicFilters = []; - $this->dynamicFunctions = []; - $this->dynamicTests = []; - $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[$name = $filter->getName()] = $filter; - if (str_contains($name, '*')) { - $this->dynamicFilters['#^'.str_replace('\\*', '(.*?)', preg_quote($name, '#')).'$#'] = $filter; - } - } - - // functions - foreach ($extension->getFunctions() as $function) { - $this->functions[$name = $function->getName()] = $function; - if (str_contains($name, '*')) { - $this->dynamicFunctions['#^'.str_replace('\\*', '(.*?)', preg_quote($name, '#')).'$#'] = $function; - } - } - - // tests - foreach ($extension->getTests() as $test) { - $this->tests[$name = $test->getName()] = $test; - if (str_contains($name, '*')) { - $this->dynamicTests['#^'.str_replace('\\*', '(.*?)', preg_quote($name, '#')).'$#'] = $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]); - } - } -} + + * + * @internal + */ +final class ExtensionSet +{ + private $extensions; + private $initialized = false; + private $runtimeInitialized = false; + private $staging; + private $parsers; + private $visitors; + /** @var array */ + private $filters; + /** @var array */ + private $dynamicFilters; + /** @var array */ + private $tests; + /** @var array */ + private $dynamicTests; + /** @var array */ + private $functions; + /** @var array */ + private $dynamicFunctions; + /** @var array}> */ + private $unaryOperators; + /** @var array, associativity: ExpressionParser::OPERATOR_*}> */ + private $binaryOperators; + /** @var array */ + 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->dynamicFunctions as $pattern => $function) { + if (preg_match($pattern, $name, $matches)) { + array_shift($matches); + + return $function->withDynamicArguments($name, $function->getName(), $matches); + } + } + + 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->dynamicFilters as $pattern => $filter) { + if (preg_match($pattern, $name, $matches)) { + array_shift($matches); + + return $filter->withDynamicArguments($name, $filter->getName(), $matches); + } + } + + 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; + } + + /** + * @return array + */ + public function getGlobals(): array + { + if (null !== $this->globals) { + return $this->globals; + } + + $globals = []; + foreach ($this->extensions as $extension) { + if (!$extension instanceof GlobalsInterface) { + continue; + } + + $globals = array_merge($globals, $extension->getGlobals()); + } + + if ($this->initialized) { + $this->globals = $globals; + } + + return $globals; + } + + public function resetGlobals(): void + { + $this->globals = null; + } + + 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->dynamicTests as $pattern => $test) { + if (preg_match($pattern, $name, $matches)) { + array_shift($matches); + + return $test->withDynamicArguments($name, $test->getName(), $matches); + } + } + + return null; + } + + /** + * @return array}> + */ + public function getUnaryOperators(): array + { + if (!$this->initialized) { + $this->initExtensions(); + } + + return $this->unaryOperators; + } + + /** + * @return array, associativity: ExpressionParser::OPERATOR_*}> + */ + 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->dynamicFilters = []; + $this->dynamicFunctions = []; + $this->dynamicTests = []; + $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[$name = $filter->getName()] = $filter; + if (str_contains($name, '*')) { + $this->dynamicFilters['#^'.str_replace('\\*', '(.*?)', preg_quote($name, '#')).'$#'] = $filter; + } + } + + // functions + foreach ($extension->getFunctions() as $function) { + $this->functions[$name = $function->getName()] = $function; + if (str_contains($name, '*')) { + $this->dynamicFunctions['#^'.str_replace('\\*', '(.*?)', preg_quote($name, '#')).'$#'] = $function; + } + } + + // tests + foreach ($extension->getTests() as $test) { + $this->tests[$name = $test->getName()] = $test; + if (str_contains($name, '*')) { + $this->dynamicTests['#^'.str_replace('\\*', '(.*?)', preg_quote($name, '#')).'$#'] = $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 index 812071b..3a43b08 100644 --- a/vendor/twig/twig/src/FileExtensionEscapingStrategy.php +++ b/vendor/twig/twig/src/FileExtensionEscapingStrategy.php @@ -1,60 +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 (str_ends_with($name, '.twig')) { - $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'; - } - } -} + + */ +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 (str_ends_with($name, '.twig')) { + $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 index 28feaa2..e87a45c 100644 --- a/vendor/twig/twig/src/Lexer.php +++ b/vendor/twig/twig/src/Lexer.php @@ -1,584 +1,584 @@ - - */ -class Lexer -{ - private $isInitialized = false; - - 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 = '()[]{}?:.,|'; - - private const SPECIAL_CHARS = [ - 'f' => "\f", - 'n' => "\n", - 'r' => "\r", - 't' => "\t", - 'v' => "\v", - ]; - - 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); - } - - private function initialize() - { - if ($this->isInitialized) { - return; - } - - // 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', - ]; - - $this->isInitialized = true; - } - - public function tokenize(Source $source): TokenStream - { - $this->initialize(); - - $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); - - if (!empty($this->brackets)) { - [$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, 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, $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); - $this->pushState(self::STATE_BLOCK); - $this->currentVarBlockLine = $this->lineno; - } - break; - - case $this->options['tag_variable'][0]: - $this->pushToken(Token::VAR_START_TYPE); - $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); - $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); - $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); - } - } - - // spread operator - if ('.' === $this->code[$this->cursor] && ($this->cursor + 2 < $this->end) && '.' === $this->code[$this->cursor + 1] && '.' === $this->code[$this->cursor + 2]) { - $this->pushToken(Token::SPREAD_TYPE, '...'); - $this->moveCursor('...'); - } - // arrow function - elseif ('=' === $this->code[$this->cursor] && ($this->cursor + 1 < $this->end) && '>' === $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, 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, $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, $number); - $this->moveCursor($match[0]); - } - // punctuation - elseif (str_contains(self::PUNCTUATION, $this->code[$this->cursor])) { - // opening bracket - if (str_contains('([{', $this->code[$this->cursor])) { - $this->brackets[] = [$this->code[$this->cursor], $this->lineno]; - } - // closing bracket - elseif (str_contains(')]}', $this->code[$this->cursor])) { - if (empty($this->brackets)) { - throw new SyntaxError(\sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - - [$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, $this->code[$this->cursor]); - ++$this->cursor; - } - // strings - elseif (preg_match(self::REGEX_STRING, $this->code, $match, 0, $this->cursor)) { - $this->pushToken(Token::STRING_TYPE, $this->stripcslashes(substr($match[0], 1, -1), substr($match[0], 0, 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 stripcslashes(string $str, string $quoteType): string - { - $result = ''; - $length = \strlen($str); - - $i = 0; - while ($i < $length) { - if (false === $pos = strpos($str, '\\', $i)) { - $result .= substr($str, $i); - break; - } - - $result .= substr($str, $i, $pos - $i); - $i = $pos + 1; - - if ($i >= $length) { - $result .= '\\'; - break; - } - - $nextChar = $str[$i]; - - if (isset(self::SPECIAL_CHARS[$nextChar])) { - $result .= self::SPECIAL_CHARS[$nextChar]; - } elseif ('\\' === $nextChar) { - $result .= $nextChar; - } elseif ("'" === $nextChar || '"' === $nextChar) { - if ($nextChar !== $quoteType) { - trigger_deprecation('twig/twig', '3.12', 'Character "%s" at position %d should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.', $nextChar, $i + 1); - } - $result .= $nextChar; - } elseif ('#' === $nextChar && $i + 1 < $length && '{' === $str[$i + 1]) { - $result .= '#{'; - ++$i; - } elseif ('x' === $nextChar && $i + 1 < $length && ctype_xdigit($str[$i + 1])) { - $hex = $str[++$i]; - if ($i + 1 < $length && ctype_xdigit($str[$i + 1])) { - $hex .= $str[++$i]; - } - $result .= \chr(hexdec($hex)); - } elseif (ctype_digit($nextChar) && $nextChar < '8') { - $octal = $nextChar; - while ($i + 1 < $length && ctype_digit($str[$i + 1]) && $str[$i + 1] < '8' && \strlen($octal) < 3) { - $octal .= $str[++$i]; - } - $result .= \chr(octdec($octal)); - } else { - trigger_deprecation('twig/twig', '3.12', 'Character "%s" at position %d should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.', $nextChar, $i + 1); - $result .= $nextChar; - } - - ++$i; - } - - return $result; - } - - 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, $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); - $this->moveCursor($match[0]); - $this->pushState(self::STATE_INTERPOLATION); - } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, 0, $this->cursor) && '' !== $match[0]) { - $this->pushToken(Token::STRING_TYPE, $this->stripcslashes($match[0], '"')); - $this->moveCursor($match[0]); - } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { - [$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); - $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 === $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); - } -} + + */ +class Lexer +{ + private $isInitialized = false; + + 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 = '()[]{}?:.,|'; + + private const SPECIAL_CHARS = [ + 'f' => "\f", + 'n' => "\n", + 'r' => "\r", + 't' => "\t", + 'v' => "\v", + ]; + + 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); + } + + private function initialize() + { + if ($this->isInitialized) { + return; + } + + // 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', + ]; + + $this->isInitialized = true; + } + + public function tokenize(Source $source): TokenStream + { + $this->initialize(); + + $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); + + if (!empty($this->brackets)) { + [$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, 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, $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); + $this->pushState(self::STATE_BLOCK); + $this->currentVarBlockLine = $this->lineno; + } + break; + + case $this->options['tag_variable'][0]: + $this->pushToken(Token::VAR_START_TYPE); + $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); + $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); + $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); + } + } + + // spread operator + if ('.' === $this->code[$this->cursor] && ($this->cursor + 2 < $this->end) && '.' === $this->code[$this->cursor + 1] && '.' === $this->code[$this->cursor + 2]) { + $this->pushToken(Token::SPREAD_TYPE, '...'); + $this->moveCursor('...'); + } + // arrow function + elseif ('=' === $this->code[$this->cursor] && ($this->cursor + 1 < $this->end) && '>' === $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, 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, $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, $number); + $this->moveCursor($match[0]); + } + // punctuation + elseif (str_contains(self::PUNCTUATION, $this->code[$this->cursor])) { + // opening bracket + if (str_contains('([{', $this->code[$this->cursor])) { + $this->brackets[] = [$this->code[$this->cursor], $this->lineno]; + } + // closing bracket + elseif (str_contains(')]}', $this->code[$this->cursor])) { + if (empty($this->brackets)) { + throw new SyntaxError(\sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); + } + + [$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, $this->code[$this->cursor]); + ++$this->cursor; + } + // strings + elseif (preg_match(self::REGEX_STRING, $this->code, $match, 0, $this->cursor)) { + $this->pushToken(Token::STRING_TYPE, $this->stripcslashes(substr($match[0], 1, -1), substr($match[0], 0, 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 stripcslashes(string $str, string $quoteType): string + { + $result = ''; + $length = \strlen($str); + + $i = 0; + while ($i < $length) { + if (false === $pos = strpos($str, '\\', $i)) { + $result .= substr($str, $i); + break; + } + + $result .= substr($str, $i, $pos - $i); + $i = $pos + 1; + + if ($i >= $length) { + $result .= '\\'; + break; + } + + $nextChar = $str[$i]; + + if (isset(self::SPECIAL_CHARS[$nextChar])) { + $result .= self::SPECIAL_CHARS[$nextChar]; + } elseif ('\\' === $nextChar) { + $result .= $nextChar; + } elseif ("'" === $nextChar || '"' === $nextChar) { + if ($nextChar !== $quoteType) { + trigger_deprecation('twig/twig', '3.12', 'Character "%s" at position %d should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.', $nextChar, $i + 1); + } + $result .= $nextChar; + } elseif ('#' === $nextChar && $i + 1 < $length && '{' === $str[$i + 1]) { + $result .= '#{'; + ++$i; + } elseif ('x' === $nextChar && $i + 1 < $length && ctype_xdigit($str[$i + 1])) { + $hex = $str[++$i]; + if ($i + 1 < $length && ctype_xdigit($str[$i + 1])) { + $hex .= $str[++$i]; + } + $result .= \chr(hexdec($hex)); + } elseif (ctype_digit($nextChar) && $nextChar < '8') { + $octal = $nextChar; + while ($i + 1 < $length && ctype_digit($str[$i + 1]) && $str[$i + 1] < '8' && \strlen($octal) < 3) { + $octal .= $str[++$i]; + } + $result .= \chr(octdec($octal)); + } else { + trigger_deprecation('twig/twig', '3.12', 'Character "%s" at position %d should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.', $nextChar, $i + 1); + $result .= $nextChar; + } + + ++$i; + } + + return $result; + } + + 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, $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); + $this->moveCursor($match[0]); + $this->pushState(self::STATE_INTERPOLATION); + } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, 0, $this->cursor) && '' !== $match[0]) { + $this->pushToken(Token::STRING_TYPE, $this->stripcslashes($match[0], '"')); + $this->moveCursor($match[0]); + } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { + [$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); + $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 === $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 index 2bb54b7..2bd49f1 100644 --- a/vendor/twig/twig/src/Loader/ArrayLoader.php +++ b/vendor/twig/twig/src/Loader/ArrayLoader.php @@ -1,75 +1,75 @@ - - */ -final class ArrayLoader implements LoaderInterface -{ - /** - * @param array $templates An array of templates (keys are the names, and values are the source code) - */ - public function __construct( - private array $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; - } -} + + */ +final class ArrayLoader implements LoaderInterface +{ + /** + * @param array $templates An array of templates (keys are the names, and values are the source code) + */ + public function __construct( + private array $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 index 6e4f951..1805978 100644 --- a/vendor/twig/twig/src/Loader/ChainLoader.php +++ b/vendor/twig/twig/src/Loader/ChainLoader.php @@ -1,132 +1,132 @@ - - */ -final class ChainLoader implements LoaderInterface -{ - /** - * @var array - */ - private $hasSourceCache = []; - - /** - * @param iterable $loaders - */ - public function __construct( - private iterable $loaders = [], - ) { - } - - public function addLoader(LoaderInterface $loader): void - { - $current = $this->loaders; - - $this->loaders = (static function () use ($current, $loader): \Generator { - yield from $current; - yield $loader; - })(); - - $this->hasSourceCache = []; - } - - /** - * @return LoaderInterface[] - */ - public function getLoaders(): array - { - if (!\is_array($this->loaders)) { - $this->loaders = iterator_to_array($this->loaders, false); - } - - return $this->loaders; - } - - public function getSourceContext(string $name): Source - { - $exceptions = []; - - foreach ($this->getLoaders() 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->getLoaders() 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->getLoaders() 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->getLoaders() 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).')' : '')); - } -} + + */ +final class ChainLoader implements LoaderInterface +{ + /** + * @var array + */ + private $hasSourceCache = []; + + /** + * @param iterable $loaders + */ + public function __construct( + private iterable $loaders = [], + ) { + } + + public function addLoader(LoaderInterface $loader): void + { + $current = $this->loaders; + + $this->loaders = (static function () use ($current, $loader): \Generator { + yield from $current; + yield $loader; + })(); + + $this->hasSourceCache = []; + } + + /** + * @return LoaderInterface[] + */ + public function getLoaders(): array + { + if (!\is_array($this->loaders)) { + $this->loaders = iterator_to_array($this->loaders, false); + } + + return $this->loaders; + } + + public function getSourceContext(string $name): Source + { + $exceptions = []; + + foreach ($this->getLoaders() 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->getLoaders() 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->getLoaders() 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->getLoaders() 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 index c60964f..2869c6a 100644 --- a/vendor/twig/twig/src/Loader/FilesystemLoader.php +++ b/vendor/twig/twig/src/Loader/FilesystemLoader.php @@ -1,283 +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 = ($rootPath ?? getcwd()).\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 { - [$namespace, $shortname] = $this->parseName($name); - - $this->validateName($shortname); - } 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 (str_contains($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) - ; - } -} + + */ +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 = ($rootPath ?? getcwd()).\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 { + [$namespace, $shortname] = $this->parseName($name); + + $this->validateName($shortname); + } 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 (str_contains($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 index fec7e85..b30b87c 100644 --- a/vendor/twig/twig/src/Loader/LoaderInterface.php +++ b/vendor/twig/twig/src/Loader/LoaderInterface.php @@ -1,49 +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); -} + + */ +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 index 4fae779..d1e3536 100644 --- a/vendor/twig/twig/src/Markup.php +++ b/vendor/twig/twig/src/Markup.php @@ -1,52 +1,52 @@ - - */ -class Markup implements \Countable, \JsonSerializable, \Stringable -{ - private $content; - private ?string $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; - } -} + + */ +class Markup implements \Countable, \JsonSerializable, \Stringable +{ + private $content; + private ?string $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 index ee80639..f8f90e1 100644 --- a/vendor/twig/twig/src/Node/AutoEscapeNode.php +++ b/vendor/twig/twig/src/Node/AutoEscapeNode.php @@ -1,40 +1,40 @@ - - */ -#[YieldReady] -class AutoEscapeNode extends Node -{ - public function __construct($value, Node $body, int $lineno) - { - parent::__construct(['body' => $body], ['value' => $value], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler->subcompile($this->getNode('body')); - } -} + + */ +#[YieldReady] +class AutoEscapeNode extends Node +{ + public function __construct($value, Node $body, int $lineno) + { + parent::__construct(['body' => $body], ['value' => $value], $lineno); + } + + 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 index b4f939c..674bf1a 100644 --- a/vendor/twig/twig/src/Node/BlockNode.php +++ b/vendor/twig/twig/src/Node/BlockNode.php @@ -1,50 +1,50 @@ - - */ -#[YieldReady] -class BlockNode extends Node -{ - public function __construct(string $name, Node $body, int $lineno) - { - parent::__construct(['body' => $body], ['name' => $name], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler - ->addDebugInfo($this) - ->write("/**\n") - ->write(" * @return iterable\n") - ->write(" */\n") - ->write(\sprintf("public function block_%s(array \$context, array \$blocks = []): iterable\n", $this->getAttribute('name')), "{\n") - ->indent() - ->write("\$macros = \$this->macros;\n") - ; - - $compiler - ->subcompile($this->getNode('body')) - ->write("yield from [];\n") - ->outdent() - ->write("}\n\n") - ; - } -} + + */ +#[YieldReady] +class BlockNode extends Node +{ + public function __construct(string $name, Node $body, int $lineno) + { + parent::__construct(['body' => $body], ['name' => $name], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write("/**\n") + ->write(" * @return iterable\n") + ->write(" */\n") + ->write(\sprintf("public function block_%s(array \$context, array \$blocks = []): iterable\n", $this->getAttribute('name')), "{\n") + ->indent() + ->write("\$macros = \$this->macros;\n") + ; + + $compiler + ->subcompile($this->getNode('body')) + ->write("yield from [];\n") + ->outdent() + ->write("}\n\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/BlockReferenceNode.php b/vendor/twig/twig/src/Node/BlockReferenceNode.php index 7c313a0..6738063 100644 --- a/vendor/twig/twig/src/Node/BlockReferenceNode.php +++ b/vendor/twig/twig/src/Node/BlockReferenceNode.php @@ -1,38 +1,38 @@ - - */ -#[YieldReady] -class BlockReferenceNode extends Node implements NodeOutputInterface -{ - public function __construct(string $name, int $lineno) - { - parent::__construct([], ['name' => $name], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler - ->addDebugInfo($this) - ->write(\sprintf("yield from \$this->unwrap()->yieldBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))) - ; - } -} + + */ +#[YieldReady] +class BlockReferenceNode extends Node implements NodeOutputInterface +{ + public function __construct(string $name, int $lineno) + { + parent::__construct([], ['name' => $name], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write(\sprintf("yield from \$this->unwrap()->yieldBlock('%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 index 08115b3..734e2ea 100644 --- a/vendor/twig/twig/src/Node/BodyNode.php +++ b/vendor/twig/twig/src/Node/BodyNode.php @@ -1,24 +1,24 @@ - - */ -#[YieldReady] -class BodyNode extends Node -{ -} + + */ +#[YieldReady] +class BodyNode extends Node +{ +} diff --git a/vendor/twig/twig/src/Node/CaptureNode.php b/vendor/twig/twig/src/Node/CaptureNode.php index 3b7f0b6..79f2686 100644 --- a/vendor/twig/twig/src/Node/CaptureNode.php +++ b/vendor/twig/twig/src/Node/CaptureNode.php @@ -1,57 +1,57 @@ - - */ -#[YieldReady] -class CaptureNode extends Node -{ - public function __construct(Node $body, int $lineno) - { - parent::__construct(['body' => $body], ['raw' => false], $lineno); - } - - public function compile(Compiler $compiler): void - { - $useYield = $compiler->getEnvironment()->useYield(); - - if (!$this->getAttribute('raw')) { - $compiler->raw("('' === \$tmp = "); - } - $compiler - ->raw($useYield ? "implode('', iterator_to_array(" : '\\Twig\\Extension\\CoreExtension::captureOutput(') - ->raw("(function () use (&\$context, \$macros, \$blocks) {\n") - ->indent() - ->subcompile($this->getNode('body')) - ->write("yield from [];\n") - ->outdent() - ->write('})()') - ; - if ($useYield) { - $compiler->raw(', false))'); - } else { - $compiler->raw(')'); - } - if (!$this->getAttribute('raw')) { - $compiler->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset());"); - } else { - $compiler->raw(';'); - } - } -} + + */ +#[YieldReady] +class CaptureNode extends Node +{ + public function __construct(Node $body, int $lineno) + { + parent::__construct(['body' => $body], ['raw' => false], $lineno); + } + + public function compile(Compiler $compiler): void + { + $useYield = $compiler->getEnvironment()->useYield(); + + if (!$this->getAttribute('raw')) { + $compiler->raw("('' === \$tmp = "); + } + $compiler + ->raw($useYield ? "implode('', iterator_to_array(" : '\\Twig\\Extension\\CoreExtension::captureOutput(') + ->raw("(function () use (&\$context, \$macros, \$blocks) {\n") + ->indent() + ->subcompile($this->getNode('body')) + ->write("yield from [];\n") + ->outdent() + ->write('})()') + ; + if ($useYield) { + $compiler->raw(', false))'); + } else { + $compiler->raw(')'); + } + if (!$this->getAttribute('raw')) { + $compiler->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset());"); + } else { + $compiler->raw(';'); + } + } +} diff --git a/vendor/twig/twig/src/Node/CheckSecurityCallNode.php b/vendor/twig/twig/src/Node/CheckSecurityCallNode.php index 9c162d1..781db69 100644 --- a/vendor/twig/twig/src/Node/CheckSecurityCallNode.php +++ b/vendor/twig/twig/src/Node/CheckSecurityCallNode.php @@ -1,30 +1,30 @@ - - */ -#[YieldReady] -class CheckSecurityCallNode extends Node -{ - public function compile(Compiler $compiler) - { - $compiler - ->write("\$this->sandbox = \$this->extensions[SandboxExtension::class];\n") - ->write("\$this->checkSecurity();\n") - ; - } -} + + */ +#[YieldReady] +class CheckSecurityCallNode extends Node +{ + public function compile(Compiler $compiler) + { + $compiler + ->write("\$this->sandbox = \$this->extensions[SandboxExtension::class];\n") + ->write("\$this->checkSecurity();\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/CheckSecurityNode.php b/vendor/twig/twig/src/Node/CheckSecurityNode.php index 6e591aa..9531870 100644 --- a/vendor/twig/twig/src/Node/CheckSecurityNode.php +++ b/vendor/twig/twig/src/Node/CheckSecurityNode.php @@ -1,85 +1,85 @@ - - */ -#[YieldReady] -class CheckSecurityNode extends Node -{ - private $usedFilters; - private $usedTags; - private $usedFunctions; - - /** - * @param array $usedFilters - * @param array $usedTags - * @param array $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 - { - $compiler - ->write("\n") - ->write("public function checkSecurity()\n") - ->write("{\n") - ->indent() - ->write('static $tags = ')->repr(array_filter($this->usedTags))->raw(";\n") - ->write('static $filters = ')->repr(array_filter($this->usedFilters))->raw(";\n") - ->write('static $functions = ')->repr(array_filter($this->usedFunctions))->raw(";\n\n") - ->write("try {\n") - ->indent() - ->write("\$this->sandbox->checkSecurity(\n") - ->indent() - ->write(!$this->usedTags ? "[],\n" : "['".implode("', '", array_keys($this->usedTags))."'],\n") - ->write(!$this->usedFilters ? "[],\n" : "['".implode("', '", array_keys($this->usedFilters))."'],\n") - ->write(!$this->usedFunctions ? "[],\n" : "['".implode("', '", array_keys($this->usedFunctions))."'],\n") - ->write("\$this->source\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") - ; - } -} + + */ +#[YieldReady] +class CheckSecurityNode extends Node +{ + private $usedFilters; + private $usedTags; + private $usedFunctions; + + /** + * @param array $usedFilters + * @param array $usedTags + * @param array $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 + { + $compiler + ->write("\n") + ->write("public function checkSecurity()\n") + ->write("{\n") + ->indent() + ->write('static $tags = ')->repr(array_filter($this->usedTags))->raw(";\n") + ->write('static $filters = ')->repr(array_filter($this->usedFilters))->raw(";\n") + ->write('static $functions = ')->repr(array_filter($this->usedFunctions))->raw(";\n\n") + ->write("try {\n") + ->indent() + ->write("\$this->sandbox->checkSecurity(\n") + ->indent() + ->write(!$this->usedTags ? "[],\n" : "['".implode("', '", array_keys($this->usedTags))."'],\n") + ->write(!$this->usedFilters ? "[],\n" : "['".implode("', '", array_keys($this->usedFilters))."'],\n") + ->write(!$this->usedFunctions ? "[],\n" : "['".implode("', '", array_keys($this->usedFunctions))."'],\n") + ->write("\$this->source\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 index 937240c..3b7e786 100644 --- a/vendor/twig/twig/src/Node/CheckToStringNode.php +++ b/vendor/twig/twig/src/Node/CheckToStringNode.php @@ -1,47 +1,47 @@ - - */ -#[YieldReady] -class CheckToStringNode extends AbstractExpression -{ - public function __construct(AbstractExpression $expr) - { - parent::__construct(['expr' => $expr], [], $expr->getTemplateLine()); - } - - public function compile(Compiler $compiler): void - { - $expr = $this->getNode('expr'); - $compiler - ->raw('$this->sandbox->ensureToStringAllowed(') - ->subcompile($expr) - ->raw(', ') - ->repr($expr->getTemplateLine()) - ->raw(', $this->source)') - ; - } -} + + */ +#[YieldReady] +class CheckToStringNode extends AbstractExpression +{ + public function __construct(AbstractExpression $expr) + { + parent::__construct(['expr' => $expr], [], $expr->getTemplateLine()); + } + + 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 index 0772adf..c1c7b11 100644 --- a/vendor/twig/twig/src/Node/DeprecatedNode.php +++ b/vendor/twig/twig/src/Node/DeprecatedNode.php @@ -1,73 +1,73 @@ - - */ -#[YieldReady] -class DeprecatedNode extends Node -{ - public function __construct(AbstractExpression $expr, int $lineno) - { - parent::__construct(['expr' => $expr], [], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler->addDebugInfo($this); - - $expr = $this->getNode('expr'); - - if (!$expr instanceof ConstantExpression) { - $varName = $compiler->getVarName(); - $compiler - ->write(\sprintf('$%s = ', $varName)) - ->subcompile($expr) - ->raw(";\n") - ; - } - - $compiler->write('trigger_deprecation('); - if ($this->hasNode('package')) { - $compiler->subcompile($this->getNode('package')); - } else { - $compiler->raw("''"); - } - $compiler->raw(', '); - if ($this->hasNode('version')) { - $compiler->subcompile($this->getNode('version')); - } else { - $compiler->raw("''"); - } - $compiler->raw(', '); - - if ($expr instanceof ConstantExpression) { - $compiler->subcompile($expr); - } else { - $compiler->write(\sprintf('$%s', $varName)); - } - - $compiler - ->raw('.') - ->string(\sprintf(' in "%s" at line %d.', $this->getTemplateName(), $this->getTemplateLine())) - ->raw(");\n") - ; - } -} + + */ +#[YieldReady] +class DeprecatedNode extends Node +{ + public function __construct(AbstractExpression $expr, int $lineno) + { + parent::__construct(['expr' => $expr], [], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + + $expr = $this->getNode('expr'); + + if (!$expr instanceof ConstantExpression) { + $varName = $compiler->getVarName(); + $compiler + ->write(\sprintf('$%s = ', $varName)) + ->subcompile($expr) + ->raw(";\n") + ; + } + + $compiler->write('trigger_deprecation('); + if ($this->hasNode('package')) { + $compiler->subcompile($this->getNode('package')); + } else { + $compiler->raw("''"); + } + $compiler->raw(', '); + if ($this->hasNode('version')) { + $compiler->subcompile($this->getNode('version')); + } else { + $compiler->raw("''"); + } + $compiler->raw(', '); + + if ($expr instanceof ConstantExpression) { + $compiler->subcompile($expr); + } else { + $compiler->write(\sprintf('$%s', $varName)); + } + + $compiler + ->raw('.') + ->string(\sprintf(' in "%s" at line %d.', $this->getTemplateName(), $this->getTemplateLine())) + ->raw(");\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/DoNode.php b/vendor/twig/twig/src/Node/DoNode.php index 1593fd0..5fb2a0e 100644 --- a/vendor/twig/twig/src/Node/DoNode.php +++ b/vendor/twig/twig/src/Node/DoNode.php @@ -1,40 +1,40 @@ - - */ -#[YieldReady] -class DoNode extends Node -{ - public function __construct(AbstractExpression $expr, int $lineno) - { - parent::__construct(['expr' => $expr], [], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler - ->addDebugInfo($this) - ->write('') - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ; - } -} + + */ +#[YieldReady] +class DoNode extends Node +{ + public function __construct(AbstractExpression $expr, int $lineno) + { + parent::__construct(['expr' => $expr], [], $lineno); + } + + 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 index 4cd3b38..bd7de61 100644 --- a/vendor/twig/twig/src/Node/EmbedNode.php +++ b/vendor/twig/twig/src/Node/EmbedNode.php @@ -1,50 +1,50 @@ - - */ -#[YieldReady] -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) - { - parent::__construct(new ConstantExpression('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno); - - $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(')') - ; - } -} + + */ +#[YieldReady] +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) + { + parent::__construct(new ConstantExpression('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno); + + $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 index 1692f56..136831e 100644 --- a/vendor/twig/twig/src/Node/Expression/AbstractExpression.php +++ b/vendor/twig/twig/src/Node/Expression/AbstractExpression.php @@ -1,28 +1,28 @@ - - */ -abstract class AbstractExpression extends Node -{ - public function isGenerator(): bool - { - return $this->hasAttribute('is_generator') && $this->getAttribute('is_generator'); - } -} + + */ +abstract class AbstractExpression extends Node +{ + public function isGenerator(): bool + { + return $this->hasAttribute('is_generator') && $this->getAttribute('is_generator'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/ArrayExpression.php b/vendor/twig/twig/src/Node/Expression/ArrayExpression.php index 5f8b0f6..dd6b7f4 100644 --- a/vendor/twig/twig/src/Node/Expression/ArrayExpression.php +++ b/vendor/twig/twig/src/Node/Expression/ArrayExpression.php @@ -1,135 +1,135 @@ -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 - { - $keyValuePairs = $this->getKeyValuePairs(); - $needsArrayMergeSpread = \PHP_VERSION_ID < 80100 && $this->hasSpreadItem($keyValuePairs); - - if ($needsArrayMergeSpread) { - $compiler->raw('CoreExtension::merge('); - } - $compiler->raw('['); - $first = true; - $reopenAfterMergeSpread = false; - $nextIndex = 0; - foreach ($keyValuePairs as $pair) { - if ($reopenAfterMergeSpread) { - $compiler->raw(', ['); - $reopenAfterMergeSpread = false; - } - - if ($needsArrayMergeSpread && $pair['value']->hasAttribute('spread')) { - $compiler->raw('], ')->subcompile($pair['value']); - $first = true; - $reopenAfterMergeSpread = true; - continue; - } - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - if ($pair['value']->hasAttribute('spread') && !$needsArrayMergeSpread) { - $compiler->raw('...')->subcompile($pair['value']); - ++$nextIndex; - } else { - $key = $pair['key'] instanceof ConstantExpression ? $pair['key']->getAttribute('value') : null; - - if ($nextIndex !== $key) { - if (\is_int($key)) { - $nextIndex = $key + 1; - } - $compiler - ->subcompile($pair['key']) - ->raw(' => ') - ; - } else { - ++$nextIndex; - } - - $compiler->subcompile($pair['value']); - } - } - if (!$reopenAfterMergeSpread) { - $compiler->raw(']'); - } - if ($needsArrayMergeSpread) { - $compiler->raw(')'); - } - } - - private function hasSpreadItem(array $pairs): bool - { - foreach ($pairs as $pair) { - if ($pair['value']->hasAttribute('spread')) { - return true; - } - } - - return false; - } -} +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 + { + $keyValuePairs = $this->getKeyValuePairs(); + $needsArrayMergeSpread = \PHP_VERSION_ID < 80100 && $this->hasSpreadItem($keyValuePairs); + + if ($needsArrayMergeSpread) { + $compiler->raw('CoreExtension::merge('); + } + $compiler->raw('['); + $first = true; + $reopenAfterMergeSpread = false; + $nextIndex = 0; + foreach ($keyValuePairs as $pair) { + if ($reopenAfterMergeSpread) { + $compiler->raw(', ['); + $reopenAfterMergeSpread = false; + } + + if ($needsArrayMergeSpread && $pair['value']->hasAttribute('spread')) { + $compiler->raw('], ')->subcompile($pair['value']); + $first = true; + $reopenAfterMergeSpread = true; + continue; + } + if (!$first) { + $compiler->raw(', '); + } + $first = false; + + if ($pair['value']->hasAttribute('spread') && !$needsArrayMergeSpread) { + $compiler->raw('...')->subcompile($pair['value']); + ++$nextIndex; + } else { + $key = $pair['key'] instanceof ConstantExpression ? $pair['key']->getAttribute('value') : null; + + if ($nextIndex !== $key) { + if (\is_int($key)) { + $nextIndex = $key + 1; + } + $compiler + ->subcompile($pair['key']) + ->raw(' => ') + ; + } else { + ++$nextIndex; + } + + $compiler->subcompile($pair['value']); + } + } + if (!$reopenAfterMergeSpread) { + $compiler->raw(']'); + } + if ($needsArrayMergeSpread) { + $compiler->raw(')'); + } + } + + private function hasSpreadItem(array $pairs): bool + { + foreach ($pairs as $pair) { + if ($pair['value']->hasAttribute('spread')) { + return true; + } + } + + return false; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php b/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php index 2bae4ed..3d7717d 100644 --- a/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php +++ b/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php @@ -1,64 +1,64 @@ - - */ -class ArrowFunctionExpression extends AbstractExpression -{ - public function __construct(AbstractExpression $expr, Node $names, $lineno) - { - parent::__construct(['expr' => $expr, 'names' => $names], [], $lineno); - } - - 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('; }') - ; - } -} + + */ +class ArrowFunctionExpression extends AbstractExpression +{ + public function __construct(AbstractExpression $expr, Node $names, $lineno) + { + parent::__construct(['expr' => $expr, 'names' => $names], [], $lineno); + } + + 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 index 7dd1bc4..db770d5 100644 --- a/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php +++ b/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php @@ -1,27 +1,27 @@ -raw('$context[') - ->string($this->getAttribute('name')) - ->raw(']') - ; - } -} +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 index c424e5c..ca66350 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php @@ -1,42 +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; -} + $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 index ee4307e..b786353 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php @@ -1,23 +1,23 @@ -raw('+'); - } -} +raw('+'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php index 5f2380d..bc2fdd8 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php @@ -1,23 +1,23 @@ -raw('&&'); - } -} +raw('&&'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php index db7d6d6..029c158 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php @@ -1,23 +1,23 @@ -raw('&'); - } -} +raw('&'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php index ce803dd..d82d061 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php @@ -1,23 +1,23 @@ -raw('|'); - } -} +raw('|'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php index 5c29785..0177d8a 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php @@ -1,23 +1,23 @@ -raw('^'); - } -} +raw('^'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php index f825ab8..b57f645 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php @@ -1,23 +1,23 @@ -raw('.'); - } -} +raw('.'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php index e3817d1..fdb42aa 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php @@ -1,23 +1,23 @@ -raw('/'); - } -} +raw('/'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php index a73a560..f7c7c84 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php @@ -1,35 +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(') && str_ends_with($%1$s, $%2$s))', $left, $right)) - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw(''); - } -} +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(') && str_ends_with($%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/EqualBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php index 5f42319..cbea3a0 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php @@ -1,39 +1,39 @@ -= 80000) { - parent::compile($compiler); - - return; - } - - $compiler - ->raw('(0 === CoreExtension::compare(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw('))') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw('=='); - } -} += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(0 === CoreExtension::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 index d7e7980..0a8a64e 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php @@ -1,29 +1,29 @@ -raw('(int) floor('); - parent::compile($compiler); - $compiler->raw(')'); - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw('/'); - } -} +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 index f42de3f..a6a077b 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php @@ -1,39 +1,39 @@ -= 80000) { - parent::compile($compiler); - - return; - } - - $compiler - ->raw('(1 === CoreExtension::compare(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw('))') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw('>'); - } -} += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(1 === CoreExtension::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 index 0c4f43f..6c30032 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php @@ -1,39 +1,39 @@ -= 80000) { - parent::compile($compiler); - - return; - } - - $compiler - ->raw('(0 <= CoreExtension::compare(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw('))') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw('>='); - } -} += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(0 <= CoreExtension::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/HasEveryBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/HasEveryBinary.php index c57bb20..35ffff0 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/HasEveryBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/HasEveryBinary.php @@ -1,33 +1,33 @@ -raw('CoreExtension::arrayEvery($this->env, ') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw(''); - } -} +raw('CoreExtension::arrayEvery($this->env, ') + ->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/HasSomeBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/HasSomeBinary.php index 12293f8..9de6983 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/HasSomeBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/HasSomeBinary.php @@ -1,33 +1,33 @@ -raw('CoreExtension::arraySome($this->env, ') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw(''); - } -} +raw('CoreExtension::arraySome($this->env, ') + ->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 index 68a98fe..6875dc4 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php @@ -1,33 +1,33 @@ -raw('CoreExtension::inFilter(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw('in'); - } -} +raw('CoreExtension::inFilter(') + ->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 index fb3264a..e189d9e 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php @@ -1,39 +1,39 @@ -= 80000) { - parent::compile($compiler); - - return; - } - - $compiler - ->raw('(-1 === CoreExtension::compare(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw('))') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw('<'); - } -} += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(-1 === CoreExtension::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 index 8f36538..8ced5eb 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php @@ -1,39 +1,39 @@ -= 80000) { - parent::compile($compiler); - - return; - } - - $compiler - ->raw('(0 >= CoreExtension::compare(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw('))') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw('<='); - } -} += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(0 >= CoreExtension::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 index 4669044..cbef24b 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php @@ -1,33 +1,33 @@ -raw('CoreExtension::matches(') - ->subcompile($this->getNode('right')) - ->raw(', ') - ->subcompile($this->getNode('left')) - ->raw(')') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw(''); - } -} +raw('CoreExtension::matches(') + ->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 index 271b45c..e1bb6bc 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php @@ -1,23 +1,23 @@ -raw('%'); - } -} +raw('%'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php index 6d4c1e0..25352df 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php @@ -1,23 +1,23 @@ -raw('*'); - } -} +raw('*'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php index d137ef6..6735da4 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php @@ -1,39 +1,39 @@ -= 80000) { - parent::compile($compiler); - - return; - } - - $compiler - ->raw('(0 !== CoreExtension::compare(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw('))') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw('!='); - } -} += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(0 !== CoreExtension::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 index 80c8755..284a3cd 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php @@ -1,33 +1,33 @@ -raw('!CoreExtension::inFilter(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw('not in'); - } -} +raw('!CoreExtension::inFilter(') + ->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 index 21f87c9..2da0d41 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php @@ -1,23 +1,23 @@ -raw('||'); - } -} +raw('||'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php index c9f4c66..d40a5ce 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php @@ -1,22 +1,22 @@ -raw('**'); - } -} +raw('**'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php index 55982c8..c1d74c8 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php @@ -1,33 +1,33 @@ -raw('range(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw('..'); - } -} +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 index ae5a4a4..10bbba2 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php @@ -1,22 +1,22 @@ -raw('<=>'); - } -} +raw('<=>'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php index 4519f30..2e518c4 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php @@ -1,35 +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(') && str_starts_with($%1$s, $%2$s))', $left, $right)) - ; - } - - public function operator(Compiler $compiler): Compiler - { - return $compiler->raw(''); - } -} +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(') && str_starts_with($%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 index eeb87fa..3631f28 100644 --- a/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php +++ b/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php @@ -1,23 +1,23 @@ -raw('-'); - } -} +raw('-'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php b/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php index acd231e..b82e19c 100644 --- a/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php +++ b/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php @@ -1,87 +1,87 @@ - - */ -class BlockReferenceExpression extends AbstractExpression -{ - public function __construct(Node $name, ?Node $template, int $lineno) - { - $nodes = ['name' => $name]; - if (null !== $template) { - $nodes['template'] = $template; - } - - parent::__construct($nodes, ['is_defined_test' => false, 'output' => false], $lineno); - } - - public function compile(Compiler $compiler): void - { - if ($this->getAttribute('is_defined_test')) { - $this->compileTemplateCall($compiler, 'hasBlock'); - } else { - if ($this->getAttribute('output')) { - $compiler->addDebugInfo($this); - - $compiler->write('yield from '); - $this - ->compileTemplateCall($compiler, 'yieldBlock') - ->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('->unwrap()->%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(')'); - } -} + + */ +class BlockReferenceExpression extends AbstractExpression +{ + public function __construct(Node $name, ?Node $template, int $lineno) + { + $nodes = ['name' => $name]; + if (null !== $template) { + $nodes['template'] = $template; + } + + parent::__construct($nodes, ['is_defined_test' => false, 'output' => false], $lineno); + } + + public function compile(Compiler $compiler): void + { + if ($this->getAttribute('is_defined_test')) { + $this->compileTemplateCall($compiler, 'hasBlock'); + } else { + if ($this->getAttribute('output')) { + $compiler->addDebugInfo($this); + + $compiler->write('yield from '); + $this + ->compileTemplateCall($compiler, 'yieldBlock') + ->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('->unwrap()->%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 index 6fc6f66..82afea9 100644 --- a/vendor/twig/twig/src/Node/Expression/CallExpression.php +++ b/vendor/twig/twig/src/Node/Expression/CallExpression.php @@ -1,362 +1,362 @@ -getTwigCallable(); - $callable = $twigCallable->getCallable(); - - if (\is_string($callable) && !str_contains($callable, '::')) { - $compiler->raw($callable); - } else { - $rc = $this->reflectCallable($twigCallable); - $r = $rc->getReflector(); - $callable = $rc->getCallable(); - - if (\is_string($callable)) { - $compiler->raw($callable); - } elseif (\is_array($callable) && \is_string($callable[0])) { - if (!$r instanceof \ReflectionMethod || $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 (\is_array($callable) && $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 { - $compiler->raw(\sprintf('$this->env->get%s(\'%s\')->getCallable()', ucfirst($this->getAttribute('type')), $twigCallable->getDynamicName())); - } - } - - $this->compileArguments($compiler); - } - - protected function compileArguments(Compiler $compiler, $isArray = false): void - { - if (\func_num_args() >= 2) { - trigger_deprecation('twig/twig', '3.11', 'Passing a second argument to "%s()" is deprecated.', __METHOD__); - } - - $compiler->raw($isArray ? '[' : '('); - - $first = true; - - $twigCallable = $this->getAttribute('twig_callable'); - - if ($twigCallable->needsCharset()) { - $compiler->raw('$this->env->getCharset()'); - $first = false; - } - - if ($twigCallable->needsEnvironment()) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->raw('$this->env'); - $first = false; - } - - if ($twigCallable->needsContext()) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->raw('$context'); - $first = false; - } - - foreach ($twigCallable->getArguments() 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')) { - $arguments = (new CallableArgumentsExtractor($this, $this->getTwigCallable()))->extractArguments($this->getNode('arguments')); - foreach ($arguments as $node) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->subcompile($node); - $first = false; - } - } - - $compiler->raw($isArray ? ']' : ')'); - } - - /** - * @deprecated since 3.12, use Twig\Util\CallableArgumentsExtractor::getArguments() instead - */ - protected function getArguments($callable, $arguments) - { - trigger_deprecation('twig/twig', '3.12', 'The "%s()" method is deprecated, use Twig\Util\CallableArgumentsExtractor::getArguments() instead.', __METHOD__); - - $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->getAttribute('twig_callable')->isVariadic(); - 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); - } - - [$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; - } - - /** - * @deprecated since 3.12 - */ - protected function normalizeName(string $name): string - { - trigger_deprecation('twig/twig', '3.12', 'The "%s()" method is deprecated.', __METHOD__); - - return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $name)); - } - - // To be removed in 4.0 - private function getCallableParameters($callable, bool $isVariadic): array - { - $twigCallable = $this->getAttribute('twig_callable'); - $rc = $this->reflectCallable($twigCallable); - $r = $rc->getReflector(); - $callableName = $rc->getName(); - - $parameters = $r->getParameters(); - if ($this->hasNode('node')) { - array_shift($parameters); - } - if ($twigCallable->needsCharset()) { - array_shift($parameters); - } - if ($twigCallable->needsEnvironment()) { - array_shift($parameters); - } - if ($twigCallable->needsContext()) { - array_shift($parameters); - } - foreach ($twigCallable->getArguments() as $argument) { - array_shift($parameters); - } - - $isPhpVariadic = false; - if ($isVariadic) { - $argument = end($parameters); - $isArray = $argument && $argument->hasType() && $argument->getType() instanceof \ReflectionNamedType && 'array' === $argument->getType()->getName(); - if ($isArray && $argument->isDefaultValueAvailable() && [] === $argument->getDefaultValue()) { - array_pop($parameters); - } elseif ($argument && $argument->isVariadic()) { - array_pop($parameters); - $isPhpVariadic = true; - } else { - 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'), $twigCallable->getName())); - } - } - - return [$parameters, $isPhpVariadic]; - } - - private function reflectCallable(TwigCallableInterface $callable): ReflectionCallable - { - if (!$this->reflector) { - $this->reflector = new ReflectionCallable($callable); - } - - return $this->reflector; - } - - /** - * Overrides the Twig callable based on attributes (as potentially, attributes changed between the creation and the compilation of the node). - * - * To be removed in 4.0 and replace by $this->getAttribute('twig_callable'). - */ - private function getTwigCallable(): TwigCallableInterface - { - $current = $this->getAttribute('twig_callable'); - - $this->setAttribute('twig_callable', match ($this->getAttribute('type')) { - 'test' => (new TwigTest( - $this->getAttribute('name'), - $this->hasAttribute('callable') ? $this->getAttribute('callable') : $current->getCallable(), - [ - 'is_variadic' => $this->hasAttribute('is_variadic') ? $this->getAttribute('is_variadic') : $current->isVariadic(), - ], - ))->withDynamicArguments($this->getAttribute('name'), $this->hasAttribute('dynamic_name') ? $this->getAttribute('dynamic_name') : $current->getDynamicName(), $this->hasAttribute('arguments') ?: $current->getArguments()), - 'function' => (new TwigFunction( - $this->hasAttribute('name') ? $this->getAttribute('name') : $current->getName(), - $this->hasAttribute('callable') ? $this->getAttribute('callable') : $current->getCallable(), - [ - 'needs_environment' => $this->hasAttribute('needs_environment') ? $this->getAttribute('needs_environment') : $current->needsEnvironment(), - 'needs_context' => $this->hasAttribute('needs_context') ? $this->getAttribute('needs_context') : $current->needsContext(), - 'needs_charset' => $this->hasAttribute('needs_charset') ? $this->getAttribute('needs_charset') : $current->needsCharset(), - 'is_variadic' => $this->hasAttribute('is_variadic') ? $this->getAttribute('is_variadic') : $current->isVariadic(), - ], - ))->withDynamicArguments($this->getAttribute('name'), $this->hasAttribute('dynamic_name') ? $this->getAttribute('dynamic_name') : $current->getDynamicName(), $this->hasAttribute('arguments') ?: $current->getArguments()), - 'filter' => (new TwigFilter( - $this->getAttribute('name'), - $this->hasAttribute('callable') ? $this->getAttribute('callable') : $current->getCallable(), - [ - 'needs_environment' => $this->hasAttribute('needs_environment') ? $this->getAttribute('needs_environment') : $current->needsEnvironment(), - 'needs_context' => $this->hasAttribute('needs_context') ? $this->getAttribute('needs_context') : $current->needsContext(), - 'needs_charset' => $this->hasAttribute('needs_charset') ? $this->getAttribute('needs_charset') : $current->needsCharset(), - 'is_variadic' => $this->hasAttribute('is_variadic') ? $this->getAttribute('is_variadic') : $current->isVariadic(), - ], - ))->withDynamicArguments($this->getAttribute('name'), $this->hasAttribute('dynamic_name') ? $this->getAttribute('dynamic_name') : $current->getDynamicName(), $this->hasAttribute('arguments') ?: $current->getArguments()), - }); - - return $this->getAttribute('twig_callable'); - } -} +getTwigCallable(); + $callable = $twigCallable->getCallable(); + + if (\is_string($callable) && !str_contains($callable, '::')) { + $compiler->raw($callable); + } else { + $rc = $this->reflectCallable($twigCallable); + $r = $rc->getReflector(); + $callable = $rc->getCallable(); + + if (\is_string($callable)) { + $compiler->raw($callable); + } elseif (\is_array($callable) && \is_string($callable[0])) { + if (!$r instanceof \ReflectionMethod || $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 (\is_array($callable) && $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 { + $compiler->raw(\sprintf('$this->env->get%s(\'%s\')->getCallable()', ucfirst($this->getAttribute('type')), $twigCallable->getDynamicName())); + } + } + + $this->compileArguments($compiler); + } + + protected function compileArguments(Compiler $compiler, $isArray = false): void + { + if (\func_num_args() >= 2) { + trigger_deprecation('twig/twig', '3.11', 'Passing a second argument to "%s()" is deprecated.', __METHOD__); + } + + $compiler->raw($isArray ? '[' : '('); + + $first = true; + + $twigCallable = $this->getAttribute('twig_callable'); + + if ($twigCallable->needsCharset()) { + $compiler->raw('$this->env->getCharset()'); + $first = false; + } + + if ($twigCallable->needsEnvironment()) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->raw('$this->env'); + $first = false; + } + + if ($twigCallable->needsContext()) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->raw('$context'); + $first = false; + } + + foreach ($twigCallable->getArguments() 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')) { + $arguments = (new CallableArgumentsExtractor($this, $this->getTwigCallable()))->extractArguments($this->getNode('arguments')); + foreach ($arguments as $node) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->subcompile($node); + $first = false; + } + } + + $compiler->raw($isArray ? ']' : ')'); + } + + /** + * @deprecated since 3.12, use Twig\Util\CallableArgumentsExtractor::getArguments() instead + */ + protected function getArguments($callable, $arguments) + { + trigger_deprecation('twig/twig', '3.12', 'The "%s()" method is deprecated, use Twig\Util\CallableArgumentsExtractor::getArguments() instead.', __METHOD__); + + $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->getAttribute('twig_callable')->isVariadic(); + 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); + } + + [$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; + } + + /** + * @deprecated since 3.12 + */ + protected function normalizeName(string $name): string + { + trigger_deprecation('twig/twig', '3.12', 'The "%s()" method is deprecated.', __METHOD__); + + return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $name)); + } + + // To be removed in 4.0 + private function getCallableParameters($callable, bool $isVariadic): array + { + $twigCallable = $this->getAttribute('twig_callable'); + $rc = $this->reflectCallable($twigCallable); + $r = $rc->getReflector(); + $callableName = $rc->getName(); + + $parameters = $r->getParameters(); + if ($this->hasNode('node')) { + array_shift($parameters); + } + if ($twigCallable->needsCharset()) { + array_shift($parameters); + } + if ($twigCallable->needsEnvironment()) { + array_shift($parameters); + } + if ($twigCallable->needsContext()) { + array_shift($parameters); + } + foreach ($twigCallable->getArguments() as $argument) { + array_shift($parameters); + } + + $isPhpVariadic = false; + if ($isVariadic) { + $argument = end($parameters); + $isArray = $argument && $argument->hasType() && $argument->getType() instanceof \ReflectionNamedType && 'array' === $argument->getType()->getName(); + if ($isArray && $argument->isDefaultValueAvailable() && [] === $argument->getDefaultValue()) { + array_pop($parameters); + } elseif ($argument && $argument->isVariadic()) { + array_pop($parameters); + $isPhpVariadic = true; + } else { + 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'), $twigCallable->getName())); + } + } + + return [$parameters, $isPhpVariadic]; + } + + private function reflectCallable(TwigCallableInterface $callable): ReflectionCallable + { + if (!$this->reflector) { + $this->reflector = new ReflectionCallable($callable); + } + + return $this->reflector; + } + + /** + * Overrides the Twig callable based on attributes (as potentially, attributes changed between the creation and the compilation of the node). + * + * To be removed in 4.0 and replace by $this->getAttribute('twig_callable'). + */ + private function getTwigCallable(): TwigCallableInterface + { + $current = $this->getAttribute('twig_callable'); + + $this->setAttribute('twig_callable', match ($this->getAttribute('type')) { + 'test' => (new TwigTest( + $this->getAttribute('name'), + $this->hasAttribute('callable') ? $this->getAttribute('callable') : $current->getCallable(), + [ + 'is_variadic' => $this->hasAttribute('is_variadic') ? $this->getAttribute('is_variadic') : $current->isVariadic(), + ], + ))->withDynamicArguments($this->getAttribute('name'), $this->hasAttribute('dynamic_name') ? $this->getAttribute('dynamic_name') : $current->getDynamicName(), $this->hasAttribute('arguments') ?: $current->getArguments()), + 'function' => (new TwigFunction( + $this->hasAttribute('name') ? $this->getAttribute('name') : $current->getName(), + $this->hasAttribute('callable') ? $this->getAttribute('callable') : $current->getCallable(), + [ + 'needs_environment' => $this->hasAttribute('needs_environment') ? $this->getAttribute('needs_environment') : $current->needsEnvironment(), + 'needs_context' => $this->hasAttribute('needs_context') ? $this->getAttribute('needs_context') : $current->needsContext(), + 'needs_charset' => $this->hasAttribute('needs_charset') ? $this->getAttribute('needs_charset') : $current->needsCharset(), + 'is_variadic' => $this->hasAttribute('is_variadic') ? $this->getAttribute('is_variadic') : $current->isVariadic(), + ], + ))->withDynamicArguments($this->getAttribute('name'), $this->hasAttribute('dynamic_name') ? $this->getAttribute('dynamic_name') : $current->getDynamicName(), $this->hasAttribute('arguments') ?: $current->getArguments()), + 'filter' => (new TwigFilter( + $this->getAttribute('name'), + $this->hasAttribute('callable') ? $this->getAttribute('callable') : $current->getCallable(), + [ + 'needs_environment' => $this->hasAttribute('needs_environment') ? $this->getAttribute('needs_environment') : $current->needsEnvironment(), + 'needs_context' => $this->hasAttribute('needs_context') ? $this->getAttribute('needs_context') : $current->needsContext(), + 'needs_charset' => $this->hasAttribute('needs_charset') ? $this->getAttribute('needs_charset') : $current->needsCharset(), + 'is_variadic' => $this->hasAttribute('is_variadic') ? $this->getAttribute('is_variadic') : $current->isVariadic(), + ], + ))->withDynamicArguments($this->getAttribute('name'), $this->hasAttribute('dynamic_name') ? $this->getAttribute('dynamic_name') : $current->getDynamicName(), $this->hasAttribute('arguments') ?: $current->getArguments()), + }); + + return $this->getAttribute('twig_callable'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php b/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php index d7db993..282b7a5 100644 --- a/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php +++ b/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php @@ -1,45 +1,45 @@ - $expr1, 'expr2' => $expr2, 'expr3' => $expr3], [], $lineno); - } - - public function compile(Compiler $compiler): void - { - // Ternary with no then uses Elvis operator - if ($this->getNode('expr1') === $this->getNode('expr2')) { - $compiler - ->raw('((') - ->subcompile($this->getNode('expr1')) - ->raw(') ?: (') - ->subcompile($this->getNode('expr3')) - ->raw('))'); - } else { - $compiler - ->raw('((') - ->subcompile($this->getNode('expr1')) - ->raw(') ? (') - ->subcompile($this->getNode('expr2')) - ->raw(') : (') - ->subcompile($this->getNode('expr3')) - ->raw('))'); - } - } -} + $expr1, 'expr2' => $expr2, 'expr3' => $expr3], [], $lineno); + } + + public function compile(Compiler $compiler): void + { + // Ternary with no then uses Elvis operator + if ($this->getNode('expr1') === $this->getNode('expr2')) { + $compiler + ->raw('((') + ->subcompile($this->getNode('expr1')) + ->raw(') ?: (') + ->subcompile($this->getNode('expr3')) + ->raw('))'); + } else { + $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 index 2a8909d..5c275c0 100644 --- a/vendor/twig/twig/src/Node/Expression/ConstantExpression.php +++ b/vendor/twig/twig/src/Node/Expression/ConstantExpression.php @@ -1,31 +1,31 @@ - $value], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler->repr($this->getAttribute('value')); - } -} + $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 index 75b6d18..c8be8d2 100644 --- a/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php +++ b/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php @@ -1,63 +1,63 @@ - - */ -class DefaultFilter extends FilterExpression -{ - #[FirstClassTwigCallableReady] - public function __construct(Node $node, TwigFilter|ConstantExpression $filter, Node $arguments, int $lineno) - { - if ($filter instanceof TwigFilter) { - $name = $filter->getName(); - $default = new FilterExpression($node, $filter, $arguments, $node->getTemplateLine()); - } else { - $name = $filter->getAttribute('value'); - $default = new FilterExpression($node, new TwigFilter('default', [CoreExtension::class, 'default']), $arguments, $node->getTemplateLine()); - } - - if ('default' === $name && ($node instanceof NameExpression || $node instanceof GetAttrExpression)) { - $test = new DefinedTest(clone $node, new TwigTest('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, $filter, $arguments, $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler->subcompile($this->getNode('node')); - } -} + + */ +class DefaultFilter extends FilterExpression +{ + #[FirstClassTwigCallableReady] + public function __construct(Node $node, TwigFilter|ConstantExpression $filter, Node $arguments, int $lineno) + { + if ($filter instanceof TwigFilter) { + $name = $filter->getName(); + $default = new FilterExpression($node, $filter, $arguments, $node->getTemplateLine()); + } else { + $name = $filter->getAttribute('value'); + $default = new FilterExpression($node, new TwigFilter('default', [CoreExtension::class, 'default']), $arguments, $node->getTemplateLine()); + } + + if ('default' === $name && ($node instanceof NameExpression || $node instanceof GetAttrExpression)) { + $test = new DefinedTest(clone $node, new TwigTest('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, $filter, $arguments, $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler->subcompile($this->getNode('node')); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Filter/RawFilter.php b/vendor/twig/twig/src/Node/Expression/Filter/RawFilter.php index e115ab1..7e6825b 100644 --- a/vendor/twig/twig/src/Node/Expression/Filter/RawFilter.php +++ b/vendor/twig/twig/src/Node/Expression/Filter/RawFilter.php @@ -1,36 +1,36 @@ - - */ -class RawFilter extends FilterExpression -{ - #[FirstClassTwigCallableReady] - public function __construct(Node $node, TwigFilter|ConstantExpression|null $filter = null, ?Node $arguments = null, int $lineno = 0) - { - parent::__construct($node, $filter ?: new TwigFilter('raw', null, ['is_safe' => ['all']]), $arguments ?: new Node(), $lineno ?: $node->getTemplateLine()); - } - - public function compile(Compiler $compiler): void - { - $compiler->subcompile($this->getNode('node')); - } -} + + */ +class RawFilter extends FilterExpression +{ + #[FirstClassTwigCallableReady] + public function __construct(Node $node, TwigFilter|ConstantExpression|null $filter = null, ?Node $arguments = null, int $lineno = 0) + { + parent::__construct($node, $filter ?: new TwigFilter('raw', null, ['is_safe' => ['all']]), $arguments ?: new Node(), $lineno ?: $node->getTemplateLine()); + } + + 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 index efc9119..526a63d 100644 --- a/vendor/twig/twig/src/Node/Expression/FilterExpression.php +++ b/vendor/twig/twig/src/Node/Expression/FilterExpression.php @@ -1,73 +1,73 @@ -getName(); - $filterName = new ConstantExpression($name, $lineno); - } else { - $name = $filter->getAttribute('value'); - $filterName = $filter; - trigger_deprecation('twig/twig', '3.12', 'Not passing an instance of "TwigFilter" when creating a "%s" filter of type "%s" is deprecated.', $name, static::class); - } - - parent::__construct(['node' => $node, 'filter' => $filterName, 'arguments' => $arguments], ['name' => $name, 'type' => 'filter'], $lineno); - - if ($filter instanceof TwigFilter) { - $this->setAttribute('twig_callable', $filter); - } - - $this->deprecateNode('filter', new NameDeprecation('twig/twig', '3.12')); - - $this->deprecateAttribute('needs_charset', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('needs_environment', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('needs_context', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('arguments', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('callable', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('is_variadic', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('dynamic_name', new NameDeprecation('twig/twig', '3.12')); - } - - public function compile(Compiler $compiler): void - { - $name = $this->getNode('filter', false)->getAttribute('value'); - if ($name !== $this->getAttribute('name')) { - trigger_deprecation('twig/twig', '3.11', 'Changing the value of a "filter" node in a NodeVisitor class is not supported anymore.'); - $this->removeAttribute('twig_callable'); - } - if ('raw' === $name) { - trigger_deprecation('twig/twig', '3.11', 'Creating the "raw" filter via "FilterExpression" is deprecated; use "RawFilter" instead.'); - - $compiler->subcompile($this->getNode('node')); - - return; - } - - if (!$this->hasAttribute('twig_callable')) { - $this->setAttribute('twig_callable', $compiler->getEnvironment()->getFilter($name)); - } - - $this->compileCallable($compiler); - } -} +getName(); + $filterName = new ConstantExpression($name, $lineno); + } else { + $name = $filter->getAttribute('value'); + $filterName = $filter; + trigger_deprecation('twig/twig', '3.12', 'Not passing an instance of "TwigFilter" when creating a "%s" filter of type "%s" is deprecated.', $name, static::class); + } + + parent::__construct(['node' => $node, 'filter' => $filterName, 'arguments' => $arguments], ['name' => $name, 'type' => 'filter'], $lineno); + + if ($filter instanceof TwigFilter) { + $this->setAttribute('twig_callable', $filter); + } + + $this->deprecateNode('filter', new NameDeprecation('twig/twig', '3.12')); + + $this->deprecateAttribute('needs_charset', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('needs_environment', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('needs_context', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('arguments', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('callable', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('is_variadic', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('dynamic_name', new NameDeprecation('twig/twig', '3.12')); + } + + public function compile(Compiler $compiler): void + { + $name = $this->getNode('filter', false)->getAttribute('value'); + if ($name !== $this->getAttribute('name')) { + trigger_deprecation('twig/twig', '3.11', 'Changing the value of a "filter" node in a NodeVisitor class is not supported anymore.'); + $this->removeAttribute('twig_callable'); + } + if ('raw' === $name) { + trigger_deprecation('twig/twig', '3.11', 'Creating the "raw" filter via "FilterExpression" is deprecated; use "RawFilter" instead.'); + + $compiler->subcompile($this->getNode('node')); + + return; + } + + if (!$this->hasAttribute('twig_callable')) { + $this->setAttribute('twig_callable', $compiler->getEnvironment()->getFilter($name)); + } + + $this->compileCallable($compiler); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/FunctionExpression.php b/vendor/twig/twig/src/Node/Expression/FunctionExpression.php index 6215c6a..e9b553c 100644 --- a/vendor/twig/twig/src/Node/Expression/FunctionExpression.php +++ b/vendor/twig/twig/src/Node/Expression/FunctionExpression.php @@ -1,68 +1,68 @@ -getName(); - } else { - $name = $function; - trigger_deprecation('twig/twig', '3.12', 'Not passing an instance of "TwigFunction" when creating a "%s" function of type "%s" is deprecated.', $name, static::class); - } - - parent::__construct(['arguments' => $arguments], ['name' => $name, 'type' => 'function', 'is_defined_test' => false], $lineno); - - if ($function instanceof TwigFunction) { - $this->setAttribute('twig_callable', $function); - } - - $this->deprecateAttribute('needs_charset', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('needs_environment', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('needs_context', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('arguments', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('callable', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('is_variadic', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('dynamic_name', new NameDeprecation('twig/twig', '3.12')); - } - - public function compile(Compiler $compiler) - { - $name = $this->getAttribute('name'); - if ($this->hasAttribute('twig_callable')) { - $name = $this->getAttribute('twig_callable')->getName(); - if ($name !== $this->getAttribute('name')) { - trigger_deprecation('twig/twig', '3.12', 'Changing the value of a "function" node in a NodeVisitor class is not supported anymore.'); - $this->removeAttribute('twig_callable'); - } - } - - if (!$this->hasAttribute('twig_callable')) { - $this->setAttribute('twig_callable', $compiler->getEnvironment()->getFunction($name)); - } - - if ('constant' === $name && $this->getAttribute('is_defined_test')) { - $this->getNode('arguments')->setNode('checkDefined', new ConstantExpression(true, $this->getTemplateLine())); - } - - $this->compileCallable($compiler); - } -} +getName(); + } else { + $name = $function; + trigger_deprecation('twig/twig', '3.12', 'Not passing an instance of "TwigFunction" when creating a "%s" function of type "%s" is deprecated.', $name, static::class); + } + + parent::__construct(['arguments' => $arguments], ['name' => $name, 'type' => 'function', 'is_defined_test' => false], $lineno); + + if ($function instanceof TwigFunction) { + $this->setAttribute('twig_callable', $function); + } + + $this->deprecateAttribute('needs_charset', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('needs_environment', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('needs_context', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('arguments', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('callable', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('is_variadic', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('dynamic_name', new NameDeprecation('twig/twig', '3.12')); + } + + public function compile(Compiler $compiler) + { + $name = $this->getAttribute('name'); + if ($this->hasAttribute('twig_callable')) { + $name = $this->getAttribute('twig_callable')->getName(); + if ($name !== $this->getAttribute('name')) { + trigger_deprecation('twig/twig', '3.12', 'Changing the value of a "function" node in a NodeVisitor class is not supported anymore.'); + $this->removeAttribute('twig_callable'); + } + } + + if (!$this->hasAttribute('twig_callable')) { + $this->setAttribute('twig_callable', $compiler->getEnvironment()->getFunction($name)); + } + + if ('constant' === $name && $this->getAttribute('is_defined_test')) { + $this->getNode('arguments')->setNode('checkDefined', new ConstantExpression(true, $this->getTemplateLine())); + } + + $this->compileCallable($compiler); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/FunctionNode/EnumCasesFunction.php b/vendor/twig/twig/src/Node/Expression/FunctionNode/EnumCasesFunction.php index 7e5c25f..8b8340b 100644 --- a/vendor/twig/twig/src/Node/Expression/FunctionNode/EnumCasesFunction.php +++ b/vendor/twig/twig/src/Node/Expression/FunctionNode/EnumCasesFunction.php @@ -1,41 +1,41 @@ -getNode('arguments'); - if ($arguments->hasNode('enum')) { - $firstArgument = $arguments->getNode('enum'); - } elseif ($arguments->hasNode('0')) { - $firstArgument = $arguments->getNode('0'); - } else { - $firstArgument = null; - } - - if (!$firstArgument instanceof ConstantExpression || 1 !== \count($arguments)) { - parent::compile($compiler); - - return; - } - - $value = $firstArgument->getAttribute('value'); - - if (!\is_string($value)) { - throw new SyntaxError('The first argument of the "enum_cases" function must be a string.', $this->getTemplateLine(), $this->getSourceContext()); - } - - if (!enum_exists($value)) { - throw new SyntaxError(\sprintf('The first argument of the "enum_cases" function must be the name of an enum, "%s" given.', $value), $this->getTemplateLine(), $this->getSourceContext()); - } - - $compiler->raw(\sprintf('%s::cases()', $value)); - } -} +getNode('arguments'); + if ($arguments->hasNode('enum')) { + $firstArgument = $arguments->getNode('enum'); + } elseif ($arguments->hasNode('0')) { + $firstArgument = $arguments->getNode('0'); + } else { + $firstArgument = null; + } + + if (!$firstArgument instanceof ConstantExpression || 1 !== \count($arguments)) { + parent::compile($compiler); + + return; + } + + $value = $firstArgument->getAttribute('value'); + + if (!\is_string($value)) { + throw new SyntaxError('The first argument of the "enum_cases" function must be a string.', $this->getTemplateLine(), $this->getSourceContext()); + } + + if (!enum_exists($value)) { + throw new SyntaxError(\sprintf('The first argument of the "enum_cases" function must be the name of an enum, "%s" given.', $value), $this->getTemplateLine(), $this->getSourceContext()); + } + + $compiler->raw(\sprintf('%s::cases()', $value)); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php b/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php index 29a446b..030b56d 100644 --- a/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php +++ b/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php @@ -1,87 +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('CoreExtension::getAttribute($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(')') - ; - } -} + $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('CoreExtension::getAttribute($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 index 0a3c2e4..00a7fb1 100644 --- a/vendor/twig/twig/src/Node/Expression/InlinePrint.php +++ b/vendor/twig/twig/src/Node/Expression/InlinePrint.php @@ -1,34 +1,34 @@ - $node], [], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler - ->raw('yield ') - ->subcompile($this->getNode('node')) - ; - } -} + $node], [], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->raw('yield ') + ->subcompile($this->getNode('node')) + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php b/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php index 01806f9..35c868e 100644 --- a/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php +++ b/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php @@ -1,64 +1,64 @@ - $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('CoreExtension::callMacro($macros[') - ->repr($this->getNode('node')->getAttribute('name')) - ->raw('], ') - ->repr($this->getAttribute('method')) - ->raw(', [') - ; - $first = true; - /** @var ArrayExpression */ - $args = $this->getNode('arguments'); - foreach ($args->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - $compiler->subcompile($pair['value']); - } - $compiler - ->raw('], ') - ->repr($this->getTemplateLine()) - ->raw(', $context, $this->getSourceContext())'); - } -} + $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('CoreExtension::callMacro($macros[') + ->repr($this->getNode('node')->getAttribute('name')) + ->raw('], ') + ->repr($this->getAttribute('method')) + ->raw(', [') + ; + $first = true; + /** @var ArrayExpression */ + $args = $this->getNode('arguments'); + foreach ($args->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 index 286aa5a..823e1dc 100644 --- a/vendor/twig/twig/src/Node/Expression/NameExpression.php +++ b/vendor/twig/twig/src/Node/Expression/NameExpression.php @@ -1,107 +1,107 @@ - '$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 (isset($this->specialVars[$name])) { - $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 (isset($this->specialVars[$name])) { - $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(')') - ; - } - } - } - - /** - * @deprecated since Twig 3.11 (to be removed in 4.0) - */ - public function isSpecial() - { - trigger_deprecation('twig/twig', '3.11', 'The "%s()" method is deprecated and will be removed in Twig 4.0.', __METHOD__); - - return isset($this->specialVars[$this->getAttribute('name')]); - } - - /** - * @deprecated since Twig 3.11 (to be removed in 4.0) - */ - public function isSimple() - { - trigger_deprecation('twig/twig', '3.11', 'The "%s()" method is deprecated and will be removed in Twig 4.0.', __METHOD__); - - return !$this->isSpecial() && !$this->getAttribute('is_defined_test'); - } -} + '$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 (isset($this->specialVars[$name])) { + $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 (isset($this->specialVars[$name])) { + $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(')') + ; + } + } + } + + /** + * @deprecated since Twig 3.11 (to be removed in 4.0) + */ + public function isSpecial() + { + trigger_deprecation('twig/twig', '3.11', 'The "%s()" method is deprecated and will be removed in Twig 4.0.', __METHOD__); + + return isset($this->specialVars[$this->getAttribute('name')]); + } + + /** + * @deprecated since Twig 3.11 (to be removed in 4.0) + */ + public function isSimple() + { + trigger_deprecation('twig/twig', '3.11', 'The "%s()" method is deprecated and will be removed in Twig 4.0.', __METHOD__); + + 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 index 98630f7..2bb45c3 100644 --- a/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php +++ b/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php @@ -1,61 +1,61 @@ -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, new TwigTest('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); - } - } -} +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, new TwigTest('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 index 22fe38f..25bb991 100644 --- a/vendor/twig/twig/src/Node/Expression/ParentExpression.php +++ b/vendor/twig/twig/src/Node/Expression/ParentExpression.php @@ -1,46 +1,46 @@ - - */ -class ParentExpression extends AbstractExpression -{ - public function __construct(string $name, int $lineno) - { - parent::__construct([], ['output' => false, 'name' => $name], $lineno); - } - - public function compile(Compiler $compiler): void - { - if ($this->getAttribute('output')) { - $compiler - ->addDebugInfo($this) - ->write('yield from $this->yieldParentBlock(') - ->string($this->getAttribute('name')) - ->raw(", \$context, \$blocks);\n") - ; - } else { - $compiler - ->raw('$this->renderParentBlock(') - ->string($this->getAttribute('name')) - ->raw(', $context, $blocks)') - ; - } - } -} + + */ +class ParentExpression extends AbstractExpression +{ + public function __construct(string $name, int $lineno) + { + parent::__construct([], ['output' => false, 'name' => $name], $lineno); + } + + public function compile(Compiler $compiler): void + { + if ($this->getAttribute('output')) { + $compiler + ->addDebugInfo($this) + ->write('yield from $this->yieldParentBlock(') + ->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 index 004c704..abbdc3f 100644 --- a/vendor/twig/twig/src/Node/Expression/TempNameExpression.php +++ b/vendor/twig/twig/src/Node/Expression/TempNameExpression.php @@ -1,31 +1,31 @@ - $name], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler - ->raw('$_') - ->raw($this->getAttribute('name')) - ->raw('_') - ; - } -} + $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 index 867fd09..848aacf 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php @@ -1,49 +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('))') - ; - } -} + + */ +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 index 24d3ee8..556cea7 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php @@ -1,81 +1,81 @@ - - */ -class DefinedTest extends TestExpression -{ - #[FirstClassTwigCallableReady] - public function __construct(Node $node, TwigTest|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); - } - - if (\is_string($name) && 'defined' !== $name) { - trigger_deprecation('twig/twig', '3.12', 'Creating a "DefinedTest" instance with a test name that is not "defined" is deprecated.'); - } - - 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')); - } -} + + */ +class DefinedTest extends TestExpression +{ + #[FirstClassTwigCallableReady] + public function __construct(Node $node, TwigTest|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); + } + + if (\is_string($name) && 'defined' !== $name) { + trigger_deprecation('twig/twig', '3.12', 'Creating a "DefinedTest" instance with a test name that is not "defined" is deprecated.'); + } + + 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 index 90d58a4..51ff1da 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php @@ -1,36 +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(')') - ; - } -} + + */ +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 index a0e3ed6..b0fe6e3 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php @@ -1,35 +1,35 @@ - - */ -class EvenTest extends TestExpression -{ - public function compile(Compiler $compiler): void - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 0') - ->raw(')') - ; - } -} + + */ +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 index 45b54ae..2051010 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/NullTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/NullTest.php @@ -1,34 +1,34 @@ - - */ -class NullTest extends TestExpression -{ - public function compile(Compiler $compiler): void - { - $compiler - ->raw('(null === ') - ->subcompile($this->getNode('node')) - ->raw(')') - ; - } -} + + */ +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 index d56c711..f192a50 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/OddTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/OddTest.php @@ -1,35 +1,35 @@ - - */ -class OddTest extends TestExpression -{ - public function compile(Compiler $compiler): void - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 != 0') - ->raw(')') - ; - } -} + + */ +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 index f1e24db..54bc6a7 100644 --- a/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php +++ b/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php @@ -1,34 +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(')') - ; - } -} + + */ +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 index 080d85a..a68627d 100644 --- a/vendor/twig/twig/src/Node/Expression/TestExpression.php +++ b/vendor/twig/twig/src/Node/Expression/TestExpression.php @@ -1,66 +1,66 @@ - $node]; - if (null !== $arguments) { - $nodes['arguments'] = $arguments; - } - - if ($test instanceof TwigTest) { - $name = $test->getName(); - } else { - $name = $test; - trigger_deprecation('twig/twig', '3.12', 'Not passing an instance of "TwigTest" when creating a "%s" test of type "%s" is deprecated.', $name, static::class); - } - - parent::__construct($nodes, ['name' => $name, 'type' => 'test'], $lineno); - - if ($test instanceof TwigTest) { - $this->setAttribute('twig_callable', $test); - } - - $this->deprecateAttribute('arguments', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('callable', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('is_variadic', new NameDeprecation('twig/twig', '3.12')); - $this->deprecateAttribute('dynamic_name', new NameDeprecation('twig/twig', '3.12')); - } - - public function compile(Compiler $compiler): void - { - $name = $this->getAttribute('name'); - if ($this->hasAttribute('twig_callable')) { - $name = $this->getAttribute('twig_callable')->getName(); - if ($name !== $this->getAttribute('name')) { - trigger_deprecation('twig/twig', '3.12', 'Changing the value of a "test" node in a NodeVisitor class is not supported anymore.'); - $this->removeAttribute('twig_callable'); - } - } - - if (!$this->hasAttribute('twig_callable')) { - $this->setAttribute('twig_callable', $compiler->getEnvironment()->getTest($this->getAttribute('name'))); - } - - $this->compileCallable($compiler); - } -} + $node]; + if (null !== $arguments) { + $nodes['arguments'] = $arguments; + } + + if ($test instanceof TwigTest) { + $name = $test->getName(); + } else { + $name = $test; + trigger_deprecation('twig/twig', '3.12', 'Not passing an instance of "TwigTest" when creating a "%s" test of type "%s" is deprecated.', $name, static::class); + } + + parent::__construct($nodes, ['name' => $name, 'type' => 'test'], $lineno); + + if ($test instanceof TwigTest) { + $this->setAttribute('twig_callable', $test); + } + + $this->deprecateAttribute('arguments', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('callable', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('is_variadic', new NameDeprecation('twig/twig', '3.12')); + $this->deprecateAttribute('dynamic_name', new NameDeprecation('twig/twig', '3.12')); + } + + public function compile(Compiler $compiler): void + { + $name = $this->getAttribute('name'); + if ($this->hasAttribute('twig_callable')) { + $name = $this->getAttribute('twig_callable')->getName(); + if ($name !== $this->getAttribute('name')) { + trigger_deprecation('twig/twig', '3.12', 'Changing the value of a "test" node in a NodeVisitor class is not supported anymore.'); + $this->removeAttribute('twig_callable'); + } + } + + if (!$this->hasAttribute('twig_callable')) { + $this->setAttribute('twig_callable', $compiler->getEnvironment()->getTest($this->getAttribute('name'))); + } + + $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 index e31e3f8..0e24074 100644 --- a/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php +++ b/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php @@ -1,34 +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; -} + $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 index dc2f235..f26e1d7 100644 --- a/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php +++ b/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php @@ -1,23 +1,23 @@ -raw('-'); - } -} +raw('-'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php b/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php index 55c11ba..b5c7b8c 100644 --- a/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php +++ b/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php @@ -1,23 +1,23 @@ -raw('!'); - } -} +raw('!'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php b/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php index 4b0a062..5fee2a7 100644 --- a/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php +++ b/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php @@ -1,23 +1,23 @@ -raw('+'); - } -} +raw('+'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/VariadicExpression.php b/vendor/twig/twig/src/Node/Expression/VariadicExpression.php index a1bdb48..85ac31a 100644 --- a/vendor/twig/twig/src/Node/Expression/VariadicExpression.php +++ b/vendor/twig/twig/src/Node/Expression/VariadicExpression.php @@ -1,24 +1,24 @@ -raw('...'); - - parent::compile($compiler); - } -} +raw('...'); + + parent::compile($compiler); + } +} diff --git a/vendor/twig/twig/src/Node/FlushNode.php b/vendor/twig/twig/src/Node/FlushNode.php index ff3bd1c..38e7b92 100644 --- a/vendor/twig/twig/src/Node/FlushNode.php +++ b/vendor/twig/twig/src/Node/FlushNode.php @@ -1,40 +1,40 @@ - - */ -#[YieldReady] -class FlushNode extends Node -{ - public function __construct(int $lineno) - { - parent::__construct([], [], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler->addDebugInfo($this); - - if ($compiler->getEnvironment()->useYield()) { - $compiler->write("yield '';\n"); - } - - $compiler->write("flush();\n"); - } -} + + */ +#[YieldReady] +class FlushNode extends Node +{ + public function __construct(int $lineno) + { + parent::__construct([], [], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + + if ($compiler->getEnvironment()->useYield()) { + $compiler->write("yield '';\n"); + } + + $compiler->write("flush();\n"); + } +} diff --git a/vendor/twig/twig/src/Node/ForLoopNode.php b/vendor/twig/twig/src/Node/ForLoopNode.php index 1f0a4f3..8f01496 100644 --- a/vendor/twig/twig/src/Node/ForLoopNode.php +++ b/vendor/twig/twig/src/Node/ForLoopNode.php @@ -1,51 +1,51 @@ - - */ -#[YieldReady] -class ForLoopNode extends Node -{ - public function __construct(int $lineno) - { - parent::__construct([], ['with_loop' => false, 'ifexpr' => false, 'else' => false], $lineno); - } - - 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']['revindex0'], \$context['loop']['revindex'])) {\n") - ->indent() - ->write("--\$context['loop']['revindex0'];\n") - ->write("--\$context['loop']['revindex'];\n") - ->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n") - ->outdent() - ->write("}\n") - ; - } - } -} + + */ +#[YieldReady] +class ForLoopNode extends Node +{ + public function __construct(int $lineno) + { + parent::__construct([], ['with_loop' => false, 'ifexpr' => false, 'else' => false], $lineno); + } + + 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']['revindex0'], \$context['loop']['revindex'])) {\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 index 2fc0147..e1dd8d4 100644 --- a/vendor/twig/twig/src/Node/ForNode.php +++ b/vendor/twig/twig/src/Node/ForNode.php @@ -1,116 +1,116 @@ - - */ -#[YieldReady] -class ForNode extends Node -{ - private $loop; - - public function __construct(AssignNameExpression $keyTarget, AssignNameExpression $valueTarget, AbstractExpression $seq, ?Node $ifexpr, Node $body, ?Node $else, int $lineno) - { - $body = new Node([$body, $this->loop = new ForLoopNode($lineno)]); - - $nodes = ['key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body]; - if (null !== $else) { - $nodes['else'] = $else; - } - - parent::__construct($nodes, ['with_loop' => true], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler - ->addDebugInfo($this) - ->write("\$context['_parent'] = \$context;\n") - ->write("\$context['_seq'] = CoreExtension::ensureTraversable(") - ->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[\''.$this->getNode('key_target')->getAttribute('name').'\'], $context[\''.$this->getNode('value_target')->getAttribute('name').'\'], $context[\'_parent\']'); - if ($this->hasNode('else')) { - $compiler->raw(', $context[\'_iterated\']'); - } - if ($this->getAttribute('with_loop')) { - $compiler->raw(', $context[\'loop\']'); - } - $compiler->raw(");\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"); - } -} + + */ +#[YieldReady] +class ForNode extends Node +{ + private $loop; + + public function __construct(AssignNameExpression $keyTarget, AssignNameExpression $valueTarget, AbstractExpression $seq, ?Node $ifexpr, Node $body, ?Node $else, int $lineno) + { + $body = new Node([$body, $this->loop = new ForLoopNode($lineno)]); + + $nodes = ['key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body]; + if (null !== $else) { + $nodes['else'] = $else; + } + + parent::__construct($nodes, ['with_loop' => true], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write("\$context['_parent'] = \$context;\n") + ->write("\$context['_seq'] = CoreExtension::ensureTraversable(") + ->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[\''.$this->getNode('key_target')->getAttribute('name').'\'], $context[\''.$this->getNode('value_target')->getAttribute('name').'\'], $context[\'_parent\']'); + if ($this->hasNode('else')) { + $compiler->raw(', $context[\'_iterated\']'); + } + if ($this->getAttribute('with_loop')) { + $compiler->raw(', $context[\'loop\']'); + } + $compiler->raw(");\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 index 2af48fa..5dd5deb 100644 --- a/vendor/twig/twig/src/Node/IfNode.php +++ b/vendor/twig/twig/src/Node/IfNode.php @@ -1,75 +1,75 @@ - - */ -#[YieldReady] -class IfNode extends Node -{ - public function __construct(Node $tests, ?Node $else, int $lineno) - { - $nodes = ['tests' => $tests]; - if (null !== $else) { - $nodes['else'] = $else; - } - - parent::__construct($nodes, [], $lineno); - } - - 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((string) $i)) - ->raw(") {\n") - ->indent() - ; - // The node might not exists if the content is empty - if ($this->getNode('tests')->hasNode((string) ($i + 1))) { - $compiler->subcompile($this->getNode('tests')->getNode((string) ($i + 1))); - } - } - - if ($this->hasNode('else')) { - $compiler - ->outdent() - ->write("} else {\n") - ->indent() - ->subcompile($this->getNode('else')) - ; - } - - $compiler - ->outdent() - ->write("}\n"); - } -} + + */ +#[YieldReady] +class IfNode extends Node +{ + public function __construct(Node $tests, ?Node $else, int $lineno) + { + $nodes = ['tests' => $tests]; + if (null !== $else) { + $nodes['else'] = $else; + } + + parent::__construct($nodes, [], $lineno); + } + + 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((string) $i)) + ->raw(") {\n") + ->indent() + ; + // The node might not exists if the content is empty + if ($this->getNode('tests')->hasNode((string) ($i + 1))) { + $compiler->subcompile($this->getNode('tests')->getNode((string) ($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 index 9a6033f..9c03bc9 100644 --- a/vendor/twig/twig/src/Node/ImportNode.php +++ b/vendor/twig/twig/src/Node/ImportNode.php @@ -1,75 +1,75 @@ - - */ -#[YieldReady] -class ImportNode extends Node -{ - /** - * @param bool $global - */ - public function __construct(AbstractExpression $expr, AbstractExpression $var, int $lineno, $global = true) - { - if (null === $global || \is_string($global)) { - trigger_deprecation('twig/twig', '3.12', 'Passing a tag to %s() is deprecated.', __METHOD__); - $global = \func_num_args() > 4 ? func_get_arg(4) : true; - } elseif (!\is_bool($global)) { - throw new \TypeError(\sprintf('Argument 4 passed to "%s()" must be a boolean, "%s" given.', __METHOD__, get_debug_type($global))); - } - - parent::__construct(['expr' => $expr, 'var' => $var], ['global' => $global], $lineno); - } - - 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"); - } -} + + */ +#[YieldReady] +class ImportNode extends Node +{ + /** + * @param bool $global + */ + public function __construct(AbstractExpression $expr, AbstractExpression $var, int $lineno, $global = true) + { + if (null === $global || \is_string($global)) { + trigger_deprecation('twig/twig', '3.12', 'Passing a tag to %s() is deprecated.', __METHOD__); + $global = \func_num_args() > 4 ? func_get_arg(4) : true; + } elseif (!\is_bool($global)) { + throw new \TypeError(\sprintf('Argument 4 passed to "%s()" must be a boolean, "%s" given.', __METHOD__, get_debug_type($global))); + } + + parent::__construct(['expr' => $expr, 'var' => $var], ['global' => $global], $lineno); + } + + 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 index 1c18292..6247464 100644 --- a/vendor/twig/twig/src/Node/IncludeNode.php +++ b/vendor/twig/twig/src/Node/IncludeNode.php @@ -1,110 +1,110 @@ - - */ -#[YieldReady] -class IncludeNode extends Node implements NodeOutputInterface -{ - public function __construct(AbstractExpression $expr, ?AbstractExpression $variables, bool $only, bool $ignoreMissing, int $lineno) - { - $nodes = ['expr' => $expr]; - if (null !== $variables) { - $nodes['variables'] = $variables; - } - - parent::__construct($nodes, ['only' => $only, 'ignore_missing' => $ignoreMissing], $lineno); - } - - 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('yield from $%s->unwrap()->yield(', $template)) - ; - - $this->addTemplateArguments($compiler); - $compiler - ->raw(");\n") - ->outdent() - ->write("}\n") - ; - } else { - $compiler->write('yield from '); - $this->addGetTemplate($compiler); - $compiler->raw('->unwrap()->yield('); - $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('CoreExtension::merge($context, ') - ->subcompile($this->getNode('variables')) - ->raw(')') - ; - } else { - $compiler->raw('CoreExtension::toArray('); - $compiler->subcompile($this->getNode('variables')); - $compiler->raw(')'); - } - } -} + + */ +#[YieldReady] +class IncludeNode extends Node implements NodeOutputInterface +{ + public function __construct(AbstractExpression $expr, ?AbstractExpression $variables, bool $only, bool $ignoreMissing, int $lineno) + { + $nodes = ['expr' => $expr]; + if (null !== $variables) { + $nodes['variables'] = $variables; + } + + parent::__construct($nodes, ['only' => $only, 'ignore_missing' => $ignoreMissing], $lineno); + } + + 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('yield from $%s->unwrap()->yield(', $template)) + ; + + $this->addTemplateArguments($compiler); + $compiler + ->raw(");\n") + ->outdent() + ->write("}\n") + ; + } else { + $compiler->write('yield from '); + $this->addGetTemplate($compiler); + $compiler->raw('->unwrap()->yield('); + $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('CoreExtension::merge($context, ') + ->subcompile($this->getNode('variables')) + ->raw(')') + ; + } else { + $compiler->raw('CoreExtension::toArray('); + $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 index 5a2543a..ac783a1 100644 --- a/vendor/twig/twig/src/Node/MacroNode.php +++ b/vendor/twig/twig/src/Node/MacroNode.php @@ -1,106 +1,106 @@ - - */ -#[YieldReady] -class MacroNode extends Node -{ - public const VARARGS_NAME = 'varargs'; - - /** - * @param BodyNode $body - */ - public function __construct(string $name, Node $body, Node $arguments, int $lineno) - { - if (!$body instanceof BodyNode) { - trigger_deprecation('twig/twig', '3.12', \sprintf('Not passing a "%s" instance as the "body" argument of the "%s" constructor is deprecated.', BodyNode::class, static::class)); - } - - 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); - } - - 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 = [\n") - ->indent() - ; - - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->write('') - ->string($name) - ->raw(' => $__'.$name.'__') - ->raw(",\n") - ; - } - - $node = new CaptureNode($this->getNode('body'), $this->getNode('body')->lineno); - - $compiler - ->write('') - ->string(self::VARARGS_NAME) - ->raw(' => ') - ->raw("\$__varargs__,\n") - ->outdent() - ->write("] + \$this->env->getGlobals();\n\n") - ->write("\$blocks = [];\n\n") - ->write('return ') - ->subcompile($node) - ->raw("\n") - ->outdent() - ->write("}\n\n") - ; - } -} + + */ +#[YieldReady] +class MacroNode extends Node +{ + public const VARARGS_NAME = 'varargs'; + + /** + * @param BodyNode $body + */ + public function __construct(string $name, Node $body, Node $arguments, int $lineno) + { + if (!$body instanceof BodyNode) { + trigger_deprecation('twig/twig', '3.12', \sprintf('Not passing a "%s" instance as the "body" argument of the "%s" constructor is deprecated.', BodyNode::class, static::class)); + } + + 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); + } + + 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 = [\n") + ->indent() + ; + + foreach ($this->getNode('arguments') as $name => $default) { + $compiler + ->write('') + ->string($name) + ->raw(' => $__'.$name.'__') + ->raw(",\n") + ; + } + + $node = new CaptureNode($this->getNode('body'), $this->getNode('body')->lineno); + + $compiler + ->write('') + ->string(self::VARARGS_NAME) + ->raw(' => ') + ->raw("\$__varargs__,\n") + ->outdent() + ->write("] + \$this->env->getGlobals();\n\n") + ->write("\$blocks = [];\n\n") + ->write('return ') + ->subcompile($node) + ->raw("\n") + ->outdent() + ->write("}\n\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/ModuleNode.php b/vendor/twig/twig/src/Node/ModuleNode.php index d2fb216..37ea503 100644 --- a/vendor/twig/twig/src/Node/ModuleNode.php +++ b/vendor/twig/twig/src/Node/ModuleNode.php @@ -1,489 +1,489 @@ - - */ -#[YieldReady] -final class ModuleNode extends Node -{ - /** - * @param BodyNode $body - */ - public function __construct(Node $body, ?AbstractExpression $parent, Node $blocks, Node $macros, Node $traits, $embeddedTemplates, Source $source) - { - if (!$body instanceof BodyNode) { - trigger_deprecation('twig/twig', '3.12', \sprintf('Not passing a "%s" instance as the "body" argument of the "%s" constructor is deprecated.', BodyNode::class, static::class)); - } - - $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): bool|string|Template|TemplateWrapper\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\CoreExtension;\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") - ->write("use Twig\TemplateWrapper;\n") - ->write("\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 \$source;\n") - ->write("/**\n") - ->write(" * @var array\n") - ->write(" */\n") - ->write("private array \$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->unwrap()->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->unwrap()->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 = []): iterable\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('yield from '); - - if ($parent instanceof ConstantExpression) { - $compiler->raw('$this->parent'); - } else { - $compiler->raw('$this->getParent($context)'); - } - $compiler->raw("->unwrap()->yield(\$context, array_merge(\$this->blocks, \$blocks));\n"); - } - - $compiler->subcompile($this->getNode('display_end')); - - if (!$this->hasNode('parent')) { - $compiler->write("yield from [];\n"); - } - - $compiler - ->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("/**\n") - ->write(" * @codeCoverageIgnore\n") - ->write(" */\n") - ->write("public function getTemplateName(): string\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; - } - - $traitable = false; - break; - } - } - - if ($traitable) { - return; - } - - $compiler - ->write("/**\n") - ->write(" * @codeCoverageIgnore\n") - ->write(" */\n") - ->write("public function isTraitable(): bool\n", "{\n") - ->indent() - ->write("return false;\n") - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileDebugInfo(Compiler $compiler) - { - $compiler - ->write("/**\n") - ->write(" * @codeCoverageIgnore\n") - ->write(" */\n") - ->write("public function getDebugInfo(): array\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(): Source\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.'); - } - } -} + + */ +#[YieldReady] +final class ModuleNode extends Node +{ + /** + * @param BodyNode $body + */ + public function __construct(Node $body, ?AbstractExpression $parent, Node $blocks, Node $macros, Node $traits, $embeddedTemplates, Source $source) + { + if (!$body instanceof BodyNode) { + trigger_deprecation('twig/twig', '3.12', \sprintf('Not passing a "%s" instance as the "body" argument of the "%s" constructor is deprecated.', BodyNode::class, static::class)); + } + + $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): bool|string|Template|TemplateWrapper\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\CoreExtension;\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") + ->write("use Twig\TemplateWrapper;\n") + ->write("\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 \$source;\n") + ->write("/**\n") + ->write(" * @var array\n") + ->write(" */\n") + ->write("private array \$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->unwrap()->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->unwrap()->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 = []): iterable\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('yield from '); + + if ($parent instanceof ConstantExpression) { + $compiler->raw('$this->parent'); + } else { + $compiler->raw('$this->getParent($context)'); + } + $compiler->raw("->unwrap()->yield(\$context, array_merge(\$this->blocks, \$blocks));\n"); + } + + $compiler->subcompile($this->getNode('display_end')); + + if (!$this->hasNode('parent')) { + $compiler->write("yield from [];\n"); + } + + $compiler + ->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("/**\n") + ->write(" * @codeCoverageIgnore\n") + ->write(" */\n") + ->write("public function getTemplateName(): string\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; + } + + $traitable = false; + break; + } + } + + if ($traitable) { + return; + } + + $compiler + ->write("/**\n") + ->write(" * @codeCoverageIgnore\n") + ->write(" */\n") + ->write("public function isTraitable(): bool\n", "{\n") + ->indent() + ->write("return false;\n") + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileDebugInfo(Compiler $compiler) + { + $compiler + ->write("/**\n") + ->write(" * @codeCoverageIgnore\n") + ->write(" */\n") + ->write("public function getDebugInfo(): array\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(): Source\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/NameDeprecation.php b/vendor/twig/twig/src/Node/NameDeprecation.php index 63ab285..16640bb 100644 --- a/vendor/twig/twig/src/Node/NameDeprecation.php +++ b/vendor/twig/twig/src/Node/NameDeprecation.php @@ -1,46 +1,46 @@ - - */ -class NameDeprecation -{ - private $package; - private $version; - private $newName; - - public function __construct(string $package = '', string $version = '', string $newName = '') - { - $this->package = $package; - $this->version = $version; - $this->newName = $newName; - } - - public function getPackage(): string - { - return $this->package; - } - - public function getVersion(): string - { - return $this->version; - } - - public function getNewName(): string - { - return $this->newName; - } -} + + */ +class NameDeprecation +{ + private $package; + private $version; + private $newName; + + public function __construct(string $package = '', string $version = '', string $newName = '') + { + $this->package = $package; + $this->version = $version; + $this->newName = $newName; + } + + public function getPackage(): string + { + return $this->package; + } + + public function getVersion(): string + { + return $this->version; + } + + public function getNewName(): string + { + return $this->newName; + } +} diff --git a/vendor/twig/twig/src/Node/Node.php b/vendor/twig/twig/src/Node/Node.php index 2ccbcf6..d7e8678 100644 --- a/vendor/twig/twig/src/Node/Node.php +++ b/vendor/twig/twig/src/Node/Node.php @@ -1,281 +1,281 @@ - - */ -#[YieldReady] -class Node implements \Countable, \IteratorAggregate -{ - /** - * @var array - */ - protected $nodes; - protected $attributes; - protected $lineno; - protected $tag; - - private $sourceContext; - /** @var array */ - private $nodeNameDeprecations = []; - /** @var array */ - private $attributeNameDeprecations = []; - - /** - * @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 - */ - public function __construct(array $nodes = [], array $attributes = [], int $lineno = 0) - { - 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) ? $node::class : (null === $node ? 'null' : \gettype($node)), $name, static::class)); - } - } - $this->nodes = $nodes; - $this->attributes = $attributes; - $this->lineno = $lineno; - - if (\func_num_args() > 3) { - trigger_deprecation('twig/twig', '3.12', \sprintf('The "tag" constructor argument of the "%s" class is deprecated and ignored (check which TokenParser class set it to "%s"), the tag is now automatically set by the Parser when needed.', static::class, func_get_arg(3) ?: 'null')); - } - } - - public function __toString() - { - $repr = static::class; - - if ($this->tag) { - $repr .= \sprintf("\n tag: %s", $this->tag); - } - - $attributes = []; - foreach ($this->attributes as $name => $value) { - if (\is_callable($value)) { - $v = '\Closure'; - } elseif ($value instanceof \Stringable) { - $v = (string) $value; - } else { - $v = str_replace("\n", '', var_export($value, true)); - } - $attributes[] = \sprintf('%s: %s', $name, $v); - } - - if ($attributes) { - $repr .= \sprintf("\n attributes:\n %s", implode("\n ", $attributes)); - } - - if (\count($this->nodes)) { - $repr .= "\n nodes:"; - foreach ($this->nodes as $name => $node) { - $len = \strlen($name) + 6; - $noderepr = []; - foreach (explode("\n", (string) $node) as $line) { - $noderepr[] = str_repeat(' ', $len).$line; - } - - $repr .= \sprintf("\n %s: %s", $name, ltrim(implode("\n", $noderepr))); - } - } - - return $repr; - } - - /** - * @return void - */ - public function compile(Compiler $compiler) - { - foreach ($this->nodes as $node) { - $compiler->subcompile($node); - } - } - - public function getTemplateLine(): int - { - return $this->lineno; - } - - public function getNodeTag(): ?string - { - return $this->tag; - } - - /** - * @internal - */ - public function setNodeTag(string $tag): void - { - if ($this->tag) { - throw new \LogicException('The tag of a node can only be set once.'); - } - - $this->tag = $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)); - } - - $triggerDeprecation = \func_num_args() > 1 ? func_get_arg(1) : true; - if ($triggerDeprecation && isset($this->attributeNameDeprecations[$name])) { - $dep = $this->attributeNameDeprecations[$name]; - if ($dep->getNewName()) { - trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Getting attribute "%s" on a "%s" class is deprecated, get the "%s" attribute instead.', $name, static::class, $dep->getNewName()); - } else { - trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Getting attribute "%s" on a "%s" class is deprecated.', $name, static::class); - } - } - - return $this->attributes[$name]; - } - - public function setAttribute(string $name, $value): void - { - $triggerDeprecation = \func_num_args() > 2 ? func_get_arg(2) : true; - if ($triggerDeprecation && isset($this->attributeNameDeprecations[$name])) { - $dep = $this->attributeNameDeprecations[$name]; - if ($dep->getNewName()) { - trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Setting attribute "%s" on a "%s" class is deprecated, set the "%s" attribute instead.', $name, static::class, $dep->getNewName()); - } else { - trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Setting attribute "%s" on a "%s" class is deprecated.', $name, static::class); - } - } - - $this->attributes[$name] = $value; - } - - public function deprecateAttribute(string $name, NameDeprecation $dep): void - { - $this->attributeNameDeprecations[$name] = $dep; - } - - public function removeAttribute(string $name): void - { - unset($this->attributes[$name]); - } - - /** - * @param string|int $name - */ - public function hasNode(string $name): bool - { - return isset($this->nodes[$name]); - } - - /** - * @param string|int $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)); - } - - $triggerDeprecation = \func_num_args() > 1 ? func_get_arg(1) : true; - if ($triggerDeprecation && isset($this->nodeNameDeprecations[$name])) { - $dep = $this->nodeNameDeprecations[$name]; - if ($dep->getNewName()) { - trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Getting node "%s" on a "%s" class is deprecated, get the "%s" node instead.', $name, static::class, $dep->getNewName()); - } else { - trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Getting node "%s" on a "%s" class is deprecated.', $name, static::class); - } - } - - return $this->nodes[$name]; - } - - /** - * @param string|int $name - */ - public function setNode(string $name, self $node): void - { - $triggerDeprecation = \func_num_args() > 2 ? func_get_arg(2) : true; - if ($triggerDeprecation && isset($this->nodeNameDeprecations[$name])) { - $dep = $this->nodeNameDeprecations[$name]; - if ($dep->getNewName()) { - trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Setting node "%s" on a "%s" class is deprecated, set the "%s" node instead.', $name, static::class, $dep->getNewName()); - } else { - trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Setting node "%s" on a "%s" class is deprecated.', $name, static::class); - } - } - - if (null !== $this->sourceContext) { - $node->setSourceContext($this->sourceContext); - } - $this->nodes[$name] = $node; - } - - /** - * @param string|int $name - */ - public function removeNode(string $name): void - { - unset($this->nodes[$name]); - } - - /** - * @param string|int $name - */ - public function deprecateNode(string $name, NameDeprecation $dep): void - { - $this->nodeNameDeprecations[$name] = $dep; - } - - /** - * @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; - } -} + + */ +#[YieldReady] +class Node implements \Countable, \IteratorAggregate +{ + /** + * @var array + */ + protected $nodes; + protected $attributes; + protected $lineno; + protected $tag; + + private $sourceContext; + /** @var array */ + private $nodeNameDeprecations = []; + /** @var array */ + private $attributeNameDeprecations = []; + + /** + * @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 + */ + public function __construct(array $nodes = [], array $attributes = [], int $lineno = 0) + { + 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) ? $node::class : (null === $node ? 'null' : \gettype($node)), $name, static::class)); + } + } + $this->nodes = $nodes; + $this->attributes = $attributes; + $this->lineno = $lineno; + + if (\func_num_args() > 3) { + trigger_deprecation('twig/twig', '3.12', \sprintf('The "tag" constructor argument of the "%s" class is deprecated and ignored (check which TokenParser class set it to "%s"), the tag is now automatically set by the Parser when needed.', static::class, func_get_arg(3) ?: 'null')); + } + } + + public function __toString() + { + $repr = static::class; + + if ($this->tag) { + $repr .= \sprintf("\n tag: %s", $this->tag); + } + + $attributes = []; + foreach ($this->attributes as $name => $value) { + if (\is_callable($value)) { + $v = '\Closure'; + } elseif ($value instanceof \Stringable) { + $v = (string) $value; + } else { + $v = str_replace("\n", '', var_export($value, true)); + } + $attributes[] = \sprintf('%s: %s', $name, $v); + } + + if ($attributes) { + $repr .= \sprintf("\n attributes:\n %s", implode("\n ", $attributes)); + } + + if (\count($this->nodes)) { + $repr .= "\n nodes:"; + foreach ($this->nodes as $name => $node) { + $len = \strlen($name) + 6; + $noderepr = []; + foreach (explode("\n", (string) $node) as $line) { + $noderepr[] = str_repeat(' ', $len).$line; + } + + $repr .= \sprintf("\n %s: %s", $name, ltrim(implode("\n", $noderepr))); + } + } + + return $repr; + } + + /** + * @return void + */ + public function compile(Compiler $compiler) + { + foreach ($this->nodes as $node) { + $compiler->subcompile($node); + } + } + + public function getTemplateLine(): int + { + return $this->lineno; + } + + public function getNodeTag(): ?string + { + return $this->tag; + } + + /** + * @internal + */ + public function setNodeTag(string $tag): void + { + if ($this->tag) { + throw new \LogicException('The tag of a node can only be set once.'); + } + + $this->tag = $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)); + } + + $triggerDeprecation = \func_num_args() > 1 ? func_get_arg(1) : true; + if ($triggerDeprecation && isset($this->attributeNameDeprecations[$name])) { + $dep = $this->attributeNameDeprecations[$name]; + if ($dep->getNewName()) { + trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Getting attribute "%s" on a "%s" class is deprecated, get the "%s" attribute instead.', $name, static::class, $dep->getNewName()); + } else { + trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Getting attribute "%s" on a "%s" class is deprecated.', $name, static::class); + } + } + + return $this->attributes[$name]; + } + + public function setAttribute(string $name, $value): void + { + $triggerDeprecation = \func_num_args() > 2 ? func_get_arg(2) : true; + if ($triggerDeprecation && isset($this->attributeNameDeprecations[$name])) { + $dep = $this->attributeNameDeprecations[$name]; + if ($dep->getNewName()) { + trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Setting attribute "%s" on a "%s" class is deprecated, set the "%s" attribute instead.', $name, static::class, $dep->getNewName()); + } else { + trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Setting attribute "%s" on a "%s" class is deprecated.', $name, static::class); + } + } + + $this->attributes[$name] = $value; + } + + public function deprecateAttribute(string $name, NameDeprecation $dep): void + { + $this->attributeNameDeprecations[$name] = $dep; + } + + public function removeAttribute(string $name): void + { + unset($this->attributes[$name]); + } + + /** + * @param string|int $name + */ + public function hasNode(string $name): bool + { + return isset($this->nodes[$name]); + } + + /** + * @param string|int $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)); + } + + $triggerDeprecation = \func_num_args() > 1 ? func_get_arg(1) : true; + if ($triggerDeprecation && isset($this->nodeNameDeprecations[$name])) { + $dep = $this->nodeNameDeprecations[$name]; + if ($dep->getNewName()) { + trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Getting node "%s" on a "%s" class is deprecated, get the "%s" node instead.', $name, static::class, $dep->getNewName()); + } else { + trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Getting node "%s" on a "%s" class is deprecated.', $name, static::class); + } + } + + return $this->nodes[$name]; + } + + /** + * @param string|int $name + */ + public function setNode(string $name, self $node): void + { + $triggerDeprecation = \func_num_args() > 2 ? func_get_arg(2) : true; + if ($triggerDeprecation && isset($this->nodeNameDeprecations[$name])) { + $dep = $this->nodeNameDeprecations[$name]; + if ($dep->getNewName()) { + trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Setting node "%s" on a "%s" class is deprecated, set the "%s" node instead.', $name, static::class, $dep->getNewName()); + } else { + trigger_deprecation($dep->getPackage(), $dep->getVersion(), 'Setting node "%s" on a "%s" class is deprecated.', $name, static::class); + } + } + + if (null !== $this->sourceContext) { + $node->setSourceContext($this->sourceContext); + } + $this->nodes[$name] = $node; + } + + /** + * @param string|int $name + */ + public function removeNode(string $name): void + { + unset($this->nodes[$name]); + } + + /** + * @param string|int $name + */ + public function deprecateNode(string $name, NameDeprecation $dep): void + { + $this->nodeNameDeprecations[$name] = $dep; + } + + /** + * @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 index 9fb6a0c..ce798c3 100644 --- a/vendor/twig/twig/src/Node/NodeCaptureInterface.php +++ b/vendor/twig/twig/src/Node/NodeCaptureInterface.php @@ -1,21 +1,21 @@ - - */ -interface NodeCaptureInterface -{ -} + + */ +interface NodeCaptureInterface +{ +} diff --git a/vendor/twig/twig/src/Node/NodeOutputInterface.php b/vendor/twig/twig/src/Node/NodeOutputInterface.php index 5e35b40..27cbddd 100644 --- a/vendor/twig/twig/src/Node/NodeOutputInterface.php +++ b/vendor/twig/twig/src/Node/NodeOutputInterface.php @@ -1,21 +1,21 @@ - - */ -interface NodeOutputInterface -{ -} + + */ +interface NodeOutputInterface +{ +} diff --git a/vendor/twig/twig/src/Node/PrintNode.php b/vendor/twig/twig/src/Node/PrintNode.php index e3c23bb..bf29f86 100644 --- a/vendor/twig/twig/src/Node/PrintNode.php +++ b/vendor/twig/twig/src/Node/PrintNode.php @@ -1,44 +1,44 @@ - - */ -#[YieldReady] -class PrintNode extends Node implements NodeOutputInterface -{ - public function __construct(AbstractExpression $expr, int $lineno) - { - parent::__construct(['expr' => $expr], [], $lineno); - } - - public function compile(Compiler $compiler): void - { - /** @var AbstractExpression */ - $expr = $this->getNode('expr'); - - $compiler - ->addDebugInfo($this) - ->write($expr->isGenerator() ? 'yield from ' : 'yield ') - ->subcompile($expr) - ->raw(";\n") - ; - } -} + + */ +#[YieldReady] +class PrintNode extends Node implements NodeOutputInterface +{ + public function __construct(AbstractExpression $expr, int $lineno) + { + parent::__construct(['expr' => $expr], [], $lineno); + } + + public function compile(Compiler $compiler): void + { + /** @var AbstractExpression */ + $expr = $this->getNode('expr'); + + $compiler + ->addDebugInfo($this) + ->write($expr->isGenerator() ? 'yield from ' : 'yield ') + ->subcompile($expr) + ->raw(";\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/SandboxNode.php b/vendor/twig/twig/src/Node/SandboxNode.php index d51cea4..17d825b 100644 --- a/vendor/twig/twig/src/Node/SandboxNode.php +++ b/vendor/twig/twig/src/Node/SandboxNode.php @@ -1,54 +1,54 @@ - - */ -#[YieldReady] -class SandboxNode extends Node -{ - public function __construct(Node $body, int $lineno) - { - parent::__construct(['body' => $body], [], $lineno); - } - - 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") - ; - } -} + + */ +#[YieldReady] +class SandboxNode extends Node +{ + public function __construct(Node $body, int $lineno) + { + parent::__construct(['body' => $body], [], $lineno); + } + + 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 index 6772510..2ece5c7 100644 --- a/vendor/twig/twig/src/Node/SetNode.php +++ b/vendor/twig/twig/src/Node/SetNode.php @@ -1,96 +1,96 @@ - - */ -#[YieldReady] -class SetNode extends Node implements NodeCaptureInterface -{ - public function __construct(bool $capture, Node $names, Node $values, int $lineno) - { - /* - * 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"); - */ - $safe = false; - if ($capture) { - $safe = true; - if ($values instanceof TextNode) { - $values = new ConstantExpression($values->getAttribute('data'), $values->getTemplateLine()); - $capture = false; - } else { - $values = new CaptureNode($values, $values->getTemplateLine()); - } - } - - parent::__construct(['names' => $names, 'values' => $values], ['capture' => $capture, 'safe' => $safe], $lineno); - } - - public function compile(Compiler $compiler): void - { - $compiler->addDebugInfo($this); - - if (\count($this->getNode('names')) > 1) { - $compiler->write('['); - foreach ($this->getNode('names') as $idx => $node) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($node); - } - $compiler->raw(']'); - } else { - $compiler->subcompile($this->getNode('names'), false); - } - $compiler->raw(' = '); - - if ($this->getAttribute('capture')) { - $compiler->subcompile($this->getNode('values')); - } else { - 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(';'); - } - - $compiler->raw("\n"); - } -} + + */ +#[YieldReady] +class SetNode extends Node implements NodeCaptureInterface +{ + public function __construct(bool $capture, Node $names, Node $values, int $lineno) + { + /* + * 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"); + */ + $safe = false; + if ($capture) { + $safe = true; + if ($values instanceof TextNode) { + $values = new ConstantExpression($values->getAttribute('data'), $values->getTemplateLine()); + $capture = false; + } else { + $values = new CaptureNode($values, $values->getTemplateLine()); + } + } + + parent::__construct(['names' => $names, 'values' => $values], ['capture' => $capture, 'safe' => $safe], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + + if (\count($this->getNode('names')) > 1) { + $compiler->write('['); + foreach ($this->getNode('names') as $idx => $node) { + if ($idx) { + $compiler->raw(', '); + } + + $compiler->subcompile($node); + } + $compiler->raw(']'); + } else { + $compiler->subcompile($this->getNode('names'), false); + } + $compiler->raw(' = '); + + if ($this->getAttribute('capture')) { + $compiler->subcompile($this->getNode('values')); + } else { + 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(';'); + } + + $compiler->raw("\n"); + } +} diff --git a/vendor/twig/twig/src/Node/TextNode.php b/vendor/twig/twig/src/Node/TextNode.php index fae65fb..61d3b43 100644 --- a/vendor/twig/twig/src/Node/TextNode.php +++ b/vendor/twig/twig/src/Node/TextNode.php @@ -1,41 +1,41 @@ - - */ -#[YieldReady] -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); - - $compiler - ->write('yield ') - ->string($this->getAttribute('data')) - ->raw(";\n") - ; - } -} + + */ +#[YieldReady] +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); + + $compiler + ->write('yield ') + ->string($this->getAttribute('data')) + ->raw(";\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/TypesNode.php b/vendor/twig/twig/src/Node/TypesNode.php index ebb304d..cc4f07d 100644 --- a/vendor/twig/twig/src/Node/TypesNode.php +++ b/vendor/twig/twig/src/Node/TypesNode.php @@ -1,28 +1,28 @@ - - */ -#[YieldReady] -class TypesNode extends Node -{ - /** - * @param array $types - */ - public function __construct(array $types, int $lineno) - { - parent::__construct([], ['mapping' => $types], $lineno); - } - - public function compile(Compiler $compiler) - { - // Don't compile anything. - } -} + + */ +#[YieldReady] +class TypesNode extends Node +{ + /** + * @param array $types + */ + public function __construct(array $types, int $lineno) + { + parent::__construct([], ['mapping' => $types], $lineno); + } + + public function compile(Compiler $compiler) + { + // Don't compile anything. + } +} diff --git a/vendor/twig/twig/src/Node/WithNode.php b/vendor/twig/twig/src/Node/WithNode.php index 487e280..7dea285 100644 --- a/vendor/twig/twig/src/Node/WithNode.php +++ b/vendor/twig/twig/src/Node/WithNode.php @@ -1,72 +1,72 @@ - - */ -#[YieldReady] -class WithNode extends Node -{ - public function __construct(Node $body, ?Node $variables, bool $only, int $lineno) - { - $nodes = ['body' => $body]; - if (null !== $variables) { - $nodes['variables'] = $variables; - } - - parent::__construct($nodes, ['only' => $only], $lineno); - } - - 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 (!is_iterable(\$%s)) {\n", $varsName)) - ->indent() - ->write("throw new RuntimeError('Variables passed to the \"with\" tag must be a mapping.', ") - ->repr($node->getTemplateLine()) - ->raw(", \$this->getSourceContext());\n") - ->outdent() - ->write("}\n") - ->write(\sprintf("\$%s = CoreExtension::toArray(\$%s);\n", $varsName, $varsName)) - ; - - if ($this->getAttribute('only')) { - $compiler->write("\$context = [];\n"); - } - - $compiler->write(\sprintf("\$context = \$%s + \$context + \$this->env->getGlobals();\n", $varsName)); - } - - $compiler - ->subcompile($this->getNode('body')) - ->write(\sprintf("\$context = \$%s;\n", $parentContextName)) - ; - } -} + + */ +#[YieldReady] +class WithNode extends Node +{ + public function __construct(Node $body, ?Node $variables, bool $only, int $lineno) + { + $nodes = ['body' => $body]; + if (null !== $variables) { + $nodes['variables'] = $variables; + } + + parent::__construct($nodes, ['only' => $only], $lineno); + } + + 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 (!is_iterable(\$%s)) {\n", $varsName)) + ->indent() + ->write("throw new RuntimeError('Variables passed to the \"with\" tag must be a mapping.', ") + ->repr($node->getTemplateLine()) + ->raw(", \$this->getSourceContext());\n") + ->outdent() + ->write("}\n") + ->write(\sprintf("\$%s = CoreExtension::toArray(\$%s);\n", $varsName, $varsName)) + ; + + if ($this->getAttribute('only')) { + $compiler->write("\$context = [];\n"); + } + + $compiler->write(\sprintf("\$context = \$%s + \$context + \$this->env->getGlobals();\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 index 47a2d5c..efc687c 100644 --- a/vendor/twig/twig/src/NodeTraverser.php +++ b/vendor/twig/twig/src/NodeTraverser.php @@ -1,76 +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); - } -} + + */ +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 index 5de35fd..b8b54ff 100644 --- a/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php @@ -1,49 +1,49 @@ - - * - * @deprecated since 3.9 (to be removed in 4.0) - */ -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); -} + + * + * @deprecated since 3.9 (to be removed in 4.0) + */ +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 index 32f49ab..f6ee671 100644 --- a/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php @@ -1,209 +1,209 @@ - - * - * @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[] = $this->blocks[$node->getAttribute('name')] ?? $this->needEscaping(); - } 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()) { - $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(); - } - - 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($env, $type, $expression), $node->getTemplateLine()); - } - - private function escapePrintNode(PrintNode $node, Environment $env, string $type): Node - { - $expression = $node->getNode('expr'); - - if ($this->isSafeFor($type, $expression, $env)) { - return $node; - } - - $class = \get_class($node); - - return new $class($this->getEscaperFilter($env, $type, $expression), $node->getTemplateLine()); - } - - private function preEscapeFilterNode(FilterExpression $filter, Environment $env): FilterExpression - { - if ($filter->hasAttribute('twig_callable')) { - $type = $filter->getAttribute('twig_callable')->getPreEscape(); - } else { - // legacy - $name = $filter->getNode('filter', false)->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($env, $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() - { - if (\count($this->statusStack)) { - return $this->statusStack[\count($this->statusStack) - 1]; - } - - return $this->defaultStrategy ?: false; - } - - private function getEscaperFilter(Environment $env, string $type, Node $node): FilterExpression - { - $line = $node->getTemplateLine(); - $filter = $env->getFilter('escape'); - $args = new Node([new ConstantExpression($type, $line), new ConstantExpression(null, $line), new ConstantExpression(true, $line)]); - - return new FilterExpression($node, $filter, $args, $line); - } - - public function getPriority(): int - { - return 0; - } -} + + * + * @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[] = $this->blocks[$node->getAttribute('name')] ?? $this->needEscaping(); + } 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()) { + $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(); + } + + 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($env, $type, $expression), $node->getTemplateLine()); + } + + private function escapePrintNode(PrintNode $node, Environment $env, string $type): Node + { + $expression = $node->getNode('expr'); + + if ($this->isSafeFor($type, $expression, $env)) { + return $node; + } + + $class = \get_class($node); + + return new $class($this->getEscaperFilter($env, $type, $expression), $node->getTemplateLine()); + } + + private function preEscapeFilterNode(FilterExpression $filter, Environment $env): FilterExpression + { + if ($filter->hasAttribute('twig_callable')) { + $type = $filter->getAttribute('twig_callable')->getPreEscape(); + } else { + // legacy + $name = $filter->getNode('filter', false)->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($env, $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() + { + if (\count($this->statusStack)) { + return $this->statusStack[\count($this->statusStack) - 1]; + } + + return $this->defaultStrategy ?: false; + } + + private function getEscaperFilter(Environment $env, string $type, Node $node): FilterExpression + { + $line = $node->getTemplateLine(); + $filter = $env->getFilter('escape'); + $args = new Node([new ConstantExpression($type, $line), new ConstantExpression(null, $line), new ConstantExpression(true, $line)]); + + return new FilterExpression($node, $filter, $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 index 01d5a99..f2777d3 100644 --- a/vendor/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php @@ -1,74 +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, 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; - } -} + + * + * @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, 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 index 59e836d..21c3d22 100644 --- a/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php +++ b/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php @@ -1,46 +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(); -} + + */ +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 index a943f45..53958b5 100644 --- a/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php @@ -1,213 +1,213 @@ - - * - * @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; - public const OPTIMIZE_TEXT_NODES = 8; - - private $loops = []; - private $loopsTargets = []; - - /** - * @param int $optimizers The optimizer mode - */ - public function __construct( - private int $optimizers = -1, - ) { - if ($optimizers > (self::OPTIMIZE_FOR | self::OPTIMIZE_RAW_FILTER | self::OPTIMIZE_TEXT_NODES)) { - throw new \InvalidArgumentException(\sprintf('Optimizer mode "%s" is not valid.', $optimizers)); - } - - if (-1 !== $optimizers && self::OPTIMIZE_RAW_FILTER === (self::OPTIMIZE_RAW_FILTER & $optimizers)) { - trigger_deprecation('twig/twig', '3.11', 'The "Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_RAW_FILTER" option is deprecated and does nothing.'); - } - - if (-1 !== $optimizers && self::OPTIMIZE_TEXT_NODES === (self::OPTIMIZE_TEXT_NODES & $optimizers)) { - trigger_deprecation('twig/twig', '3.12', 'The "Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_TEXT_NODES" option is deprecated and does nothing.'); - } - } - - public function enterNode(Node $node, Environment $env): Node - { - if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { - $this->enterOptimizeFor($node); - } - - return $node; - } - - public function leaveNode(Node $node, Environment $env): ?Node - { - if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { - $this->leaveOptimizeFor($node); - } - - $node = $this->optimizePrintNode($node); - - return $node; - } - - /** - * Optimizes print nodes. - * - * It replaces: - * - * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()" - */ - private function optimizePrintNode(Node $node): Node - { - if (!$node instanceof PrintNode) { - return $node; - } - - $exprNode = $node->getNode('expr'); - - if ($exprNode instanceof ConstantExpression && \is_string($exprNode->getAttribute('value'))) { - return new TextNode($exprNode->getAttribute('value'), $exprNode->getTemplateLine()); - } - - if ( - $exprNode instanceof BlockReferenceExpression - || $exprNode instanceof ParentExpression - ) { - $exprNode->setAttribute('output', true); - - return $exprNode; - } - - return $node; - } - - /** - * Optimizes "for" tag by removing the "loop" variable creation whenever possible. - */ - private function enterOptimizeFor(Node $node): 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): 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; - } -} + + * + * @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; + public const OPTIMIZE_TEXT_NODES = 8; + + private $loops = []; + private $loopsTargets = []; + + /** + * @param int $optimizers The optimizer mode + */ + public function __construct( + private int $optimizers = -1, + ) { + if ($optimizers > (self::OPTIMIZE_FOR | self::OPTIMIZE_RAW_FILTER | self::OPTIMIZE_TEXT_NODES)) { + throw new \InvalidArgumentException(\sprintf('Optimizer mode "%s" is not valid.', $optimizers)); + } + + if (-1 !== $optimizers && self::OPTIMIZE_RAW_FILTER === (self::OPTIMIZE_RAW_FILTER & $optimizers)) { + trigger_deprecation('twig/twig', '3.11', 'The "Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_RAW_FILTER" option is deprecated and does nothing.'); + } + + if (-1 !== $optimizers && self::OPTIMIZE_TEXT_NODES === (self::OPTIMIZE_TEXT_NODES & $optimizers)) { + trigger_deprecation('twig/twig', '3.12', 'The "Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_TEXT_NODES" option is deprecated and does nothing.'); + } + } + + public function enterNode(Node $node, Environment $env): Node + { + if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { + $this->enterOptimizeFor($node); + } + + return $node; + } + + public function leaveNode(Node $node, Environment $env): ?Node + { + if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { + $this->leaveOptimizeFor($node); + } + + $node = $this->optimizePrintNode($node); + + return $node; + } + + /** + * Optimizes print nodes. + * + * It replaces: + * + * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()" + */ + private function optimizePrintNode(Node $node): Node + { + if (!$node instanceof PrintNode) { + return $node; + } + + $exprNode = $node->getNode('expr'); + + if ($exprNode instanceof ConstantExpression && \is_string($exprNode->getAttribute('value'))) { + return new TextNode($exprNode->getAttribute('value'), $exprNode->getTemplateLine()); + } + + if ( + $exprNode instanceof BlockReferenceExpression + || $exprNode instanceof ParentExpression + ) { + $exprNode->setAttribute('output', true); + + return $exprNode; + } + + return $node; + } + + /** + * Optimizes "for" tag by removing the "loop" variable creation whenever possible. + */ + private function enterOptimizeFor(Node $node): 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): 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 index 0767216..aefe40a 100644 --- a/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php @@ -1,170 +1,170 @@ -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 - if ($node->hasAttribute('twig_callable')) { - $filter = $node->getAttribute('twig_callable'); - } else { - // legacy - $filter = $env->getFilter($node->getAttribute('name')); - } - - if ($filter) { - $safe = $filter->getSafe($node->getNode('arguments')); - 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 - if ($node->hasAttribute('twig_callable')) { - $function = $node->getAttribute('twig_callable'); - } else { - // legacy - $function = $env->getFunction($node->getAttribute('name')); - } - - if ($function) { - $this->setSafe($node, $function->getSafe($node->getNode('arguments'))); - } 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; - } -} +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 + if ($node->hasAttribute('twig_callable')) { + $filter = $node->getAttribute('twig_callable'); + } else { + // legacy + $filter = $env->getFilter($node->getAttribute('name')); + } + + if ($filter) { + $safe = $filter->getSafe($node->getNode('arguments')); + 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 + if ($node->hasAttribute('twig_callable')) { + $function = $node->getAttribute('twig_callable'); + } else { + // legacy + $function = $env->getFunction($node->getAttribute('name')); + } + + if ($function) { + $this->setSafe($node, $function->getSafe($node->getNode('arguments'))); + } 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 index 37e184a..7b983ad 100644 --- a/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php @@ -1,139 +1,139 @@ - - * - * @internal - */ -final class SandboxNodeVisitor implements NodeVisitorInterface -{ - private $inAModule = false; - /** @var array */ - private $tags; - /** @var array */ - private $filters; - /** @var array */ - 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->getTemplateLine(); - } - - // look for filters - if ($node instanceof FilterExpression && !isset($this->filters[$node->getAttribute('name')])) { - $this->filters[$node->getAttribute('name')] = $node->getTemplateLine(); - } - - // look for functions - if ($node instanceof FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) { - $this->functions[$node->getAttribute('name')] = $node->getTemplateLine(); - } - - // the .. operator is equivalent to the range() function - if ($node instanceof RangeBinary && !isset($this->functions['range'])) { - $this->functions['range'] = $node->getTemplateLine(); - } - - 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) && !$expr->isGenerator()) { - $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; - } -} + + * + * @internal + */ +final class SandboxNodeVisitor implements NodeVisitorInterface +{ + private $inAModule = false; + /** @var array */ + private $tags; + /** @var array */ + private $filters; + /** @var array */ + 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->getTemplateLine(); + } + + // look for filters + if ($node instanceof FilterExpression && !isset($this->filters[$node->getAttribute('name')])) { + $this->filters[$node->getAttribute('name')] = $node->getTemplateLine(); + } + + // look for functions + if ($node instanceof FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) { + $this->functions[$node->getAttribute('name')] = $node->getTemplateLine(); + } + + // the .. operator is equivalent to the range() function + if ($node instanceof RangeBinary && !isset($this->functions['range'])) { + $this->functions['range'] = $node->getTemplateLine(); + } + + 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) && !$expr->isGenerator()) { + $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/NodeVisitor/YieldNotReadyNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/YieldNotReadyNodeVisitor.php index 4b190b4..2c4ae8c 100644 --- a/vendor/twig/twig/src/NodeVisitor/YieldNotReadyNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/YieldNotReadyNodeVisitor.php @@ -1,59 +1,59 @@ -yieldReadyNodes[$class])) { - return $node; - } - - if (!$this->yieldReadyNodes[$class] = (bool) (new \ReflectionClass($class))->getAttributes(YieldReady::class)) { - if ($this->useYield) { - throw new \LogicException(\sprintf('You cannot enable the "use_yield" option of Twig as node "%s" is not marked as ready for it; please make it ready and then flag it with the #[YieldReady] attribute.', $class)); - } - - trigger_deprecation('twig/twig', '3.9', 'Twig node "%s" is not marked as ready for using "yield" instead of "echo"; please make it ready and then flag it with the #[YieldReady] attribute.', $class); - } - - return $node; - } - - public function leaveNode(Node $node, Environment $env): ?Node - { - return $node; - } - - public function getPriority(): int - { - return 255; - } -} +yieldReadyNodes[$class])) { + return $node; + } + + if (!$this->yieldReadyNodes[$class] = (bool) (new \ReflectionClass($class))->getAttributes(YieldReady::class)) { + if ($this->useYield) { + throw new \LogicException(\sprintf('You cannot enable the "use_yield" option of Twig as node "%s" is not marked as ready for it; please make it ready and then flag it with the #[YieldReady] attribute.', $class)); + } + + trigger_deprecation('twig/twig', '3.9', 'Twig node "%s" is not marked as ready for using "yield" instead of "echo"; please make it ready and then flag it with the #[YieldReady] attribute.', $class); + } + + return $node; + } + + public function leaveNode(Node $node, Environment $env): ?Node + { + return $node; + } + + public function getPriority(): int + { + return 255; + } +} diff --git a/vendor/twig/twig/src/Parser.php b/vendor/twig/twig/src/Parser.php index 40370bb..511b628 100644 --- a/vendor/twig/twig/src/Parser.php +++ b/vendor/twig/twig/src/Parser.php @@ -1,383 +1,383 @@ - - */ -class Parser -{ - private $stack = []; - private $stream; - private $parent; - private $visitors; - private $expressionParser; - private $blocks; - private $blockStack; - private $macros; - private $importedSymbols; - private $traits; - private $embeddedTemplates = []; - private $varNameSalt = 0; - - public function __construct( - private Environment $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->getCurrentToken()->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); - - /** - * @var ModuleNode $node - */ - $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: - $token = $this->stream->next(); - $rv[] = new TextNode($token->getValue(), $token->getLine()); - break; - - case Token::VAR_START_TYPE: - $token = $this->stream->next(); - $expr = $this->expressionParser->parseExpression(); - $this->stream->expect(Token::VAR_END_TYPE); - $rv[] = new PrintNode($expr, $token->getLine()); - break; - - case Token::BLOCK_START_TYPE: - $this->stream->next(); - $token = $this->getCurrentToken(); - - if (Token::NAME_TYPE !== $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()); - - $callable = (new ReflectionCallable(new TwigTest('decision', $test)))->getCallable(); - if (\is_array($callable) && $callable[0] instanceof TokenParserInterface) { - $e->appendMessage(\sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $callable[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 (!$node) { - trigger_deprecation('twig/twig', '3.12', 'Returning "null" from "%s" is deprecated and forbidden by "TokenParserInterface".', $subparser::class); - } else { - $node->setNodeTag($subparser->getTag()); - $rv[] = $node; - } - break; - - default: - throw new SyntaxError('The lexer or the parser ended up in an unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext()); - } - } - - if (1 === \count($rv)) { - return $rv[0]; - } - - return new Node($rv, [], $lineno); - } - - public function getBlockStack(): array - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - 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 - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - return isset($this->blocks[$name]); - } - - public function getBlock(string $name): Node - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - return $this->blocks[$name]; - } - - public function setBlock(string $name, BlockNode $value): void - { - if (isset($this->blocks[$name])) { - throw new SyntaxError(\sprintf("The block '%s' has already been defined line %d.", $name, $this->blocks[$name]->getTemplateLine()), $this->getCurrentToken()->getLine(), $this->blocks[$name]->getSourceContext()); - } - - $this->blocks[$name] = new BodyNode([$value], [], $value->getTemplateLine()); - } - - public function hasMacro(string $name): bool - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - 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 - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - 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 - { - trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); - - return $this->parent; - } - - public function hasInheritance() - { - return $this->parent || 0 < \count($this->traits); - } - - public function setParent(?Node $parent): void - { - if (null === $parent) { - trigger_deprecation('twig/twig', '3.12', 'Passing "null" to "%s()" is deprecated.', __METHOD__); - } - - if (null !== $this->parent) { - throw new SyntaxError('Multiple extends tags are forbidden.', $parent->getTemplateLine(), $parent->getSourceContext()); - } - - $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 (str_contains((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; - } -} + + */ +class Parser +{ + private $stack = []; + private $stream; + private $parent; + private $visitors; + private $expressionParser; + private $blocks; + private $blockStack; + private $macros; + private $importedSymbols; + private $traits; + private $embeddedTemplates = []; + private $varNameSalt = 0; + + public function __construct( + private Environment $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->getCurrentToken()->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); + + /** + * @var ModuleNode $node + */ + $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: + $token = $this->stream->next(); + $rv[] = new TextNode($token->getValue(), $token->getLine()); + break; + + case Token::VAR_START_TYPE: + $token = $this->stream->next(); + $expr = $this->expressionParser->parseExpression(); + $this->stream->expect(Token::VAR_END_TYPE); + $rv[] = new PrintNode($expr, $token->getLine()); + break; + + case Token::BLOCK_START_TYPE: + $this->stream->next(); + $token = $this->getCurrentToken(); + + if (Token::NAME_TYPE !== $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()); + + $callable = (new ReflectionCallable(new TwigTest('decision', $test)))->getCallable(); + if (\is_array($callable) && $callable[0] instanceof TokenParserInterface) { + $e->appendMessage(\sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $callable[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 (!$node) { + trigger_deprecation('twig/twig', '3.12', 'Returning "null" from "%s" is deprecated and forbidden by "TokenParserInterface".', $subparser::class); + } else { + $node->setNodeTag($subparser->getTag()); + $rv[] = $node; + } + break; + + default: + throw new SyntaxError('The lexer or the parser ended up in an unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext()); + } + } + + if (1 === \count($rv)) { + return $rv[0]; + } + + return new Node($rv, [], $lineno); + } + + public function getBlockStack(): array + { + trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); + + 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 + { + trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); + + return isset($this->blocks[$name]); + } + + public function getBlock(string $name): Node + { + trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); + + return $this->blocks[$name]; + } + + public function setBlock(string $name, BlockNode $value): void + { + if (isset($this->blocks[$name])) { + throw new SyntaxError(\sprintf("The block '%s' has already been defined line %d.", $name, $this->blocks[$name]->getTemplateLine()), $this->getCurrentToken()->getLine(), $this->blocks[$name]->getSourceContext()); + } + + $this->blocks[$name] = new BodyNode([$value], [], $value->getTemplateLine()); + } + + public function hasMacro(string $name): bool + { + trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); + + 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 + { + trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); + + 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 + { + trigger_deprecation('twig/twig', '3.12', 'Method "%s()" is deprecated.', __METHOD__); + + return $this->parent; + } + + public function hasInheritance() + { + return $this->parent || 0 < \count($this->traits); + } + + public function setParent(?Node $parent): void + { + if (null === $parent) { + trigger_deprecation('twig/twig', '3.12', 'Passing "null" to "%s()" is deprecated.', __METHOD__); + } + + if (null !== $this->parent) { + throw new SyntaxError('Multiple extends tags are forbidden.', $parent->getTemplateLine(), $parent->getSourceContext()); + } + + $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 (str_contains((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 index 267718c..09866c3 100644 --- a/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php +++ b/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php @@ -1,63 +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; - } -} + + */ +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 index bb3fbb5..def7632 100644 --- a/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php +++ b/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php @@ -1,72 +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(), - ]; - } - } -} + + */ +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 index cdab2de..c403b2c 100644 --- a/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php +++ b/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php @@ -1,47 +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(), 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); - } -} + + */ +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(), 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 index 1c1f77e..c6694e1 100644 --- a/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php +++ b/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php @@ -1,35 +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); - } -} + + */ +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 index 4d8e504..65f55d7 100644 --- a/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php +++ b/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php @@ -1,44 +1,44 @@ - - */ -#[YieldReady] -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") - ; - } -} + + */ +#[YieldReady] +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 index bd9227e..90554a3 100644 --- a/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php +++ b/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php @@ -1,38 +1,38 @@ - - */ -#[YieldReady] -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')) - ; - } -} + + */ +#[YieldReady] +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 index 1458bc5..508cfbc 100644 --- a/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php +++ b/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php @@ -1,69 +1,69 @@ - - */ -final class ProfilerNodeVisitor implements NodeVisitorInterface -{ - private $varName; - - public function __construct( - private string $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; - } -} + + */ +final class ProfilerNodeVisitor implements NodeVisitorInterface +{ + private $varName; + + public function __construct( + private string $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 index 2928e16..7662e73 100644 --- a/vendor/twig/twig/src/Profiler/Profile.php +++ b/vendor/twig/twig/src/Profiler/Profile.php @@ -1,178 +1,178 @@ - - */ -final class Profile implements \IteratorAggregate, \Serializable -{ - public const ROOT = 'ROOT'; - public const BLOCK = 'block'; - public const TEMPLATE = 'template'; - public const MACRO = 'macro'; - private $starts = []; - private $ends = []; - private $profiles = []; - - public function __construct( - private string $template = 'main', - private string $type = self::ROOT, - private string $name = 'main', - ) { - $this->name = str_starts_with($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 - { - [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles] = $data; - } -} + + */ +final class Profile implements \IteratorAggregate, \Serializable +{ + public const ROOT = 'ROOT'; + public const BLOCK = 'block'; + public const TEMPLATE = 'template'; + public const MACRO = 'macro'; + private $starts = []; + private $ends = []; + private $profiles = []; + + public function __construct( + private string $template = 'main', + private string $type = self::ROOT, + private string $name = 'main', + ) { + $this->name = str_starts_with($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 + { + [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles] = $data; + } +} diff --git a/vendor/twig/twig/src/Resources/core.php b/vendor/twig/twig/src/Resources/core.php index 6e2fcfb..73d02cb 100644 --- a/vendor/twig/twig/src/Resources/core.php +++ b/vendor/twig/twig/src/Resources/core.php @@ -1,541 +1,541 @@ -getCharset(), $values, $max); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_date_format_filter(Environment $env, $date, $format = null, $timezone = null) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return $env->getExtension(CoreExtension::class)->formatDate($date, $format, $timezone); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_date_modify_filter(Environment $env, $date, $modifier) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return $env->getExtension(CoreExtension::class)->modifyDate($date, $modifier); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_sprintf($format, ...$values) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::sprintf($format, ...$values); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_date_converter(Environment $env, $date = null, $timezone = null) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return $env->getExtension(CoreExtension::class)->convertDate($date, $timezone); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_replace_filter($str, $from) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::replace($str, $from); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_round($value, $precision = 0, $method = 'common') -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::round($value, $precision, $method); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_number_format_filter(Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return $env->getExtension(CoreExtension::class)->formatNumber($number, $decimal, $decimalPoint, $thousandSep); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_urlencode_filter($url) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::urlencode($url); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_array_merge(...$arrays) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::merge(...$arrays); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_slice(Environment $env, $item, $start, $length = null, $preserveKeys = false) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::slice($env->getCharset(), $item, $start, $length, $preserveKeys); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_first(Environment $env, $item) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::first($env->getCharset(), $item); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_last(Environment $env, $item) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::last($env->getCharset(), $item); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_join_filter($value, $glue = '', $and = null) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::join($value, $glue, $and); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_split_filter(Environment $env, $value, $delimiter, $limit = null) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::split($env->getCharset(), $value, $delimiter, $limit); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_get_array_keys_filter($array) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::keys($array); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_reverse_filter(Environment $env, $item, $preserveKeys = false) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::reverse($env->getCharset(), $item, $preserveKeys); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_sort_filter(Environment $env, $array, $arrow = null) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::sort($env, $array, $arrow); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_matches(string $regexp, ?string $str) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::matches($regexp, $str); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_trim_filter($string, $characterMask = null, $side = 'both') -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::trim($string, $characterMask, $side); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_nl2br($string) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::nl2br($string); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_spaceless($content) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::spaceless($content); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_convert_encoding($string, $to, $from) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::convertEncoding($string, $to, $from); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_length_filter(Environment $env, $thing) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::length($env->getCharset(), $thing); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_upper_filter(Environment $env, $string) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::upper($env->getCharset(), $string); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_lower_filter(Environment $env, $string) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::lower($env->getCharset(), $string); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_striptags($string, $allowable_tags = null) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::striptags($string, $allowable_tags); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_title_string_filter(Environment $env, $string) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::titleCase($env->getCharset(), $string); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_capitalize_string_filter(Environment $env, $string) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::capitalize($env->getCharset(), $string); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_test_empty($value) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::testEmpty($value); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_test_iterable($value) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return is_iterable($value); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_include(Environment $env, $context, $template, $variables = [], $withContext = true, $ignoreMissing = false, $sandboxed = false) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::include($env, $context, $template, $variables, $withContext, $ignoreMissing, $sandboxed); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_source(Environment $env, $name, $ignoreMissing = false) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::source($env, $name, $ignoreMissing); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_constant($constant, $object = null) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::constant($constant, $object); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_constant_is_defined($constant, $object = null) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::constant($constant, $object, true); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_array_batch($items, $size, $fill = null, $preserveKeys = true) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::batch($items, $size, $fill, $preserveKeys); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_array_column($array, $name, $index = null): array -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::column($array, $name, $index); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_array_filter(Environment $env, $array, $arrow) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::filter($env, $array, $arrow); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_array_map(Environment $env, $array, $arrow) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::map($env, $array, $arrow); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_array_reduce(Environment $env, $array, $arrow, $initial = null) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::reduce($env, $array, $arrow, $initial); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_array_some(Environment $env, $array, $arrow) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::arraySome($env, $array, $arrow); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_array_every(Environment $env, $array, $arrow) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::arrayEvery($env, $array, $arrow); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_check_arrow_in_sandbox(Environment $env, $arrow, $thing, $type) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return CoreExtension::checkArrowInSandbox($env, $arrow, $thing, $type); -} +getCharset(), $values, $max); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_date_format_filter(Environment $env, $date, $format = null, $timezone = null) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return $env->getExtension(CoreExtension::class)->formatDate($date, $format, $timezone); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_date_modify_filter(Environment $env, $date, $modifier) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return $env->getExtension(CoreExtension::class)->modifyDate($date, $modifier); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_sprintf($format, ...$values) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::sprintf($format, ...$values); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_date_converter(Environment $env, $date = null, $timezone = null) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return $env->getExtension(CoreExtension::class)->convertDate($date, $timezone); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_replace_filter($str, $from) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::replace($str, $from); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_round($value, $precision = 0, $method = 'common') +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::round($value, $precision, $method); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_number_format_filter(Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return $env->getExtension(CoreExtension::class)->formatNumber($number, $decimal, $decimalPoint, $thousandSep); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_urlencode_filter($url) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::urlencode($url); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_array_merge(...$arrays) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::merge(...$arrays); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_slice(Environment $env, $item, $start, $length = null, $preserveKeys = false) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::slice($env->getCharset(), $item, $start, $length, $preserveKeys); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_first(Environment $env, $item) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::first($env->getCharset(), $item); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_last(Environment $env, $item) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::last($env->getCharset(), $item); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_join_filter($value, $glue = '', $and = null) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::join($value, $glue, $and); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_split_filter(Environment $env, $value, $delimiter, $limit = null) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::split($env->getCharset(), $value, $delimiter, $limit); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_get_array_keys_filter($array) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::keys($array); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_reverse_filter(Environment $env, $item, $preserveKeys = false) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::reverse($env->getCharset(), $item, $preserveKeys); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_sort_filter(Environment $env, $array, $arrow = null) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::sort($env, $array, $arrow); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_matches(string $regexp, ?string $str) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::matches($regexp, $str); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_trim_filter($string, $characterMask = null, $side = 'both') +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::trim($string, $characterMask, $side); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_nl2br($string) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::nl2br($string); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_spaceless($content) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::spaceless($content); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_convert_encoding($string, $to, $from) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::convertEncoding($string, $to, $from); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_length_filter(Environment $env, $thing) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::length($env->getCharset(), $thing); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_upper_filter(Environment $env, $string) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::upper($env->getCharset(), $string); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_lower_filter(Environment $env, $string) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::lower($env->getCharset(), $string); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_striptags($string, $allowable_tags = null) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::striptags($string, $allowable_tags); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_title_string_filter(Environment $env, $string) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::titleCase($env->getCharset(), $string); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_capitalize_string_filter(Environment $env, $string) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::capitalize($env->getCharset(), $string); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_test_empty($value) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::testEmpty($value); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_test_iterable($value) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return is_iterable($value); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_include(Environment $env, $context, $template, $variables = [], $withContext = true, $ignoreMissing = false, $sandboxed = false) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::include($env, $context, $template, $variables, $withContext, $ignoreMissing, $sandboxed); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_source(Environment $env, $name, $ignoreMissing = false) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::source($env, $name, $ignoreMissing); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_constant($constant, $object = null) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::constant($constant, $object); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_constant_is_defined($constant, $object = null) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::constant($constant, $object, true); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_array_batch($items, $size, $fill = null, $preserveKeys = true) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::batch($items, $size, $fill, $preserveKeys); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_array_column($array, $name, $index = null): array +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::column($array, $name, $index); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_array_filter(Environment $env, $array, $arrow) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::filter($env, $array, $arrow); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_array_map(Environment $env, $array, $arrow) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::map($env, $array, $arrow); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_array_reduce(Environment $env, $array, $arrow, $initial = null) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::reduce($env, $array, $arrow, $initial); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_array_some(Environment $env, $array, $arrow) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::arraySome($env, $array, $arrow); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_array_every(Environment $env, $array, $arrow) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::arrayEvery($env, $array, $arrow); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_check_arrow_in_sandbox(Environment $env, $arrow, $thing, $type) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return CoreExtension::checkArrowInSandbox($env, $arrow, $thing, $type); +} diff --git a/vendor/twig/twig/src/Resources/debug.php b/vendor/twig/twig/src/Resources/debug.php index 104b4f4..4f077f0 100644 --- a/vendor/twig/twig/src/Resources/debug.php +++ b/vendor/twig/twig/src/Resources/debug.php @@ -1,25 +1,25 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Twig\Environment; -use Twig\Extension\DebugExtension; - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_var_dump(Environment $env, $context, ...$vars) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - DebugExtension::dump($env, $context, ...$vars); -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Twig\Environment; +use Twig\Extension\DebugExtension; + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_var_dump(Environment $env, $context, ...$vars) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + DebugExtension::dump($env, $context, ...$vars); +} diff --git a/vendor/twig/twig/src/Resources/escaper.php b/vendor/twig/twig/src/Resources/escaper.php index a2ee8e7..a1369be 100644 --- a/vendor/twig/twig/src/Resources/escaper.php +++ b/vendor/twig/twig/src/Resources/escaper.php @@ -1,51 +1,51 @@ -getRuntime(EscaperRuntime::class)->escape($string, $strategy, $charset, $autoescape); -} - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_escape_filter_is_safe(Node $filterArgs) -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return EscaperExtension::escapeFilterIsSafe($filterArgs); -} +getRuntime(EscaperRuntime::class)->escape($string, $strategy, $charset, $autoescape); +} + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_escape_filter_is_safe(Node $filterArgs) +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return EscaperExtension::escapeFilterIsSafe($filterArgs); +} diff --git a/vendor/twig/twig/src/Resources/string_loader.php b/vendor/twig/twig/src/Resources/string_loader.php index 8f0e649..b0ace1e 100644 --- a/vendor/twig/twig/src/Resources/string_loader.php +++ b/vendor/twig/twig/src/Resources/string_loader.php @@ -1,26 +1,26 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Twig\Environment; -use Twig\Extension\StringLoaderExtension; -use Twig\TemplateWrapper; - -/** - * @internal - * - * @deprecated since Twig 3.9 - */ -function twig_template_from_string(Environment $env, $template, ?string $name = null): TemplateWrapper -{ - trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); - - return StringLoaderExtension::templateFromString($env, $template, $name); -} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Twig\Environment; +use Twig\Extension\StringLoaderExtension; +use Twig\TemplateWrapper; + +/** + * @internal + * + * @deprecated since Twig 3.9 + */ +function twig_template_from_string(Environment $env, $template, ?string $name = null): TemplateWrapper +{ + trigger_deprecation('twig/twig', '3.9', 'Using the internal "%s" function is deprecated.', __FUNCTION__); + + return StringLoaderExtension::templateFromString($env, $template, $name); +} diff --git a/vendor/twig/twig/src/Runtime/EscaperRuntime.php b/vendor/twig/twig/src/Runtime/EscaperRuntime.php index a3ce171..9593728 100644 --- a/vendor/twig/twig/src/Runtime/EscaperRuntime.php +++ b/vendor/twig/twig/src/Runtime/EscaperRuntime.php @@ -1,327 +1,327 @@ - */ - private $escapers = []; - - /** @internal */ - public $safeClasses = []; - - /** @internal */ - public $safeLookup = []; - - public function __construct( - private $charset = 'UTF-8', - ) { - } - - /** - * 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(string $string, string $charset): string $callable A valid PHP callable - */ - public function setEscaper($strategy, callable $callable) - { - $this->escapers[$strategy] = $callable; - } - - /** - * Gets all defined escapers. - * - * @return array 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; - } - } - - /** - * Escapes a string. - * - * @param mixed $string The value to be escaped - * @param string $strategy The escaping strategy - * @param string|null $charset The charset - * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) - * - * @throws RuntimeError - */ - public function escape($string, string $strategy = 'html', ?string $charset = null, bool $autoescape = false) - { - if ($autoescape && $string instanceof Markup) { - return $string; - } - - if (!\is_string($string)) { - if ($string instanceof \Stringable) { - if ($autoescape) { - $c = \get_class($string); - if (!isset($this->safeClasses[$c])) { - $this->safeClasses[$c] = []; - foreach (class_parents($string) + class_implements($string) as $class) { - if (isset($this->safeClasses[$class])) { - $this->safeClasses[$c] = array_unique(array_merge($this->safeClasses[$c], $this->safeClasses[$class])); - foreach ($this->safeClasses[$class] as $s) { - $this->safeLookup[$s][$c] = true; - } - } - } - } - if (isset($this->safeLookup[$strategy][$c]) || isset($this->safeLookup['all'][$c])) { - return (string) $string; - } - } - - $string = (string) $string; - } elseif (\in_array($strategy, ['html', 'js', 'css', 'html_attr', 'url'])) { - // we return the input as is (which can be of any type) - return $string; - } - } - - if ('' === $string) { - return ''; - } - - $charset = $charset ?: $this->charset; - - 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 = $this->convertEncoding($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 = $this->convertEncoding($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 = $this->convertEncoding($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 = $this->convertEncoding($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: - if (\array_key_exists($strategy, $this->escapers)) { - return $this->escapers[$strategy]($string, $charset); - } - - $validStrategies = implode('", "', array_merge(['html', 'js', 'url', 'css', 'html_attr'], array_keys($this->escapers))); - - throw new RuntimeError(\sprintf('Invalid escaping strategy "%s" (valid ones: "%s").', $strategy, $validStrategies)); - } - } - - private function convertEncoding(string $string, string $to, string $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); - } -} + */ + private $escapers = []; + + /** @internal */ + public $safeClasses = []; + + /** @internal */ + public $safeLookup = []; + + public function __construct( + private $charset = 'UTF-8', + ) { + } + + /** + * 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(string $string, string $charset): string $callable A valid PHP callable + */ + public function setEscaper($strategy, callable $callable) + { + $this->escapers[$strategy] = $callable; + } + + /** + * Gets all defined escapers. + * + * @return array 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; + } + } + + /** + * Escapes a string. + * + * @param mixed $string The value to be escaped + * @param string $strategy The escaping strategy + * @param string|null $charset The charset + * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) + * + * @throws RuntimeError + */ + public function escape($string, string $strategy = 'html', ?string $charset = null, bool $autoescape = false) + { + if ($autoescape && $string instanceof Markup) { + return $string; + } + + if (!\is_string($string)) { + if ($string instanceof \Stringable) { + if ($autoescape) { + $c = \get_class($string); + if (!isset($this->safeClasses[$c])) { + $this->safeClasses[$c] = []; + foreach (class_parents($string) + class_implements($string) as $class) { + if (isset($this->safeClasses[$class])) { + $this->safeClasses[$c] = array_unique(array_merge($this->safeClasses[$c], $this->safeClasses[$class])); + foreach ($this->safeClasses[$class] as $s) { + $this->safeLookup[$s][$c] = true; + } + } + } + } + if (isset($this->safeLookup[$strategy][$c]) || isset($this->safeLookup['all'][$c])) { + return (string) $string; + } + } + + $string = (string) $string; + } elseif (\in_array($strategy, ['html', 'js', 'css', 'html_attr', 'url'])) { + // we return the input as is (which can be of any type) + return $string; + } + } + + if ('' === $string) { + return ''; + } + + $charset = $charset ?: $this->charset; + + 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 = $this->convertEncoding($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 = $this->convertEncoding($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 = $this->convertEncoding($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 = $this->convertEncoding($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: + if (\array_key_exists($strategy, $this->escapers)) { + return $this->escapers[$strategy]($string, $charset); + } + + $validStrategies = implode('", "', array_merge(['html', 'js', 'url', 'css', 'html_attr'], array_keys($this->escapers))); + + throw new RuntimeError(\sprintf('Invalid escaping strategy "%s" (valid ones: "%s").', $strategy, $validStrategies)); + } + } + + private function convertEncoding(string $string, string $to, string $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); + } +} diff --git a/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php b/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php index 0510668..dfc4a8d 100644 --- a/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php +++ b/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php @@ -1,35 +1,35 @@ - - * @author Robin Chalas - */ -class ContainerRuntimeLoader implements RuntimeLoaderInterface -{ - public function __construct( - private ContainerInterface $container, - ) { - } - - public function load(string $class) - { - return $this->container->has($class) ? $this->container->get($class) : null; - } -} + + * @author Robin Chalas + */ +class ContainerRuntimeLoader implements RuntimeLoaderInterface +{ + public function __construct( + private ContainerInterface $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 index 5d4e70b..9b6116f 100644 --- a/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php +++ b/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php @@ -1,39 +1,39 @@ - - */ -class FactoryRuntimeLoader implements RuntimeLoaderInterface -{ - /** - * @param array $map An array where keys are class names and values factory callables - */ - public function __construct( - private array $map = [], - ) { - } - - public function load(string $class) - { - if (!isset($this->map[$class])) { - return null; - } - - $runtimeFactory = $this->map[$class]; - - return $runtimeFactory(); - } -} + + */ +class FactoryRuntimeLoader implements RuntimeLoaderInterface +{ + /** + * @param array $map An array where keys are class names and values factory callables + */ + public function __construct( + private array $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 index 9e5b204..823016c 100644 --- a/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php +++ b/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php @@ -1,27 +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); -} + + */ +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 index 30a404f..f147e78 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityError.php @@ -1,23 +1,23 @@ - - */ -class SecurityError extends Error -{ -} + + */ +class SecurityError extends Error +{ +} diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php index 02d3063..b0d6d27 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php @@ -1,33 +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; - } -} + + */ +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 index 4f76dc6..4c2192e 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php @@ -1,33 +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; - } -} + + */ +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 index 8df9d0b..2ff5c9d 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php @@ -1,40 +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; - } -} + + */ +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 index 42ec4f3..48af0ce 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php @@ -1,40 +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; - } -} + + */ +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 index 4522150..ccbce49 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php @@ -1,33 +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; - } -} + + */ +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 index 988e372..7474781 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityPolicy.php +++ b/vendor/twig/twig/src/Sandbox/SecurityPolicy.php @@ -1,130 +1,130 @@ - - */ -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)) { - if ('extends' === $tag) { - trigger_deprecation('twig/twig', '3.12', 'The "extends" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitly in your sandbox policy if needed.'); - } elseif ('use' === $tag) { - trigger_deprecation('twig/twig', '3.12', 'The "use" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitly in your sandbox policy if needed.'); - } else { - 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 && \in_array($method, $methods)) { - $allowed = true; - 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 && \in_array($property, \is_array($properties) ? $properties : [$properties])) { - $allowed = true; - 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); - } - } -} + + */ +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)) { + if ('extends' === $tag) { + trigger_deprecation('twig/twig', '3.12', 'The "extends" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitly in your sandbox policy if needed.'); + } elseif ('use' === $tag) { + trigger_deprecation('twig/twig', '3.12', 'The "use" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitly in your sandbox policy if needed.'); + } else { + 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 && \in_array($method, $methods)) { + $allowed = true; + 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 && \in_array($property, \is_array($properties) ? $properties : [$properties])) { + $allowed = true; + 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 index 36471c5..20d1497 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php +++ b/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php @@ -1,45 +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; -} + + */ +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/Sandbox/SourcePolicyInterface.php b/vendor/twig/twig/src/Sandbox/SourcePolicyInterface.php index b952f1e..d2461b3 100644 --- a/vendor/twig/twig/src/Sandbox/SourcePolicyInterface.php +++ b/vendor/twig/twig/src/Sandbox/SourcePolicyInterface.php @@ -1,24 +1,24 @@ - - */ -final class Source -{ - /** - * @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( - private string $code, - private string $name, - private string $path = '', - ) { - } - - public function getCode(): string - { - return $this->code; - } - - public function getName(): string - { - return $this->name; - } - - public function getPath(): string - { - return $this->path; - } -} + + */ +final class Source +{ + /** + * @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( + private string $code, + private string $name, + private string $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 index 7b3ce81..a52855c 100644 --- a/vendor/twig/twig/src/Template.php +++ b/vendor/twig/twig/src/Template.php @@ -1,497 +1,497 @@ -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 $blocks = []; - protected $traits = []; - protected $extensions = []; - protected $sandbox; - - private $useYield; - - public function __construct( - protected Environment $env, - ) { - $this->useYield = $env->useYield(); - $this->extensions = $env->getExtensions(); - } - - /** - * Returns the template name. - */ - abstract public function getTemplateName(): string; - - /** - * Returns debug information about the template. - * - * @return array Debug information - */ - abstract public function getDebugInfo(): array; - - /** - * Returns information about the original template source code. - */ - abstract public function getSourceContext(): Source; - - /** - * Returns the parent template. - * - * This method is for internal use only and should never be called - * directly. - * - * @return self|TemplateWrapper|false The parent template or false if there is no parent - */ - public function getParent(array $context): self|TemplateWrapper|false - { - if (null !== $this->parent) { - return $this->parent; - } - - try { - if (!$parent = $this->doGetParent($context)) { - 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): bool|string|self|TemplateWrapper - { - return false; - } - - public function isTraitable(): bool - { - 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 = []): void - { - foreach ($this->yieldParentBlock($name, $context, $blocks) as $data) { - echo $data; - } - } - - /** - * 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): void - { - foreach ($this->yieldBlock($name, $context, $blocks, $useBlocks, $templateContext) as $data) { - echo $data; - } - } - - /** - * 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 = []): string - { - if (!$this->useYield) { - if ($this->env->isDebug()) { - ob_start(); - } else { - ob_start(function () { return ''; }); - } - $this->displayParentBlock($name, $context, $blocks); - - return ob_get_clean(); - } - - $content = ''; - foreach ($this->yieldParentBlock($name, $context, $blocks) as $data) { - $content .= $data; - } - - return $content; - } - - /** - * 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): string - { - if (!$this->useYield) { - $level = ob_get_level(); - if ($this->env->isDebug()) { - ob_start(); - } else { - ob_start(function () { return ''; }); - } - try { - $this->displayBlock($name, $context, $blocks, $useBlocks); - } catch (\Throwable $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - $content = ''; - foreach ($this->yieldBlock($name, $context, $blocks, $useBlocks) as $data) { - $content .= $data; - } - - return $content; - } - - /** - * 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 = []): bool - { - if (isset($blocks[$name])) { - return $blocks[$name][0] instanceof self; - } - - if (isset($this->blocks[$name])) { - return true; - } - - if ($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 = []): array - { - $names = array_merge(array_keys($blocks), array_keys($this->blocks)); - - if ($parent = $this->getParent($context)) { - $names = array_merge($names, $parent->getBlockNames($context)); - } - - return array_unique($names); - } - - /** - * @param string|TemplateWrapper|array $template - */ - protected function loadTemplate($template, $templateName = null, $line = null, $index = null): self|TemplateWrapper - { - try { - if (\is_array($template)) { - return $this->env->resolveTemplate($template); - } - - if ($template instanceof TemplateWrapper) { - return $template; - } - - if ($template instanceof self) { - trigger_deprecation('twig/twig', '3.9', 'Passing a "%s" instance to "%s" is deprecated.', self::class, __METHOD__); - - 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 - */ - public function unwrap(): self - { - 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(): array - { - return $this->blocks; - } - - public function display(array $context, array $blocks = []): void - { - foreach ($this->yield($context, $blocks) as $data) { - echo $data; - } - } - - public function render(array $context): string - { - if (!$this->useYield) { - $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(); - } - - $content = ''; - foreach ($this->yield($context) as $data) { - $content .= $data; - } - - return $content; - } - - /** - * @return iterable - */ - public function yield(array $context, array $blocks = []): iterable - { - $context += $this->env->getGlobals(); - $blocks = array_merge($this->blocks, $blocks); - - try { - yield from $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 (\Throwable $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; - } - } - - /** - * @return iterable - */ - public function yieldBlock($name, array $context, array $blocks = [], $useBlocks = true, ?self $templateContext = null): iterable - { - 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 { - yield from $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 (\Throwable $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 ($parent = $this->getParent($context)) { - yield from $parent->unwrap()->yieldBlock($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()); - } - } - - /** - * Yields 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 - * - * @return iterable - */ - public function yieldParentBlock($name, array $context, array $blocks = []): iterable - { - if (isset($this->traits[$name])) { - yield from $this->traits[$name][0]->yieldBlock($name, $context, $blocks, false); - } elseif ($parent = $this->getParent($context)) { - yield from $parent->unwrap()->yieldBlock($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()); - } - } - - /** - * 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 - * - * @return iterable - */ - abstract protected function doDisplay(array $context, array $blocks = []): iterable; -} +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 $blocks = []; + protected $traits = []; + protected $extensions = []; + protected $sandbox; + + private $useYield; + + public function __construct( + protected Environment $env, + ) { + $this->useYield = $env->useYield(); + $this->extensions = $env->getExtensions(); + } + + /** + * Returns the template name. + */ + abstract public function getTemplateName(): string; + + /** + * Returns debug information about the template. + * + * @return array Debug information + */ + abstract public function getDebugInfo(): array; + + /** + * Returns information about the original template source code. + */ + abstract public function getSourceContext(): Source; + + /** + * Returns the parent template. + * + * This method is for internal use only and should never be called + * directly. + * + * @return self|TemplateWrapper|false The parent template or false if there is no parent + */ + public function getParent(array $context): self|TemplateWrapper|false + { + if (null !== $this->parent) { + return $this->parent; + } + + try { + if (!$parent = $this->doGetParent($context)) { + 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): bool|string|self|TemplateWrapper + { + return false; + } + + public function isTraitable(): bool + { + 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 = []): void + { + foreach ($this->yieldParentBlock($name, $context, $blocks) as $data) { + echo $data; + } + } + + /** + * 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): void + { + foreach ($this->yieldBlock($name, $context, $blocks, $useBlocks, $templateContext) as $data) { + echo $data; + } + } + + /** + * 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 = []): string + { + if (!$this->useYield) { + if ($this->env->isDebug()) { + ob_start(); + } else { + ob_start(function () { return ''; }); + } + $this->displayParentBlock($name, $context, $blocks); + + return ob_get_clean(); + } + + $content = ''; + foreach ($this->yieldParentBlock($name, $context, $blocks) as $data) { + $content .= $data; + } + + return $content; + } + + /** + * 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): string + { + if (!$this->useYield) { + $level = ob_get_level(); + if ($this->env->isDebug()) { + ob_start(); + } else { + ob_start(function () { return ''; }); + } + try { + $this->displayBlock($name, $context, $blocks, $useBlocks); + } catch (\Throwable $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } + + return ob_get_clean(); + } + + $content = ''; + foreach ($this->yieldBlock($name, $context, $blocks, $useBlocks) as $data) { + $content .= $data; + } + + return $content; + } + + /** + * 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 = []): bool + { + if (isset($blocks[$name])) { + return $blocks[$name][0] instanceof self; + } + + if (isset($this->blocks[$name])) { + return true; + } + + if ($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 = []): array + { + $names = array_merge(array_keys($blocks), array_keys($this->blocks)); + + if ($parent = $this->getParent($context)) { + $names = array_merge($names, $parent->getBlockNames($context)); + } + + return array_unique($names); + } + + /** + * @param string|TemplateWrapper|array $template + */ + protected function loadTemplate($template, $templateName = null, $line = null, $index = null): self|TemplateWrapper + { + try { + if (\is_array($template)) { + return $this->env->resolveTemplate($template); + } + + if ($template instanceof TemplateWrapper) { + return $template; + } + + if ($template instanceof self) { + trigger_deprecation('twig/twig', '3.9', 'Passing a "%s" instance to "%s" is deprecated.', self::class, __METHOD__); + + 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 + */ + public function unwrap(): self + { + 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(): array + { + return $this->blocks; + } + + public function display(array $context, array $blocks = []): void + { + foreach ($this->yield($context, $blocks) as $data) { + echo $data; + } + } + + public function render(array $context): string + { + if (!$this->useYield) { + $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(); + } + + $content = ''; + foreach ($this->yield($context) as $data) { + $content .= $data; + } + + return $content; + } + + /** + * @return iterable + */ + public function yield(array $context, array $blocks = []): iterable + { + $context += $this->env->getGlobals(); + $blocks = array_merge($this->blocks, $blocks); + + try { + yield from $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 (\Throwable $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; + } + } + + /** + * @return iterable + */ + public function yieldBlock($name, array $context, array $blocks = [], $useBlocks = true, ?self $templateContext = null): iterable + { + 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 { + yield from $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 (\Throwable $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 ($parent = $this->getParent($context)) { + yield from $parent->unwrap()->yieldBlock($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()); + } + } + + /** + * Yields 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 + * + * @return iterable + */ + public function yieldParentBlock($name, array $context, array $blocks = []): iterable + { + if (isset($this->traits[$name])) { + yield from $this->traits[$name][0]->yieldBlock($name, $context, $blocks, false); + } elseif ($parent = $this->getParent($context)) { + yield from $parent->unwrap()->yieldBlock($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()); + } + } + + /** + * 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 + * + * @return iterable + */ + abstract protected function doDisplay(array $context, array $blocks = []): iterable; +} diff --git a/vendor/twig/twig/src/TemplateWrapper.php b/vendor/twig/twig/src/TemplateWrapper.php index 135c591..3a9b491 100644 --- a/vendor/twig/twig/src/TemplateWrapper.php +++ b/vendor/twig/twig/src/TemplateWrapper.php @@ -1,90 +1,90 @@ - - */ -final class TemplateWrapper -{ - /** - * This method is for internal use only and should never be called - * directly (use Twig\Environment::load() instead). - * - * @internal - */ - public function __construct( - private Environment $env, - private Template $template, - ) { - } - - public function render(array $context = []): string - { - return $this->template->render($context); - } - - 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 - { - return $this->template->renderBlock($name, $context + $this->env->getGlobals()); - } - - public function displayBlock(string $name, array $context = []) - { - $context += $this->env->getGlobals(); - foreach ($this->template->yieldBlock($name, $context) as $data) { - echo $data; - } - } - - 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; - } -} + + */ +final class TemplateWrapper +{ + /** + * This method is for internal use only and should never be called + * directly (use Twig\Environment::load() instead). + * + * @internal + */ + public function __construct( + private Environment $env, + private Template $template, + ) { + } + + public function render(array $context = []): string + { + return $this->template->render($context); + } + + 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 + { + return $this->template->renderBlock($name, $context + $this->env->getGlobals()); + } + + public function displayBlock(string $name, array $context = []) + { + $context += $this->env->getGlobals(); + foreach ($this->template->yieldBlock($name, $context) as $data) { + echo $data; + } + } + + 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 index 8690a80..6df17f3 100644 --- a/vendor/twig/twig/src/Test/IntegrationTestCase.php +++ b/vendor/twig/twig/src/Test/IntegrationTestCase.php @@ -1,288 +1,288 @@ - - * @author Karma Dordrak - */ -abstract class IntegrationTestCase extends TestCase -{ - /** - * @deprecated since Twig 3.13, use getFixturesDirectory() instead. - * - * @return string - */ - protected function getFixturesDir() - { - throw new \BadMethodCallException('Not implemented.'); - } - - protected static function getFixturesDirectory(): string - { - throw new \BadMethodCallException('Not implemented.'); - } - - /** - * @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); - } - - /** - * @final since Twig 3.13 - */ - public function getTests($name, $legacyTests = false) - { - try { - $fixturesDir = static::getFixturesDirectory(); - } catch (\BadMethodCallException) { - trigger_deprecation('twig/twig', '3.13', 'Not overriding "%s::getFixturesDirectory()" in "%s" is deprecated. This method will be abstract in 4.0.', self::class, static::class); - $fixturesDir = $this->getFixturesDir(); - } - - $fixturesDir = realpath($fixturesDir); - $tests = []; - - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fixturesDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if (!preg_match('/\.test$/', $file)) { - continue; - } - - if ($legacyTests xor str_contains($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; - } - - /** - * @final since Twig 3.13 - */ - 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) { - $ret = ''; - eval('$ret = '.$condition.';'); - if (!$ret) { - $this->markTestSkipped($condition); - } - } - - foreach ($outputs as $i => $match) { - $config = array_merge([ - 'cache' => false, - 'strict_variables' => true, - ], $match[2] ? eval($match[2].';') : []); - // make sure that template are always compiled even if they are the same (useful when testing with more than one data/expect sections) - foreach ($templates as $j => $template) { - $templates[$j] = $template.str_repeat(' ', $i); - } - $loader = new ArrayLoader($templates); - $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); - } - - $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) { - [$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; - } -} + + * @author Karma Dordrak + */ +abstract class IntegrationTestCase extends TestCase +{ + /** + * @deprecated since Twig 3.13, use getFixturesDirectory() instead. + * + * @return string + */ + protected function getFixturesDir() + { + throw new \BadMethodCallException('Not implemented.'); + } + + protected static function getFixturesDirectory(): string + { + throw new \BadMethodCallException('Not implemented.'); + } + + /** + * @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); + } + + /** + * @final since Twig 3.13 + */ + public function getTests($name, $legacyTests = false) + { + try { + $fixturesDir = static::getFixturesDirectory(); + } catch (\BadMethodCallException) { + trigger_deprecation('twig/twig', '3.13', 'Not overriding "%s::getFixturesDirectory()" in "%s" is deprecated. This method will be abstract in 4.0.', self::class, static::class); + $fixturesDir = $this->getFixturesDir(); + } + + $fixturesDir = realpath($fixturesDir); + $tests = []; + + foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fixturesDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + if (!preg_match('/\.test$/', $file)) { + continue; + } + + if ($legacyTests xor str_contains($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; + } + + /** + * @final since Twig 3.13 + */ + 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) { + $ret = ''; + eval('$ret = '.$condition.';'); + if (!$ret) { + $this->markTestSkipped($condition); + } + } + + foreach ($outputs as $i => $match) { + $config = array_merge([ + 'cache' => false, + 'strict_variables' => true, + ], $match[2] ? eval($match[2].';') : []); + // make sure that template are always compiled even if they are the same (useful when testing with more than one data/expect sections) + foreach ($templates as $j => $template) { + $templates[$j] = $template.str_repeat(' ', $i); + } + $loader = new ArrayLoader($templates); + $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); + } + + $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) { + [$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 index bac0ea6..beac3c4 100644 --- a/vendor/twig/twig/src/Test/NodeTestCase.php +++ b/vendor/twig/twig/src/Test/NodeTestCase.php @@ -1,125 +1,125 @@ - - */ - public static function provideTests(): iterable - { - trigger_deprecation('twig/twig', '3.13', 'Not implementing "%s()" in "%s" is deprecated. This method will be abstract in 4.0.', __METHOD__, static::class); - - return []; - } - - /** - * @dataProvider getTests - * @dataProvider provideTests - */ - #[DataProvider('getTests'), DataProvider('provideTests')] - public function testCompile($node, $source, $environment = null, $isPattern = false) - { - $this->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($environment ?? $this->getEnvironment()); - } - - /** - * @final since Twig 3.13 - */ - protected function getEnvironment() - { - return $this->currentEnv ??= static::createEnvironment(); - } - - protected static function createEnvironment(): Environment - { - return new Environment(new ArrayLoader()); - } - - /** - * @deprecated since Twig 3.13, use createVariableGetter() instead. - */ - protected function getVariableGetter($name, $line = false) - { - trigger_deprecation('twig/twig', '3.13', 'Method "%s()" is deprecated, use "createVariableGetter()" instead.', __METHOD__); - - return self::createVariableGetter($name, $line); - } - - final protected static function createVariableGetter(string $name, bool $line = false): string - { - $line = $line > 0 ? "// line $line\n" : ''; - - return \sprintf('%s($context["%s"] ?? null)', $line, $name); - } - - /** - * @deprecated since Twig 3.13, use createAttributeGetter() instead. - */ - protected function getAttributeGetter() - { - trigger_deprecation('twig/twig', '3.13', 'Method "%s()" is deprecated, use "createAttributeGetter()" instead.', __METHOD__); - - return self::createAttributeGetter(); - } - - final protected static function createAttributeGetter(): string - { - return 'CoreExtension::getAttribute($this->env, $this->source, '; - } - - /** @beforeClass */ - #[BeforeClass] - final public static function checkDataProvider(): void - { - $r = new \ReflectionMethod(static::class, 'getTests'); - if (self::class !== $r->getDeclaringClass()->getName()) { - trigger_deprecation('twig/twig', '3.13', 'Implementing "%s::getTests()" in "%s" is deprecated, implement "provideTests()" instead.', self::class, static::class); - } - } -} + + */ + public static function provideTests(): iterable + { + trigger_deprecation('twig/twig', '3.13', 'Not implementing "%s()" in "%s" is deprecated. This method will be abstract in 4.0.', __METHOD__, static::class); + + return []; + } + + /** + * @dataProvider getTests + * @dataProvider provideTests + */ + #[DataProvider('getTests'), DataProvider('provideTests')] + public function testCompile($node, $source, $environment = null, $isPattern = false) + { + $this->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($environment ?? $this->getEnvironment()); + } + + /** + * @final since Twig 3.13 + */ + protected function getEnvironment() + { + return $this->currentEnv ??= static::createEnvironment(); + } + + protected static function createEnvironment(): Environment + { + return new Environment(new ArrayLoader()); + } + + /** + * @deprecated since Twig 3.13, use createVariableGetter() instead. + */ + protected function getVariableGetter($name, $line = false) + { + trigger_deprecation('twig/twig', '3.13', 'Method "%s()" is deprecated, use "createVariableGetter()" instead.', __METHOD__); + + return self::createVariableGetter($name, $line); + } + + final protected static function createVariableGetter(string $name, bool $line = false): string + { + $line = $line > 0 ? "// line $line\n" : ''; + + return \sprintf('%s($context["%s"] ?? null)', $line, $name); + } + + /** + * @deprecated since Twig 3.13, use createAttributeGetter() instead. + */ + protected function getAttributeGetter() + { + trigger_deprecation('twig/twig', '3.13', 'Method "%s()" is deprecated, use "createAttributeGetter()" instead.', __METHOD__); + + return self::createAttributeGetter(); + } + + final protected static function createAttributeGetter(): string + { + return 'CoreExtension::getAttribute($this->env, $this->source, '; + } + + /** @beforeClass */ + #[BeforeClass] + final public static function checkDataProvider(): void + { + $r = new \ReflectionMethod(static::class, 'getTests'); + if (self::class !== $r->getDeclaringClass()->getName()) { + trigger_deprecation('twig/twig', '3.13', 'Implementing "%s::getTests()" in "%s" is deprecated, implement "provideTests()" instead.', self::class, static::class); + } + } +} diff --git a/vendor/twig/twig/src/Token.php b/vendor/twig/twig/src/Token.php index 237634a..d7a50a9 100644 --- a/vendor/twig/twig/src/Token.php +++ b/vendor/twig/twig/src/Token.php @@ -1,180 +1,180 @@ - - */ -final class Token -{ - 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 const SPREAD_TYPE = 13; - - public function __construct( - private int $type, - private $value, - private int $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; - case self::SPREAD_TYPE: - $name = 'SPREAD_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'; - case self::SPREAD_TYPE: - return 'spread operator'; - default: - throw new \LogicException(\sprintf('Token of type "%s" does not exist.', $type)); - } - } -} + + */ +final class Token +{ + 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 const SPREAD_TYPE = 13; + + public function __construct( + private int $type, + private $value, + private int $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; + case self::SPREAD_TYPE: + $name = 'SPREAD_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'; + case self::SPREAD_TYPE: + return 'spread operator'; + 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 index 720ea67..ee895aa 100644 --- a/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php @@ -1,32 +1,32 @@ - - */ -abstract class AbstractTokenParser implements TokenParserInterface -{ - /** - * @var Parser - */ - protected $parser; - - public function setParser(Parser $parser): void - { - $this->parser = $parser; - } -} + + */ +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 index 0a6c1af..c37528b 100644 --- a/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php @@ -1,60 +1,60 @@ -getLine(); - $name = $this->parser->getVarName(); - - $ref = new TempNameExpression($name, $lineno); - $ref->setAttribute('always_defined', true); - - $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref); - - $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), - new PrintNode($filter, $lineno), - ], [], $lineno); - } - - public function decideApplyEnd(Token $token): bool - { - return $token->test('endapply'); - } - - public function getTag(): string - { - return 'apply'; - } -} +getLine(); + $name = $this->parser->getVarName(); + + $ref = new TempNameExpression($name, $lineno); + $ref->setAttribute('always_defined', true); + + $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref); + + $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), + new PrintNode($filter, $lineno), + ], [], $lineno); + } + + 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 index b50b29e..1eda978 100644 --- a/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php @@ -1,58 +1,58 @@ -getLine(); - $stream = $this->parser->getStream(); - - if ($stream->test(Token::BLOCK_END_TYPE)) { - $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); - $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); - $stream->expect(Token::BLOCK_END_TYPE); - - return new AutoEscapeNode($value, $body, $lineno); - } - - public function decideBlockEnd(Token $token): bool - { - return $token->test('endautoescape'); - } - - public function getTag(): string - { - return 'autoescape'; - } -} +getLine(); + $stream = $this->parser->getStream(); + + if ($stream->test(Token::BLOCK_END_TYPE)) { + $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); + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(Token::BLOCK_END_TYPE); + + return new AutoEscapeNode($value, $body, $lineno); + } + + 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 index 81d675d..cc81cc0 100644 --- a/vendor/twig/twig/src/TokenParser/BlockTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/BlockTokenParser.php @@ -1,75 +1,75 @@ - - * {% 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)->getValue(); - $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)) { - $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); - if ($token = $stream->nextIf(Token::NAME_TYPE)) { - $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); - - $block->setNode('body', $body); - $this->parser->popBlockStack(); - $this->parser->popLocalScope(); - - return new BlockReferenceNode($name, $lineno); - } - - public function decideBlockEnd(Token $token): bool - { - return $token->test('endblock'); - } - - public function getTag(): string - { - return 'block'; - } -} + + * {% 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)->getValue(); + $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)) { + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + if ($token = $stream->nextIf(Token::NAME_TYPE)) { + $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); + + $block->setNode('body', $body); + $this->parser->popBlockStack(); + $this->parser->popLocalScope(); + + return new BlockReferenceNode($name, $lineno); + } + + 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 index 164ef26..d9872ee 100644 --- a/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php @@ -1,66 +1,66 @@ - - * - * @internal - */ -final class DeprecatedTokenParser extends AbstractTokenParser -{ - public function parse(Token $token): Node - { - $stream = $this->parser->getStream(); - $expressionParser = $this->parser->getExpressionParser(); - $expr = $expressionParser->parseExpression(); - $node = new DeprecatedNode($expr, $token->getLine()); - - while ($stream->test(Token::NAME_TYPE)) { - $k = $stream->getCurrent()->getValue(); - $stream->next(); - $stream->expect(Token::OPERATOR_TYPE, '='); - - switch ($k) { - case 'package': - $node->setNode('package', $expressionParser->parseExpression()); - break; - case 'version': - $node->setNode('version', $expressionParser->parseExpression()); - break; - default: - throw new SyntaxError(\sprintf('Unknown "%s" option.', $k), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } - - $stream->expect(Token::BLOCK_END_TYPE); - - return $node; - } - - public function getTag(): string - { - return 'deprecated'; - } -} + + * + * @internal + */ +final class DeprecatedTokenParser extends AbstractTokenParser +{ + public function parse(Token $token): Node + { + $stream = $this->parser->getStream(); + $expressionParser = $this->parser->getExpressionParser(); + $expr = $expressionParser->parseExpression(); + $node = new DeprecatedNode($expr, $token->getLine()); + + while ($stream->test(Token::NAME_TYPE)) { + $k = $stream->getCurrent()->getValue(); + $stream->next(); + $stream->expect(Token::OPERATOR_TYPE, '='); + + switch ($k) { + case 'package': + $node->setNode('package', $expressionParser->parseExpression()); + break; + case 'version': + $node->setNode('version', $expressionParser->parseExpression()); + break; + default: + throw new SyntaxError(\sprintf('Unknown "%s" option.', $k), $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + } + + $stream->expect(Token::BLOCK_END_TYPE); + + return $node; + } + + public function getTag(): string + { + return 'deprecated'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/DoTokenParser.php b/vendor/twig/twig/src/TokenParser/DoTokenParser.php index 8afd485..1b402fe 100644 --- a/vendor/twig/twig/src/TokenParser/DoTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/DoTokenParser.php @@ -1,38 +1,38 @@ -parser->getExpressionParser()->parseExpression(); - - $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); - - return new DoNode($expr, $token->getLine()); - } - - public function getTag(): string - { - return 'do'; - } -} +parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new DoNode($expr, $token->getLine()); + } + + public function getTag(): string + { + return 'do'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php b/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php index 7bf3233..620c372 100644 --- a/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php @@ -1,73 +1,73 @@ -parser->getStream(); - - $parent = $this->parser->getExpressionParser()->parseExpression(); - - [$variables, $only, $ignoreMissing] = $this->parseArguments(); - - $parentToken = $fakeParentToken = new Token(Token::STRING_TYPE, '__parent__', $token->getLine()); - if ($parent instanceof ConstantExpression) { - $parentToken = new Token(Token::STRING_TYPE, $parent->getAttribute('value'), $token->getLine()); - } elseif ($parent instanceof NameExpression) { - $parentToken = new Token(Token::NAME_TYPE, $parent->getAttribute('name'), $token->getLine()); - } - - // inject a fake parent to make the parent() function work - $stream->injectTokens([ - new Token(Token::BLOCK_START_TYPE, '', $token->getLine()), - new Token(Token::NAME_TYPE, 'extends', $token->getLine()), - $parentToken, - new Token(Token::BLOCK_END_TYPE, '', $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); - - return new EmbedNode($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine()); - } - - public function decideBlockEnd(Token $token): bool - { - return $token->test('endembed'); - } - - public function getTag(): string - { - return 'embed'; - } -} +parser->getStream(); + + $parent = $this->parser->getExpressionParser()->parseExpression(); + + [$variables, $only, $ignoreMissing] = $this->parseArguments(); + + $parentToken = $fakeParentToken = new Token(Token::STRING_TYPE, '__parent__', $token->getLine()); + if ($parent instanceof ConstantExpression) { + $parentToken = new Token(Token::STRING_TYPE, $parent->getAttribute('value'), $token->getLine()); + } elseif ($parent instanceof NameExpression) { + $parentToken = new Token(Token::NAME_TYPE, $parent->getAttribute('name'), $token->getLine()); + } + + // inject a fake parent to make the parent() function work + $stream->injectTokens([ + new Token(Token::BLOCK_START_TYPE, '', $token->getLine()), + new Token(Token::NAME_TYPE, 'extends', $token->getLine()), + $parentToken, + new Token(Token::BLOCK_END_TYPE, '', $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); + + return new EmbedNode($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine()); + } + + 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 index 86ddfdf..99b1e34 100644 --- a/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php @@ -1,49 +1,49 @@ -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()); - } - - $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); - - $stream->expect(Token::BLOCK_END_TYPE); - - return new Node([], [], $token->getLine()); - } - - public function getTag(): string - { - return 'extends'; - } -} +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()); + } + + $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); + + $stream->expect(Token::BLOCK_END_TYPE); + + return new Node([], [], $token->getLine()); + } + + public function getTag(): string + { + return 'extends'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/FlushTokenParser.php b/vendor/twig/twig/src/TokenParser/FlushTokenParser.php index 0d23887..6ab363e 100644 --- a/vendor/twig/twig/src/TokenParser/FlushTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/FlushTokenParser.php @@ -1,38 +1,38 @@ -parser->getStream()->expect(Token::BLOCK_END_TYPE); - - return new FlushNode($token->getLine()); - } - - public function getTag(): string - { - return 'flush'; - } -} +parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new FlushNode($token->getLine()); + } + + public function getTag(): string + { + return 'flush'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/ForTokenParser.php b/vendor/twig/twig/src/TokenParser/ForTokenParser.php index cf655f8..f24b7a5 100644 --- a/vendor/twig/twig/src/TokenParser/ForTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/ForTokenParser.php @@ -1,78 +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, 'in'); - $seq = $this->parser->getExpressionParser()->parseExpression(); - - $stream->expect(Token::BLOCK_END_TYPE); - $body = $this->parser->subparse([$this, 'decideForFork']); - if ('else' == $stream->next()->getValue()) { - $stream->expect(Token::BLOCK_END_TYPE); - $else = $this->parser->subparse([$this, 'decideForEnd'], true); - } else { - $else = null; - } - $stream->expect(Token::BLOCK_END_TYPE); - - 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); - } - - 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'; - } -} + + * {% 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, 'in'); + $seq = $this->parser->getExpressionParser()->parseExpression(); + + $stream->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideForFork']); + if ('else' == $stream->next()->getValue()) { + $stream->expect(Token::BLOCK_END_TYPE); + $else = $this->parser->subparse([$this, 'decideForEnd'], true); + } else { + $else = null; + } + $stream->expect(Token::BLOCK_END_TYPE); + + 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); + } + + 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 index 2ccff5f..8f1863f 100644 --- a/vendor/twig/twig/src/TokenParser/FromTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/FromTokenParser.php @@ -1,66 +1,66 @@ -parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Token::NAME_TYPE, 'import'); - - $targets = []; - while (true) { - $name = $stream->expect(Token::NAME_TYPE)->getValue(); - - $alias = $name; - if ($stream->nextIf('as')) { - $alias = $stream->expect(Token::NAME_TYPE)->getValue(); - } - - $targets[$name] = $alias; - - if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { - break; - } - } - - $stream->expect(Token::BLOCK_END_TYPE); - - $var = new AssignNameExpression($this->parser->getVarName(), $token->getLine()); - $node = new ImportNode($macro, $var, $token->getLine(), $this->parser->isMainScope()); - - foreach ($targets as $name => $alias) { - $this->parser->addImportedSymbol('function', $alias, 'macro_'.$name, $var); - } - - return $node; - } - - public function getTag(): string - { - return 'from'; - } -} +parser->getExpressionParser()->parseExpression(); + $stream = $this->parser->getStream(); + $stream->expect(Token::NAME_TYPE, 'import'); + + $targets = []; + while (true) { + $name = $stream->expect(Token::NAME_TYPE)->getValue(); + + $alias = $name; + if ($stream->nextIf('as')) { + $alias = $stream->expect(Token::NAME_TYPE)->getValue(); + } + + $targets[$name] = $alias; + + if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } + + $stream->expect(Token::BLOCK_END_TYPE); + + $var = new AssignNameExpression($this->parser->getVarName(), $token->getLine()); + $node = new ImportNode($macro, $var, $token->getLine(), $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 index 4ea6f3d..46340b1 100644 --- a/vendor/twig/twig/src/TokenParser/IfTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/IfTokenParser.php @@ -1,89 +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); - $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); - $else = $this->parser->subparse([$this, 'decideIfEnd']); - break; - - case 'elseif': - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Token::BLOCK_END_TYPE); - $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); - - return new IfNode(new Node($tests), $else, $lineno); - } - - 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'; - } -} + + * {% 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); + $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); + $else = $this->parser->subparse([$this, 'decideIfEnd']); + break; + + case 'elseif': + $expr = $this->parser->getExpressionParser()->parseExpression(); + $stream->expect(Token::BLOCK_END_TYPE); + $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); + + return new IfNode(new Node($tests), $else, $lineno); + } + + 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 index f20f35a..88bc7e0 100644 --- a/vendor/twig/twig/src/TokenParser/ImportTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/ImportTokenParser.php @@ -1,44 +1,44 @@ -parser->getExpressionParser()->parseExpression(); - $this->parser->getStream()->expect(Token::NAME_TYPE, 'as'); - $var = new AssignNameExpression($this->parser->getStream()->expect(Token::NAME_TYPE)->getValue(), $token->getLine()); - $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); - - $this->parser->addImportedSymbol('template', $var->getAttribute('name')); - - return new ImportNode($macro, $var, $token->getLine(), $this->parser->isMainScope()); - } - - public function getTag(): string - { - return 'import'; - } -} +parser->getExpressionParser()->parseExpression(); + $this->parser->getStream()->expect(Token::NAME_TYPE, 'as'); + $var = new AssignNameExpression($this->parser->getStream()->expect(Token::NAME_TYPE)->getValue(), $token->getLine()); + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + $this->parser->addImportedSymbol('template', $var->getAttribute('name')); + + return new ImportNode($macro, $var, $token->getLine(), $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 index 466f228..7a97359 100644 --- a/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php @@ -1,69 +1,69 @@ -parser->getExpressionParser()->parseExpression(); - - [$variables, $only, $ignoreMissing] = $this->parseArguments(); - - return new IncludeNode($expr, $variables, $only, $ignoreMissing, $token->getLine()); - } - - protected function parseArguments() - { - $stream = $this->parser->getStream(); - - $ignoreMissing = false; - if ($stream->nextIf(Token::NAME_TYPE, 'ignore')) { - $stream->expect(Token::NAME_TYPE, 'missing'); - - $ignoreMissing = true; - } - - $variables = null; - if ($stream->nextIf(Token::NAME_TYPE, 'with')) { - $variables = $this->parser->getExpressionParser()->parseExpression(); - } - - $only = false; - if ($stream->nextIf(Token::NAME_TYPE, 'only')) { - $only = true; - } - - $stream->expect(Token::BLOCK_END_TYPE); - - return [$variables, $only, $ignoreMissing]; - } - - public function getTag(): string - { - return 'include'; - } -} +parser->getExpressionParser()->parseExpression(); + + [$variables, $only, $ignoreMissing] = $this->parseArguments(); + + return new IncludeNode($expr, $variables, $only, $ignoreMissing, $token->getLine()); + } + + protected function parseArguments() + { + $stream = $this->parser->getStream(); + + $ignoreMissing = false; + if ($stream->nextIf(Token::NAME_TYPE, 'ignore')) { + $stream->expect(Token::NAME_TYPE, 'missing'); + + $ignoreMissing = true; + } + + $variables = null; + if ($stream->nextIf(Token::NAME_TYPE, 'with')) { + $variables = $this->parser->getExpressionParser()->parseExpression(); + } + + $only = false; + if ($stream->nextIf(Token::NAME_TYPE, 'only')) { + $only = true; + } + + $stream->expect(Token::BLOCK_END_TYPE); + + 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 index c776207..5c6847d 100644 --- a/vendor/twig/twig/src/TokenParser/MacroTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/MacroTokenParser.php @@ -1,66 +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)->getValue(); - - $arguments = $this->parser->getExpressionParser()->parseArguments(true, true); - - $stream->expect(Token::BLOCK_END_TYPE); - $this->parser->pushLocalScope(); - $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); - if ($token = $stream->nextIf(Token::NAME_TYPE)) { - $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); - - $this->parser->setMacro($name, new MacroNode($name, new BodyNode([$body]), $arguments, $lineno)); - - return new Node([], [], $lineno); - } - - public function decideBlockEnd(Token $token): bool - { - return $token->test('endmacro'); - } - - public function getTag(): string - { - return 'macro'; - } -} + + * {% 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)->getValue(); + + $arguments = $this->parser->getExpressionParser()->parseArguments(true, true); + + $stream->expect(Token::BLOCK_END_TYPE); + $this->parser->pushLocalScope(); + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + if ($token = $stream->nextIf(Token::NAME_TYPE)) { + $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); + + $this->parser->setMacro($name, new MacroNode($name, new BodyNode([$body]), $arguments, $lineno)); + + return new Node([], [], $lineno); + } + + 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 index 70869fb..2ae8b37 100644 --- a/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php @@ -1,66 +1,66 @@ -parser->getStream(); - $stream->expect(Token::BLOCK_END_TYPE); - $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); - $stream->expect(Token::BLOCK_END_TYPE); - - // 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()); - } - - public function decideBlockEnd(Token $token): bool - { - return $token->test('endsandbox'); - } - - public function getTag(): string - { - return 'sandbox'; - } -} +parser->getStream(); + $stream->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(Token::BLOCK_END_TYPE); + + // 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()); + } + + 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 index bb43907..8c72c9d 100644 --- a/vendor/twig/twig/src/TokenParser/SetTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/SetTokenParser.php @@ -1,73 +1,73 @@ -getLine(); - $stream = $this->parser->getStream(); - $names = $this->parser->getExpressionParser()->parseAssignmentExpression(); - - $capture = false; - if ($stream->nextIf(Token::OPERATOR_TYPE, '=')) { - $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); - - $stream->expect(Token::BLOCK_END_TYPE); - - 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); - - $values = $this->parser->subparse([$this, 'decideBlockEnd'], true); - $stream->expect(Token::BLOCK_END_TYPE); - } - - return new SetNode($capture, $names, $values, $lineno); - } - - public function decideBlockEnd(Token $token): bool - { - return $token->test('endset'); - } - - public function getTag(): string - { - return 'set'; - } -} +getLine(); + $stream = $this->parser->getStream(); + $names = $this->parser->getExpressionParser()->parseAssignmentExpression(); + + $capture = false; + if ($stream->nextIf(Token::OPERATOR_TYPE, '=')) { + $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); + + $stream->expect(Token::BLOCK_END_TYPE); + + 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); + + $values = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(Token::BLOCK_END_TYPE); + } + + return new SetNode($capture, $names, $values, $lineno); + } + + 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 index bb8db3e..945319c 100644 --- a/vendor/twig/twig/src/TokenParser/TokenParserInterface.php +++ b/vendor/twig/twig/src/TokenParser/TokenParserInterface.php @@ -1,46 +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(); -} + + */ +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/TypesTokenParser.php b/vendor/twig/twig/src/TokenParser/TypesTokenParser.php index 2e0850e..2c45109 100644 --- a/vendor/twig/twig/src/TokenParser/TypesTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/TypesTokenParser.php @@ -1,86 +1,86 @@ - - * - * @internal - */ -final class TypesTokenParser extends AbstractTokenParser -{ - public function parse(Token $token): Node - { - $stream = $this->parser->getStream(); - - $types = $this->parseSimpleMappingExpression($stream); - - $stream->expect(Token::BLOCK_END_TYPE); - - return new TypesNode($types, $token->getLine()); - } - - /** - * @return array - * - * @throws SyntaxError - */ - private function parseSimpleMappingExpression(TokenStream $stream): array - { - $stream->expect(Token::PUNCTUATION_TYPE, '{', 'A mapping element was expected'); - - $types = []; - - $first = true; - while (!$stream->test(Token::PUNCTUATION_TYPE, '}')) { - if (!$first) { - $stream->expect(Token::PUNCTUATION_TYPE, ',', 'A type string must be followed by a comma'); - - // trailing ,? - if ($stream->test(Token::PUNCTUATION_TYPE, '}')) { - break; - } - } - $first = false; - - $nameToken = $stream->expect(Token::NAME_TYPE); - $isOptional = null !== $stream->nextIf(Token::PUNCTUATION_TYPE, '?'); - - $stream->expect(Token::PUNCTUATION_TYPE, ':', 'A type name must be followed by a colon (:)'); - - $valueToken = $stream->expect(Token::STRING_TYPE); - - $types[$nameToken->getValue()] = [ - 'type' => $valueToken->getValue(), - 'optional' => $isOptional, - ]; - } - $stream->expect(Token::PUNCTUATION_TYPE, '}', 'An opened mapping is not properly closed'); - - return $types; - } - - public function getTag(): string - { - return 'types'; - } -} + + * + * @internal + */ +final class TypesTokenParser extends AbstractTokenParser +{ + public function parse(Token $token): Node + { + $stream = $this->parser->getStream(); + + $types = $this->parseSimpleMappingExpression($stream); + + $stream->expect(Token::BLOCK_END_TYPE); + + return new TypesNode($types, $token->getLine()); + } + + /** + * @return array + * + * @throws SyntaxError + */ + private function parseSimpleMappingExpression(TokenStream $stream): array + { + $stream->expect(Token::PUNCTUATION_TYPE, '{', 'A mapping element was expected'); + + $types = []; + + $first = true; + while (!$stream->test(Token::PUNCTUATION_TYPE, '}')) { + if (!$first) { + $stream->expect(Token::PUNCTUATION_TYPE, ',', 'A type string must be followed by a comma'); + + // trailing ,? + if ($stream->test(Token::PUNCTUATION_TYPE, '}')) { + break; + } + } + $first = false; + + $nameToken = $stream->expect(Token::NAME_TYPE); + $isOptional = null !== $stream->nextIf(Token::PUNCTUATION_TYPE, '?'); + + $stream->expect(Token::PUNCTUATION_TYPE, ':', 'A type name must be followed by a colon (:)'); + + $valueToken = $stream->expect(Token::STRING_TYPE); + + $types[$nameToken->getValue()] = [ + 'type' => $valueToken->getValue(), + 'optional' => $isOptional, + ]; + } + $stream->expect(Token::PUNCTUATION_TYPE, '}', 'An opened mapping is not properly closed'); + + return $types; + } + + public function getTag(): string + { + return 'types'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/UseTokenParser.php b/vendor/twig/twig/src/TokenParser/UseTokenParser.php index 1b96b40..59d1da8 100644 --- a/vendor/twig/twig/src/TokenParser/UseTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/UseTokenParser.php @@ -1,73 +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')) { - while (true) { - $name = $stream->expect(Token::NAME_TYPE)->getValue(); - - $alias = $name; - if ($stream->nextIf('as')) { - $alias = $stream->expect(Token::NAME_TYPE)->getValue(); - } - - $targets[$name] = new ConstantExpression($alias, -1); - - if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { - break; - } - } - } - - $stream->expect(Token::BLOCK_END_TYPE); - - $this->parser->addTrait(new Node(['template' => $template, 'targets' => new Node($targets)])); - - return new Node([], [], $token->getLine()); - } - - public function getTag(): string - { - return 'use'; - } -} +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')) { + while (true) { + $name = $stream->expect(Token::NAME_TYPE)->getValue(); + + $alias = $name; + if ($stream->nextIf('as')) { + $alias = $stream->expect(Token::NAME_TYPE)->getValue(); + } + + $targets[$name] = new ConstantExpression($alias, -1); + + if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) { + break; + } + } + } + + $stream->expect(Token::BLOCK_END_TYPE); + + $this->parser->addTrait(new Node(['template' => $template, 'targets' => new Node($targets)])); + + return new Node([], [], $token->getLine()); + } + + public function getTag(): string + { + return 'use'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/WithTokenParser.php b/vendor/twig/twig/src/TokenParser/WithTokenParser.php index 8ce4f02..ba958d1 100644 --- a/vendor/twig/twig/src/TokenParser/WithTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/WithTokenParser.php @@ -1,56 +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)) { - $variables = $this->parser->getExpressionParser()->parseExpression(); - $only = (bool) $stream->nextIf(Token::NAME_TYPE, 'only'); - } - - $stream->expect(Token::BLOCK_END_TYPE); - - $body = $this->parser->subparse([$this, 'decideWithEnd'], true); - - $stream->expect(Token::BLOCK_END_TYPE); - - return new WithNode($body, $variables, $only, $token->getLine()); - } - - public function decideWithEnd(Token $token): bool - { - return $token->test('endwith'); - } - - public function getTag(): string - { - return 'with'; - } -} + + * + * @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)) { + $variables = $this->parser->getExpressionParser()->parseExpression(); + $only = (bool) $stream->nextIf(Token::NAME_TYPE, 'only'); + } + + $stream->expect(Token::BLOCK_END_TYPE); + + $body = $this->parser->subparse([$this, 'decideWithEnd'], true); + + $stream->expect(Token::BLOCK_END_TYPE); + + return new WithNode($body, $variables, $only, $token->getLine()); + } + + 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 index c91701b..a843720 100644 --- a/vendor/twig/twig/src/TokenStream.php +++ b/vendor/twig/twig/src/TokenStream.php @@ -1,129 +1,129 @@ - - */ -final class TokenStream -{ - private $current = 0; - - public function __construct( - private array $tokens, - private ?Source $source = null, - ) { - $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) - { - return $this->tokens[$this->current]->test($primary, $secondary) ? $this->next() : null; - } - - /** - * 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 === $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; - } -} + + */ +final class TokenStream +{ + private $current = 0; + + public function __construct( + private array $tokens, + private ?Source $source = null, + ) { + $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) + { + return $this->tokens[$this->current]->test($primary, $secondary) ? $this->next() : null; + } + + /** + * 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 === $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/TwigCallableInterface.php b/vendor/twig/twig/src/TwigCallableInterface.php index 2a8ff61..a30c32d 100644 --- a/vendor/twig/twig/src/TwigCallableInterface.php +++ b/vendor/twig/twig/src/TwigCallableInterface.php @@ -1,53 +1,53 @@ - - */ -interface TwigCallableInterface extends \Stringable -{ - public function getName(): string; - - public function getType(): string; - - public function getDynamicName(): string; - - /** - * @return callable|array{class-string, string}|null - */ - public function getCallable(); - - public function getNodeClass(): string; - - public function needsCharset(): bool; - - public function needsEnvironment(): bool; - - public function needsContext(): bool; - - public function withDynamicArguments(string $name, string $dynamicName, array $arguments): self; - - public function getArguments(): array; - - public function isVariadic(): bool; - - public function isDeprecated(): bool; - - public function getDeprecatingPackage(): string; - - public function getDeprecatedVersion(): string; - - public function getAlternative(): ?string; - - public function getMinimalNumberOfRequiredArguments(): int; -} + + */ +interface TwigCallableInterface extends \Stringable +{ + public function getName(): string; + + public function getType(): string; + + public function getDynamicName(): string; + + /** + * @return callable|array{class-string, string}|null + */ + public function getCallable(); + + public function getNodeClass(): string; + + public function needsCharset(): bool; + + public function needsEnvironment(): bool; + + public function needsContext(): bool; + + public function withDynamicArguments(string $name, string $dynamicName, array $arguments): self; + + public function getArguments(): array; + + public function isVariadic(): bool; + + public function isDeprecated(): bool; + + public function getDeprecatingPackage(): string; + + public function getDeprecatedVersion(): string; + + public function getAlternative(): ?string; + + public function getMinimalNumberOfRequiredArguments(): int; +} diff --git a/vendor/twig/twig/src/TwigFilter.php b/vendor/twig/twig/src/TwigFilter.php index 70b1f8f..4e8571c 100644 --- a/vendor/twig/twig/src/TwigFilter.php +++ b/vendor/twig/twig/src/TwigFilter.php @@ -1,74 +1,74 @@ - - * - * @see https://twig.symfony.com/doc/templates.html#filters - */ -final class TwigFilter extends AbstractTwigCallable -{ - /** - * @param callable|array{class-string, string}|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 = []) - { - parent::__construct($name, $callable, $options); - - $this->options = array_merge([ - 'is_safe' => null, - 'is_safe_callback' => null, - 'pre_escape' => null, - 'preserves_safety' => null, - 'node_class' => FilterExpression::class, - ], $this->options); - } - - public function getType(): string - { - return 'filter'; - } - - 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 getMinimalNumberOfRequiredArguments(): int - { - return parent::getMinimalNumberOfRequiredArguments() + 1; - } -} + + * + * @see https://twig.symfony.com/doc/templates.html#filters + */ +final class TwigFilter extends AbstractTwigCallable +{ + /** + * @param callable|array{class-string, string}|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 = []) + { + parent::__construct($name, $callable, $options); + + $this->options = array_merge([ + 'is_safe' => null, + 'is_safe_callback' => null, + 'pre_escape' => null, + 'preserves_safety' => null, + 'node_class' => FilterExpression::class, + ], $this->options); + } + + public function getType(): string + { + return 'filter'; + } + + 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 getMinimalNumberOfRequiredArguments(): int + { + return parent::getMinimalNumberOfRequiredArguments() + 1; + } +} diff --git a/vendor/twig/twig/src/TwigFunction.php b/vendor/twig/twig/src/TwigFunction.php index 4a10df9..45cdbe7 100644 --- a/vendor/twig/twig/src/TwigFunction.php +++ b/vendor/twig/twig/src/TwigFunction.php @@ -1,63 +1,63 @@ - - * - * @see https://twig.symfony.com/doc/templates.html#functions - */ -final class TwigFunction extends AbstractTwigCallable -{ - /** - * @param callable|array{class-string, string}|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 = []) - { - parent::__construct($name, $callable, $options); - - $this->options = array_merge([ - 'is_safe' => null, - 'is_safe_callback' => null, - 'node_class' => FunctionExpression::class, - 'parser_callable' => null, - ], $this->options); - } - - public function getType(): string - { - return 'function'; - } - - public function getParserCallable(): ?callable - { - return $this->options['parser_callable']; - } - - 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 []; - } -} + + * + * @see https://twig.symfony.com/doc/templates.html#functions + */ +final class TwigFunction extends AbstractTwigCallable +{ + /** + * @param callable|array{class-string, string}|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 = []) + { + parent::__construct($name, $callable, $options); + + $this->options = array_merge([ + 'is_safe' => null, + 'is_safe_callback' => null, + 'node_class' => FunctionExpression::class, + 'parser_callable' => null, + ], $this->options); + } + + public function getType(): string + { + return 'function'; + } + + public function getParserCallable(): ?callable + { + return $this->options['parser_callable']; + } + + 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 []; + } +} diff --git a/vendor/twig/twig/src/TwigTest.php b/vendor/twig/twig/src/TwigTest.php index 5e58ad8..cef0f86 100644 --- a/vendor/twig/twig/src/TwigTest.php +++ b/vendor/twig/twig/src/TwigTest.php @@ -1,67 +1,67 @@ - - * - * @see https://twig.symfony.com/doc/templates.html#test-operator - */ -final class TwigTest extends AbstractTwigCallable -{ - /** - * @param callable|array{class-string, string}|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 = []) - { - parent::__construct($name, $callable, $options); - - $this->options = array_merge([ - 'node_class' => TestExpression::class, - 'one_mandatory_argument' => false, - ], $this->options); - } - - public function getType(): string - { - return 'test'; - } - - public function needsCharset(): bool - { - return false; - } - - public function needsEnvironment(): bool - { - return false; - } - - public function needsContext(): bool - { - return false; - } - - public function hasOneMandatoryArgument(): bool - { - return (bool) $this->options['one_mandatory_argument']; - } - - public function getMinimalNumberOfRequiredArguments(): int - { - return parent::getMinimalNumberOfRequiredArguments() + 1; - } -} + + * + * @see https://twig.symfony.com/doc/templates.html#test-operator + */ +final class TwigTest extends AbstractTwigCallable +{ + /** + * @param callable|array{class-string, string}|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 = []) + { + parent::__construct($name, $callable, $options); + + $this->options = array_merge([ + 'node_class' => TestExpression::class, + 'one_mandatory_argument' => false, + ], $this->options); + } + + public function getType(): string + { + return 'test'; + } + + public function needsCharset(): bool + { + return false; + } + + public function needsEnvironment(): bool + { + return false; + } + + public function needsContext(): bool + { + return false; + } + + public function hasOneMandatoryArgument(): bool + { + return (bool) $this->options['one_mandatory_argument']; + } + + public function getMinimalNumberOfRequiredArguments(): int + { + return parent::getMinimalNumberOfRequiredArguments() + 1; + } +} diff --git a/vendor/twig/twig/src/Util/CallableArgumentsExtractor.php b/vendor/twig/twig/src/Util/CallableArgumentsExtractor.php index 8811ca9..17d045f 100644 --- a/vendor/twig/twig/src/Util/CallableArgumentsExtractor.php +++ b/vendor/twig/twig/src/Util/CallableArgumentsExtractor.php @@ -1,204 +1,204 @@ - - * - * @internal - */ -final class CallableArgumentsExtractor -{ - private ReflectionCallable $rc; - - public function __construct( - private Node $node, - private TwigCallableInterface $twigCallable, - ) { - $this->rc = new ReflectionCallable($twigCallable); - } - - /** - * @return array - */ - public function extractArguments(Node $arguments): array - { - $extractedArguments = []; - $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".', $this->twigCallable->getType(), $this->twigCallable->getName()), $this->node->getTemplateLine(), $this->node->getSourceContext()); - } - - $extractedArguments[$name] = $node; - } - - if (!$named && !$this->twigCallable->isVariadic()) { - $min = $this->twigCallable->getMinimalNumberOfRequiredArguments(); - if (\count($extractedArguments) < $this->rc->getReflector()->getNumberOfRequiredParameters() - $min) { - throw new SyntaxError(\sprintf('Value for argument "%s" is required for %s "%s".', $this->rc->getReflector()->getParameters()[$min + \count($extractedArguments)]->getName(), $this->twigCallable->getType(), $this->twigCallable->getName()), $this->node->getTemplateLine(), $this->node->getSourceContext()); - } - - return $extractedArguments; - } - - if (!$callable = $this->twigCallable->getCallable()) { - if ($named) { - throw new SyntaxError(\sprintf('Named arguments are not supported for %s "%s".', $this->twigCallable->getType(), $this->twigCallable->getName())); - } - - throw new SyntaxError(\sprintf('Arbitrary positional arguments are not supported for %s "%s".', $this->twigCallable->getType(), $this->twigCallable->getName())); - } - - [$callableParameters, $isPhpVariadic] = $this->getCallableParameters(); - $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, $extractedArguments)) { - if (\array_key_exists($pos, $extractedArguments)) { - throw new SyntaxError(\sprintf('Argument "%s" is defined twice for %s "%s".', $name, $this->twigCallable->getType(), $this->twigCallable->getName()), $this->node->getTemplateLine(), $this->node->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, $this->twigCallable->getType(), $this->twigCallable->getName(), implode(', ', $names), \count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments) - ), $this->node->getTemplateLine(), $this->node->getSourceContext()); - } - - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $extractedArguments[$name]; - unset($extractedArguments[$name]); - $optionalArguments = []; - } elseif (\array_key_exists($pos, $extractedArguments)) { - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $extractedArguments[$pos]; - unset($extractedArguments[$pos]); - $optionalArguments = []; - ++$pos; - } elseif ($callableParameter->isDefaultValueAvailable()) { - $optionalArguments[] = new ConstantExpression($callableParameter->getDefaultValue(), $this->node->getTemplateLine()); - } elseif ($callableParameter->isOptional()) { - if (!$extractedArguments) { - break; - } - - $missingArguments[] = $name; - } else { - throw new SyntaxError(\sprintf('Value for argument "%s" is required for %s "%s".', $name, $this->twigCallable->getType(), $this->twigCallable->getName()), $this->node->getTemplateLine(), $this->node->getSourceContext()); - } - } - - if ($this->twigCallable->isVariadic()) { - $arbitraryArguments = $isPhpVariadic ? new VariadicExpression([], $this->node->getTemplateLine()) : new ArrayExpression([], $this->node->getTemplateLine()); - foreach ($extractedArguments as $key => $value) { - if (\is_int($key)) { - $arbitraryArguments->addElement($value); - } else { - $arbitraryArguments->addElement($value, new ConstantExpression($key, $this->node->getTemplateLine())); - } - unset($extractedArguments[$key]); - } - - if ($arbitraryArguments->count()) { - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $arbitraryArguments; - } - } - - if ($extractedArguments) { - $unknownArgument = null; - foreach ($extractedArguments as $extractedArgument) { - if ($extractedArgument instanceof Node) { - $unknownArgument = $extractedArgument; - break; - } - } - - throw new SyntaxError( - \sprintf( - 'Unknown argument%s "%s" for %s "%s(%s)".', - \count($extractedArguments) > 1 ? 's' : '', implode('", "', array_keys($extractedArguments)), $this->twigCallable->getType(), $this->twigCallable->getName(), implode(', ', $names) - ), - $unknownArgument ? $unknownArgument->getTemplateLine() : $this->node->getTemplateLine(), - $unknownArgument ? $unknownArgument->getSourceContext() : $this->node->getSourceContext() - ); - } - - return $arguments; - } - - private 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(): array - { - $parameters = $this->rc->getReflector()->getParameters(); - if ($this->node->hasNode('node')) { - array_shift($parameters); - } - if ($this->twigCallable->needsCharset()) { - array_shift($parameters); - } - if ($this->twigCallable->needsEnvironment()) { - array_shift($parameters); - } - if ($this->twigCallable->needsContext()) { - array_shift($parameters); - } - foreach ($this->twigCallable->getArguments() as $argument) { - array_shift($parameters); - } - - $isPhpVariadic = false; - if ($this->twigCallable->isVariadic()) { - $argument = end($parameters); - $isArray = $argument && $argument->hasType() && $argument->getType() instanceof \ReflectionNamedType && 'array' === $argument->getType()->getName(); - if ($isArray && $argument->isDefaultValueAvailable() && [] === $argument->getDefaultValue()) { - array_pop($parameters); - } elseif ($argument && $argument->isVariadic()) { - array_pop($parameters); - $isPhpVariadic = true; - } else { - throw new SyntaxError(\sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = []".', $this->rc->getName(), $this->twigCallable->getType(), $this->twigCallable->getName())); - } - } - - return [$parameters, $isPhpVariadic]; - } -} + + * + * @internal + */ +final class CallableArgumentsExtractor +{ + private ReflectionCallable $rc; + + public function __construct( + private Node $node, + private TwigCallableInterface $twigCallable, + ) { + $this->rc = new ReflectionCallable($twigCallable); + } + + /** + * @return array + */ + public function extractArguments(Node $arguments): array + { + $extractedArguments = []; + $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".', $this->twigCallable->getType(), $this->twigCallable->getName()), $this->node->getTemplateLine(), $this->node->getSourceContext()); + } + + $extractedArguments[$name] = $node; + } + + if (!$named && !$this->twigCallable->isVariadic()) { + $min = $this->twigCallable->getMinimalNumberOfRequiredArguments(); + if (\count($extractedArguments) < $this->rc->getReflector()->getNumberOfRequiredParameters() - $min) { + throw new SyntaxError(\sprintf('Value for argument "%s" is required for %s "%s".', $this->rc->getReflector()->getParameters()[$min + \count($extractedArguments)]->getName(), $this->twigCallable->getType(), $this->twigCallable->getName()), $this->node->getTemplateLine(), $this->node->getSourceContext()); + } + + return $extractedArguments; + } + + if (!$callable = $this->twigCallable->getCallable()) { + if ($named) { + throw new SyntaxError(\sprintf('Named arguments are not supported for %s "%s".', $this->twigCallable->getType(), $this->twigCallable->getName())); + } + + throw new SyntaxError(\sprintf('Arbitrary positional arguments are not supported for %s "%s".', $this->twigCallable->getType(), $this->twigCallable->getName())); + } + + [$callableParameters, $isPhpVariadic] = $this->getCallableParameters(); + $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, $extractedArguments)) { + if (\array_key_exists($pos, $extractedArguments)) { + throw new SyntaxError(\sprintf('Argument "%s" is defined twice for %s "%s".', $name, $this->twigCallable->getType(), $this->twigCallable->getName()), $this->node->getTemplateLine(), $this->node->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, $this->twigCallable->getType(), $this->twigCallable->getName(), implode(', ', $names), \count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments) + ), $this->node->getTemplateLine(), $this->node->getSourceContext()); + } + + $arguments = array_merge($arguments, $optionalArguments); + $arguments[] = $extractedArguments[$name]; + unset($extractedArguments[$name]); + $optionalArguments = []; + } elseif (\array_key_exists($pos, $extractedArguments)) { + $arguments = array_merge($arguments, $optionalArguments); + $arguments[] = $extractedArguments[$pos]; + unset($extractedArguments[$pos]); + $optionalArguments = []; + ++$pos; + } elseif ($callableParameter->isDefaultValueAvailable()) { + $optionalArguments[] = new ConstantExpression($callableParameter->getDefaultValue(), $this->node->getTemplateLine()); + } elseif ($callableParameter->isOptional()) { + if (!$extractedArguments) { + break; + } + + $missingArguments[] = $name; + } else { + throw new SyntaxError(\sprintf('Value for argument "%s" is required for %s "%s".', $name, $this->twigCallable->getType(), $this->twigCallable->getName()), $this->node->getTemplateLine(), $this->node->getSourceContext()); + } + } + + if ($this->twigCallable->isVariadic()) { + $arbitraryArguments = $isPhpVariadic ? new VariadicExpression([], $this->node->getTemplateLine()) : new ArrayExpression([], $this->node->getTemplateLine()); + foreach ($extractedArguments as $key => $value) { + if (\is_int($key)) { + $arbitraryArguments->addElement($value); + } else { + $arbitraryArguments->addElement($value, new ConstantExpression($key, $this->node->getTemplateLine())); + } + unset($extractedArguments[$key]); + } + + if ($arbitraryArguments->count()) { + $arguments = array_merge($arguments, $optionalArguments); + $arguments[] = $arbitraryArguments; + } + } + + if ($extractedArguments) { + $unknownArgument = null; + foreach ($extractedArguments as $extractedArgument) { + if ($extractedArgument instanceof Node) { + $unknownArgument = $extractedArgument; + break; + } + } + + throw new SyntaxError( + \sprintf( + 'Unknown argument%s "%s" for %s "%s(%s)".', + \count($extractedArguments) > 1 ? 's' : '', implode('", "', array_keys($extractedArguments)), $this->twigCallable->getType(), $this->twigCallable->getName(), implode(', ', $names) + ), + $unknownArgument ? $unknownArgument->getTemplateLine() : $this->node->getTemplateLine(), + $unknownArgument ? $unknownArgument->getSourceContext() : $this->node->getSourceContext() + ); + } + + return $arguments; + } + + private 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(): array + { + $parameters = $this->rc->getReflector()->getParameters(); + if ($this->node->hasNode('node')) { + array_shift($parameters); + } + if ($this->twigCallable->needsCharset()) { + array_shift($parameters); + } + if ($this->twigCallable->needsEnvironment()) { + array_shift($parameters); + } + if ($this->twigCallable->needsContext()) { + array_shift($parameters); + } + foreach ($this->twigCallable->getArguments() as $argument) { + array_shift($parameters); + } + + $isPhpVariadic = false; + if ($this->twigCallable->isVariadic()) { + $argument = end($parameters); + $isArray = $argument && $argument->hasType() && $argument->getType() instanceof \ReflectionNamedType && 'array' === $argument->getType()->getName(); + if ($isArray && $argument->isDefaultValueAvailable() && [] === $argument->getDefaultValue()) { + array_pop($parameters); + } elseif ($argument && $argument->isVariadic()) { + array_pop($parameters); + $isPhpVariadic = true; + } else { + throw new SyntaxError(\sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = []".', $this->rc->getName(), $this->twigCallable->getType(), $this->twigCallable->getName())); + } + } + + return [$parameters, $isPhpVariadic]; + } +} diff --git a/vendor/twig/twig/src/Util/DeprecationCollector.php b/vendor/twig/twig/src/Util/DeprecationCollector.php index 0ea26ed..d9e6d13 100644 --- a/vendor/twig/twig/src/Util/DeprecationCollector.php +++ b/vendor/twig/twig/src/Util/DeprecationCollector.php @@ -1,77 +1,77 @@ - - */ -final class DeprecationCollector -{ - public function __construct( - private Environment $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; - } - - return false; - }); - - 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; - } -} + + */ +final class DeprecationCollector +{ + public function __construct( + private Environment $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; + } + + return false; + }); + + 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/ReflectionCallable.php b/vendor/twig/twig/src/Util/ReflectionCallable.php index 16734d9..dafce12 100644 --- a/vendor/twig/twig/src/Util/ReflectionCallable.php +++ b/vendor/twig/twig/src/Util/ReflectionCallable.php @@ -1,92 +1,92 @@ - - * - * @internal - */ -final class ReflectionCallable -{ - private $reflector; - private $callable; - private $name; - - public function __construct( - TwigCallableInterface $twigCallable, - ) { - $callable = $twigCallable->getCallable(); - if (\is_string($callable) && false !== $pos = strpos($callable, '::')) { - $callable = [substr($callable, 0, $pos), substr($callable, 2 + $pos)]; - } - - if (\is_array($callable) && method_exists($callable[0], $callable[1])) { - $this->reflector = $r = new \ReflectionMethod($callable[0], $callable[1]); - $this->callable = $callable; - $this->name = $r->class.'::'.$r->name; - - return; - } - - $checkVisibility = $callable instanceof \Closure; - try { - $closure = \Closure::fromCallable($callable); - } catch (\TypeError $e) { - throw new \LogicException(\sprintf('Callback for %s "%s" is not callable in the current scope.', $twigCallable->getType(), $twigCallable->getName()), 0, $e); - } - $this->reflector = $r = new \ReflectionFunction($closure); - - if (str_contains($r->name, '{closure')) { - $this->callable = $callable; - $this->name = 'Closure'; - - return; - } - - if ($object = $r->getClosureThis()) { - $callable = [$object, $r->name]; - $this->name = get_debug_type($object).'::'.$r->name; - } elseif (\PHP_VERSION_ID >= 80111 && $class = $r->getClosureCalledClass()) { - $callable = [$class->name, $r->name]; - $this->name = $class->name.'::'.$r->name; - } elseif (\PHP_VERSION_ID < 80111 && $class = $r->getClosureScopeClass()) { - $callable = [\is_array($callable) ? $callable[0] : $class->name, $r->name]; - $this->name = (\is_array($callable) ? $callable[0] : $class->name).'::'.$r->name; - } else { - $callable = $this->name = $r->name; - } - - if ($checkVisibility && \is_array($callable) && method_exists(...$callable) && !(new \ReflectionMethod(...$callable))->isPublic()) { - $callable = $r->getClosure(); - } - - $this->callable = $callable; - } - - public function getReflector(): \ReflectionFunctionAbstract - { - return $this->reflector; - } - - public function getCallable() - { - return $this->callable; - } - - public function getName(): string - { - return $this->name; - } -} + + * + * @internal + */ +final class ReflectionCallable +{ + private $reflector; + private $callable; + private $name; + + public function __construct( + TwigCallableInterface $twigCallable, + ) { + $callable = $twigCallable->getCallable(); + if (\is_string($callable) && false !== $pos = strpos($callable, '::')) { + $callable = [substr($callable, 0, $pos), substr($callable, 2 + $pos)]; + } + + if (\is_array($callable) && method_exists($callable[0], $callable[1])) { + $this->reflector = $r = new \ReflectionMethod($callable[0], $callable[1]); + $this->callable = $callable; + $this->name = $r->class.'::'.$r->name; + + return; + } + + $checkVisibility = $callable instanceof \Closure; + try { + $closure = \Closure::fromCallable($callable); + } catch (\TypeError $e) { + throw new \LogicException(\sprintf('Callback for %s "%s" is not callable in the current scope.', $twigCallable->getType(), $twigCallable->getName()), 0, $e); + } + $this->reflector = $r = new \ReflectionFunction($closure); + + if (str_contains($r->name, '{closure')) { + $this->callable = $callable; + $this->name = 'Closure'; + + return; + } + + if ($object = $r->getClosureThis()) { + $callable = [$object, $r->name]; + $this->name = get_debug_type($object).'::'.$r->name; + } elseif (\PHP_VERSION_ID >= 80111 && $class = $r->getClosureCalledClass()) { + $callable = [$class->name, $r->name]; + $this->name = $class->name.'::'.$r->name; + } elseif (\PHP_VERSION_ID < 80111 && $class = $r->getClosureScopeClass()) { + $callable = [\is_array($callable) ? $callable[0] : $class->name, $r->name]; + $this->name = (\is_array($callable) ? $callable[0] : $class->name).'::'.$r->name; + } else { + $callable = $this->name = $r->name; + } + + if ($checkVisibility && \is_array($callable) && method_exists(...$callable) && !(new \ReflectionMethod(...$callable))->isPublic()) { + $callable = $r->getClosure(); + } + + $this->callable = $callable; + } + + public function getReflector(): \ReflectionFunctionAbstract + { + return $this->reflector; + } + + public function getCallable() + { + return $this->callable; + } + + public function getName(): string + { + return $this->name; + } +} diff --git a/vendor/twig/twig/src/Util/TemplateDirIterator.php b/vendor/twig/twig/src/Util/TemplateDirIterator.php index 3bef14b..d389608 100644 --- a/vendor/twig/twig/src/Util/TemplateDirIterator.php +++ b/vendor/twig/twig/src/Util/TemplateDirIterator.php @@ -1,36 +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(); - } -} + + */ +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(); + } +} diff --git a/vue/CitationView.php b/vue/CitationView.php index 4b26bf2..603417e 100644 --- a/vue/CitationView.php +++ b/vue/CitationView.php @@ -1,64 +1,64 @@ -"; - - // Afficher la citation du jour - if ($citationDuJour) { - $quote = htmlspecialchars(trim(substr($citationDuJour[1], 1))); // Retirer le symbole µ - $movie = htmlspecialchars(trim($citationDuJour[2])); - $character = htmlspecialchars(trim($citationDuJour[3])); - $year = htmlspecialchars(trim($citationDuJour[4])); - $imagePath = htmlspecialchars(trim($citationDuJour[5])); - - echo "

    Citation du jour

    "; - echo "
    "; - echo "$movie"; - echo "
    "; - echo "

    \"$quote\"

    "; - echo "

    - $movie

    "; - echo "

    Personnage : $character

    "; - echo "

    Année : $year

    "; - echo "
    "; - echo "
    "; - } else { - echo "

    Aucune citation du jour n'a été trouvée.

    "; - } - - // Filtrer les suggestions pour éviter de reprendre la citation du jour - $filteredSuggestions = array_filter($suggestions, function($suggestion) use ($citationDuJour) { - // Vérifie que les deux citations ne sont pas identiques - return isset($suggestion[0]) && trim($suggestion[0]) !== trim($citationDuJour[1]); - }); - - // Afficher les suggestions - if (!empty($filteredSuggestions)) { - echo "

    Suggestions

    "; - echo "
    "; // Conteneur pour gérer les colonnes - foreach ($filteredSuggestions as $suggestion) { - // Vérifier si tous les éléments requis sont bien présents dans $suggestion - $quote = isset($suggestion[0]) ? htmlspecialchars(trim($suggestion[0])) : ''; - $movie = isset($suggestion[1]) ? htmlspecialchars(trim($suggestion[1])) : ''; - $character = isset($suggestion[2]) ? htmlspecialchars(trim($suggestion[2])) : 'Inconnu'; - $year = isset($suggestion[3]) ? htmlspecialchars(trim($suggestion[3])) : 'Inconnue'; - $imagePath = isset($suggestion[4]) ? htmlspecialchars(trim($suggestion[4])) : 'images/default.jpg'; - - echo "
    "; - echo "$movie"; - echo "
    "; - echo "

    \"$quote\"

    "; - echo "

    - $movie

    "; - echo "

    - Personnage : $character

    "; - echo "

    - Année : $year

    "; - echo "
    "; - echo "
    "; - } - echo "
    "; // Fin du conteneur suggestions - } - - echo ""; // Fin de la section des citations - echo ""; // Clôture la structure HTML - } +"; + + // Afficher la citation du jour + if ($citationDuJour) { + $quote = htmlspecialchars(trim(substr($citationDuJour[1], 1))); // Retirer le symbole µ + $movie = htmlspecialchars(trim($citationDuJour[2])); + $character = htmlspecialchars(trim($citationDuJour[3])); + $year = htmlspecialchars(trim($citationDuJour[4])); + $imagePath = htmlspecialchars(trim($citationDuJour[5])); + + echo "

    Citation du jour

    "; + echo "
    "; + echo "$movie"; + echo "
    "; + echo "

    \"$quote\"

    "; + echo "

    - $movie

    "; + echo "

    Personnage : $character

    "; + echo "

    Année : $year

    "; + echo "
    "; + echo "
    "; + } else { + echo "

    Aucune citation du jour n'a été trouvée.

    "; + } + + // Filtrer les suggestions pour éviter de reprendre la citation du jour + $filteredSuggestions = array_filter($suggestions, function($suggestion) use ($citationDuJour) { + // Vérifie que les deux citations ne sont pas identiques + return isset($suggestion[0]) && trim($suggestion[0]) !== trim($citationDuJour[1]); + }); + + // Afficher les suggestions + if (!empty($filteredSuggestions)) { + echo "

    Suggestions

    "; + echo "
    "; // Conteneur pour gérer les colonnes + foreach ($filteredSuggestions as $suggestion) { + // Vérifier si tous les éléments requis sont bien présents dans $suggestion + $quote = isset($suggestion[0]) ? htmlspecialchars(trim($suggestion[0])) : ''; + $movie = isset($suggestion[1]) ? htmlspecialchars(trim($suggestion[1])) : ''; + $character = isset($suggestion[2]) ? htmlspecialchars(trim($suggestion[2])) : 'Inconnu'; + $year = isset($suggestion[3]) ? htmlspecialchars(trim($suggestion[3])) : 'Inconnue'; + $imagePath = isset($suggestion[4]) ? htmlspecialchars(trim($suggestion[4])) : 'images/default.jpg'; + + echo "
    "; + echo "$movie"; + echo "
    "; + echo "

    \"$quote\"

    "; + echo "

    - $movie

    "; + echo "

    - Personnage : $character

    "; + echo "

    - Année : $year

    "; + echo "
    "; + echo "
    "; + } + echo "
    "; // Fin du conteneur suggestions + } + + echo ""; // Fin de la section des citations + echo ""; // Clôture la structure HTML + } } \ No newline at end of file diff --git a/vue/accueil.php b/vue/accueil.php index 5c6d764..18a6c4a 100644 --- a/vue/accueil.php +++ b/vue/accueil.php @@ -1,88 +1,88 @@ -render('head.html.twig', array( - 'title' => "Accueil", - 'style' => "public/styles/styleAccueil.css", - )); - - echo $twig->render('bandeau.html.twig'); - -?> -"; - -if ($citationDuJour) { - $quote = htmlspecialchars(trim(substr($citationDuJour[1], 1))); // Retirer le symbole µ - $movie = htmlspecialchars(trim($citationDuJour[2])); - $character = htmlspecialchars(trim($citationDuJour[3])); - $year = htmlspecialchars(trim($citationDuJour[4])); - $imagePath = htmlspecialchars(trim($citationDuJour[5])); - - echo "

    Citation du jour

    "; - echo "
    "; - echo "$movie"; - echo "
    "; - echo "

    \"$quote\"

    "; - echo "

    - $movie

    "; - echo "

    Personnage : $character

    "; - echo "

    Année : $year

    "; - echo "
    "; - echo "
    "; -} else { - echo "

    Aucune citation du jour n'a été trouvée.

    "; -} - -if (!empty($suggestions)) { - echo "

    Suggestions

    "; - echo "
    "; - foreach ($suggestions as $suggestion) { - $quote = htmlspecialchars(trim($suggestion[0])); - $movie = htmlspecialchars(trim($suggestion[1])); - $character = htmlspecialchars(trim($suggestion[2])); - $year = htmlspecialchars(trim($suggestion[3])); - $imagePath = htmlspecialchars(trim($suggestion[4])); - - echo "
    "; - echo "$movie"; - echo "
    "; - echo "

    \"$quote\"

    "; - echo "

    - $movie

    "; - echo "

    Personnage : $character

    "; - echo "

    Année : $year

    "; - echo "
    "; - echo "
    "; - } - echo "
    "; -} - -echo ""; -?> - +render('head.html.twig', array( + 'title' => "Accueil", + 'style' => "public/styles/styleAccueil.css", + )); + + echo $twig->render('bandeau.html.twig'); + +?> +"; + +if ($citationDuJour) { + $quote = htmlspecialchars(trim(substr($citationDuJour[1], 1))); // Retirer le symbole µ + $movie = htmlspecialchars(trim($citationDuJour[2])); + $character = htmlspecialchars(trim($citationDuJour[3])); + $year = htmlspecialchars(trim($citationDuJour[4])); + $imagePath = htmlspecialchars(trim($citationDuJour[5])); + + echo "

    Citation du jour

    "; + echo "
    "; + echo "$movie"; + echo "
    "; + echo "

    \"$quote\"

    "; + echo "

    - $movie

    "; + echo "

    Personnage : $character

    "; + echo "

    Année : $year

    "; + echo "
    "; + echo "
    "; +} else { + echo "

    Aucune citation du jour n'a été trouvée.

    "; +} + +if (!empty($suggestions)) { + echo "

    Suggestions

    "; + echo "
    "; + foreach ($suggestions as $suggestion) { + $quote = htmlspecialchars(trim($suggestion[0])); + $movie = htmlspecialchars(trim($suggestion[1])); + $character = htmlspecialchars(trim($suggestion[2])); + $year = htmlspecialchars(trim($suggestion[3])); + $imagePath = htmlspecialchars(trim($suggestion[4])); + + echo "
    "; + echo "$movie"; + echo "
    "; + echo "

    \"$quote\"

    "; + echo "

    - $movie

    "; + echo "

    Personnage : $character

    "; + echo "

    Année : $year

    "; + echo "
    "; + echo "
    "; + } + echo "
    "; +} + +echo ""; +?> + \ No newline at end of file diff --git a/vue/erreur.php b/vue/erreur.php index 79a045d..dc283d5 100644 --- a/vue/erreur.php +++ b/vue/erreur.php @@ -1,5 +1,5 @@ -

    - +

    +

    \ No newline at end of file diff --git a/vue/favorite.html b/vue/favorite.html index b87e07f..2a8bfc7 100644 --- a/vue/favorite.html +++ b/vue/favorite.html @@ -1,30 +1,30 @@ - - - - - - Wiki Fantasy : Favoris - - - - - - -
    -
    - - -
    - user -
    -
    -
    -

    Wiki Fantasy

    - - + + + + + + Wiki Fantasy : Favoris + + + + + + +
    +
    + + +
    + user +
    +
    +
    +

    Wiki Fantasy

    + + diff --git a/vue/login.php b/vue/login.php index e6fea79..452d02a 100644 --- a/vue/login.php +++ b/vue/login.php @@ -1,12 +1,12 @@ -render('head.html.twig', array( - 'title' => "Login", - 'style' => "public/styles/styleLogin.css", - )); - - echo $twig->render('bandeau.html.twig'); - echo $twig->render('login.html'); +render('head.html.twig', array( + 'title' => "Login", + 'style' => "public/styles/styleLogin.css", + )); + + echo $twig->render('bandeau.html.twig'); + echo $twig->render('login.html'); ?> \ No newline at end of file diff --git a/vue/profil.php b/vue/profil.php index 9e338bf..6e1957a 100644 --- a/vue/profil.php +++ b/vue/profil.php @@ -1,18 +1,18 @@ - false, - ]); - // - - echo $twig->render('profil.html', array( - 'srcUsername' => "Test User", - 'srcEmail' => "test@gmail.com", - 'srcPasswd' => "*****", - 'srcImg' => "../images/imageProfil.png", - )); + false, + ]); + // + + echo $twig->render('profil.html', array( + 'srcUsername' => "Test User", + 'srcEmail' => "test@gmail.com", + 'srcPasswd' => "*****", + 'srcImg' => "../images/imageProfil.png", + )); ?> \ No newline at end of file diff --git a/vue/quiz.html b/vue/quiz.html index 7b25e55..0274419 100644 --- a/vue/quiz.html +++ b/vue/quiz.html @@ -1,61 +1,61 @@ - - - - - - Wiki Fantasy : Quiz - - - - - - -
    - - -
    - user -
    -
    - -

    ▶ Quiz ◀

    - -
    -

    Question 1

    -

    “Tu es un sorcier Harry”

    - - -
    - - - - -
    - -
    - -
    -
    - - + + + + + + Wiki Fantasy : Quiz + + + + + + +
    + + +
    + user +
    +
    + +

    ▶ Quiz ◀

    + +
    +

    Question 1

    +

    “Tu es un sorcier Harry”

    + + +
    + + + + +
    + +
    + +
    +
    + + diff --git a/vue/quizz.html b/vue/quizz.html index 6955adc..ae2f1d3 100644 --- a/vue/quizz.html +++ b/vue/quizz.html @@ -1,211 +1,211 @@ - - - - - - - - Wiki Fantasy : Quizz - - - - - - - -
    -
    - - -
    - user -
    -
    -
    - - -

    ▶ Quizz ◀

    - -
    -

    Question 1

    -

    “Tu es un sorcier Harry”

    - - -
    - - - - -
    - -
    - -
    -
    - - - - - + + + + + + + + Wiki Fantasy : Quizz + + + + + + + +
    +
    + + +
    + user +
    +
    +
    + + +

    ▶ Quizz ◀

    + +
    +

    Question 1

    +

    “Tu es un sorcier Harry”

    + + +
    + + + + +
    + +
    + +
    +
    + + + + + diff --git a/vue/quote.php b/vue/quote.php index 647c322..aeda8dc 100644 --- a/vue/quote.php +++ b/vue/quote.php @@ -1,21 +1,21 @@ -render('head.html.twig', array( - 'title' => "Quote", - 'style' => "public/styles/styleQuote.css", - )); - - echo $twig->render('bandeau.html.twig'); - echo $twig->render('quote.html', array( - 'srcImg' => "public/images/Dark_Vador.jpg", - 'nameCarac' => "Dark Vador", - 'quoteContent' => "Je suis ton père", - 'sourceName' => "Star Wars V : L’Empire contre-attaque", - 'dateSortie' => "1980", - 'nbLike' => "173000", - 'timeCode' =>"1h45", - -)); +render('head.html.twig', array( + 'title' => "Quote", + 'style' => "public/styles/styleQuote.css", + )); + + echo $twig->render('bandeau.html.twig'); + echo $twig->render('quote.html', array( + 'srcImg' => "public/images/Dark_Vador.jpg", + 'nameCarac' => "Dark Vador", + 'quoteContent' => "Je suis ton père", + 'sourceName' => "Star Wars V : L’Empire contre-attaque", + 'dateSortie' => "1980", + 'nbLike' => "173000", + 'timeCode' =>"1h45", + +)); ?> \ No newline at end of file diff --git a/vue/search.php b/vue/search.php index 37a92c5..177b1c3 100644 --- a/vue/search.php +++ b/vue/search.php @@ -1,63 +1,16 @@ - - - - - - Wiki Fantasy - - - - - - -
    - - -
    - user -
    -
    - -
    -
    -
    - -
    - query("SELECT * -# FROM utilisateur -# WHERE nom LIKE ? -# LIMIT 10", -# array("$user%")); -# -#$req = $req->fetchALL(); -$req=array(array('nom'=>'nom1','prenom'=>'prenom1'),array('nom'=>'nom2','prenom'=>'prenom2'),array('nom'=>'nom3','prenom'=>'prenom3')); - -foreach($req as $r){ - ?> -
    -
    -
    -
    -
    - - - \ No newline at end of file +render('head.html.twig', array( + 'title' => "Quote", + 'style' => "public/styles/styleSearch.css", + )); + + echo $twig->render('bandeau.html.twig'); + echo $twig->render('filtre.html.twig'); + echo $_POST['type']; + echo $_POST['search']; + //echo $twig->render('resultat.html.twig'); + +?> \ No newline at end of file diff --git a/vue/signin.php b/vue/signin.php index 4cef884..6bff252 100644 --- a/vue/signin.php +++ b/vue/signin.php @@ -1,12 +1,12 @@ -render('head.html.twig', array( - 'title' => "Sign in", - 'style' => "public/styles/styleSignin.css", - )); - - echo $twig->render('bandeau.html.twig'); - echo $twig->render('signin.html'); +render('head.html.twig', array( + 'title' => "Sign in", + 'style' => "public/styles/styleSignin.css", + )); + + echo $twig->render('bandeau.html.twig'); + echo $twig->render('signin.html'); ?> \ No newline at end of file diff --git a/vue/submitAnswer.php b/vue/submitAnswer.php index ffab274..76bb811 100644 --- a/vue/submitAnswer.php +++ b/vue/submitAnswer.php @@ -1,7 +1,7 @@ - - - -
    - user -
    +
    + + +
    + user +
    \ No newline at end of file diff --git a/vue/templates/filtre.html.twig b/vue/templates/filtre.html.twig new file mode 100644 index 0000000..89f8ef2 --- /dev/null +++ b/vue/templates/filtre.html.twig @@ -0,0 +1,44 @@ +
    + + + +
    +
    + + +
    + +
    + + +
    + +
    + + +
    +
    + +

    Plus de filtre

    + +
    + + +
    + + +
    + +
    + + +
    +
    + + +
    +
    + + + +
    \ No newline at end of file diff --git a/vue/templates/head.html.twig b/vue/templates/head.html.twig index 31c1ef9..92594f6 100644 --- a/vue/templates/head.html.twig +++ b/vue/templates/head.html.twig @@ -1,11 +1,11 @@ - - - - - - {{ title }} - - - - + + + + + + {{ title }} + + + + \ No newline at end of file diff --git a/vue/templates/login.html b/vue/templates/login.html index e4cd68d..dae6031 100644 --- a/vue/templates/login.html +++ b/vue/templates/login.html @@ -1,37 +1,37 @@ -
    -
    - - -
    - user -
    -
    -
    -

    ▶ Connexion ◀

    - - - +
    +
    + + +
    + user +
    +
    +
    +

    ▶ Connexion ◀

    + + + \ No newline at end of file diff --git a/vue/templates/profil.html b/vue/templates/profil.html index 4b6d160..aef1ede 100644 --- a/vue/templates/profil.html +++ b/vue/templates/profil.html @@ -1,58 +1,58 @@ - - - - - - - Wiki Fantasy : Profil - - - - - - -
    -
    - - -
    -
    - - - + + + + + + + Wiki Fantasy : Profil + + + + + + +
    +
    + + +
    +
    + + + \ No newline at end of file diff --git a/vue/templates/quiz.html.twig b/vue/templates/quiz.html.twig index f78dd54..fbb7526 100644 --- a/vue/templates/quiz.html.twig +++ b/vue/templates/quiz.html.twig @@ -1,66 +1,66 @@ - - - - - - Wiki Fantasy : Quiz - - - - - - -
    - - -
    - user -
    -
    - - -

    ▶ Quiz ◀

    -
    -

    {{ question.question }}

    - 300 seconds left .. - -
    -
    - - - - -
    - -
    -
    - - + + + + + + Wiki Fantasy : Quiz + + + + + + +
    + + +
    + user +
    +
    + + +

    ▶ Quiz ◀

    +
    +

    {{ question.question }}

    + 300 seconds left .. + +
    +
    + + + + +
    + +
    +
    + + diff --git a/vue/templates/quote.html b/vue/templates/quote.html index ddf2581..77f1faa 100644 --- a/vue/templates/quote.html +++ b/vue/templates/quote.html @@ -1,23 +1,23 @@ - -
    - - -
    -

    “{{quoteContent}}”

    -
      -
    • - {{sourceName}} ({{timeCode}})
    • -
    • - {{nameCarac}}
    • -
    • - {{dateSortie}}
    • -
    - - -
    - - - - -
    - + +
    + + +
    +

    “{{quoteContent}}”

    +
      +
    • - {{sourceName}} ({{timeCode}})
    • +
    • - {{nameCarac}}
    • +
    • - {{dateSortie}}
    • +
    + + +
    + + + + +
    + \ No newline at end of file diff --git a/vue/templates/signin.html b/vue/templates/signin.html index e46ea11..f3d66be 100644 --- a/vue/templates/signin.html +++ b/vue/templates/signin.html @@ -1,50 +1,50 @@ -
    -
    - - -
    - user -
    -
    -
    -

    ▶ S'inscrire ◀

    -
    - -
    - +
    +
    + + +
    + user +
    +
    +
    +

    ▶ S'inscrire ◀

    +
    + +
    + \ No newline at end of file