From ac98c21bf804470e1903abb1d5e22d7f1dbc103a Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 24 Nov 2023 04:08:46 +0100 Subject: [PATCH] Framework done :sparkles::sparkles::sparkles: --- .gitignore | 2 - Sources/composer.json | 27 +- Sources/composer.lock | 443 ++++++++++++++++- Sources/config/config.php | 14 +- Sources/public/index.php | 37 +- Sources/src/app/App.php | 158 ++++++ Sources/src/app/AppCreator.php | 91 ++++ Sources/src/app/Container.php | 109 +++++ Sources/src/app/controller/BaseController.php | 74 +++ Sources/src/app/controller/Controller.php | 141 ++++++ .../src/app/controller/FrontController.php | 73 +++ Sources/src/app/router/Route.php | 94 ++++ Sources/src/app/router/Router.php | 116 +++++ Sources/src/app/router/Session.php | 121 +++++ .../middleware/HttpValidationMiddleware.php | 39 ++ .../app/router/middleware/IHttpMiddleware.php | 9 + .../router/middleware/LoggingMiddleware.php | 12 + .../src/app/router/middleware/Middleware.php | 20 + .../app/router/request/ContentStrategy.php | 6 + .../router/request/ContentStrategyFactory.php | 23 + .../router/request/FormContentStrategy.php | 9 + .../src/app/router/request/HttpRequest.php | 55 +++ Sources/src/app/router/request/IRequest.php | 16 + .../router/request/JsonContentStrategy.php | 9 + .../src/app/router/request/RequestFactory.php | 27 + Sources/src/app/router/response/IResponse.php | 12 + .../app/router/response/RedirectResponse.php | 65 +++ Sources/src/app/router/response/Response.php | 49 ++ .../src/app/views/Templates/base.html.twig | 12 +- .../app/views/Templates/errorbase.html.twig | 4 +- .../views/Templates/page/addfriend.html.twig | 2 +- .../views/Templates/page/analyze.html.twig | 2 +- .../views/Templates/page/coaching.html.twig | 2 +- .../views/Templates/page/exercice.html.twig | 2 +- .../views/Templates/page/profile.html.twig | 2 +- .../views/Templates/page/settings.html.twig | 2 +- Sources/src/app/views/directives/Navigate.php | 29 ++ .../src/shared/ArgumentControllerResolver.php | 85 ++++ Sources/src/shared/IArgumentResolver.php | 19 + Sources/src/shared/Log.php | 60 +++ Sources/src/shared/attributes/Route.php | 30 ++ .../src/shared/exception/HttpException.php | 34 ++ .../exception/NotFoundHttpException.php | 11 + .../exception/NotImplementedException.php | 8 + .../shared/exception/ValidationException.php | 30 ++ .../vendor/altorouter/altorouter/.travis.yml | 7 + .../altorouter/altorouter/AltoRouter.php | 270 ++++++++++ .../altorouter/altorouter/AltoRouterTest.php | 423 ++++++++++++++++ .../vendor/altorouter/altorouter/README.md | 92 ++++ .../altorouter/altorouter/composer.json | 28 ++ .../altorouter/examples/basic/.htaccess | 3 + .../altorouter/examples/basic/index.php | 27 + Sources/vendor/composer/autoload_classmap.php | 6 + Sources/vendor/composer/autoload_files.php | 3 +- Sources/vendor/composer/autoload_psr4.php | 17 +- Sources/vendor/composer/autoload_static.php | 92 +++- Sources/vendor/composer/installed.json | 463 +++++++++++++++++- Sources/vendor/composer/installed.php | 70 ++- Sources/vendor/composer/platform_check.php | 4 +- .../graham-campbell/result-type/LICENSE | 21 + .../graham-campbell/result-type/composer.json | 33 ++ .../graham-campbell/result-type/src/Error.php | 121 +++++ .../result-type/src/Result.php | 69 +++ .../result-type/src/Success.php | 120 +++++ Sources/vendor/phpoption/phpoption/LICENSE | 201 ++++++++ .../vendor/phpoption/phpoption/composer.json | 52 ++ .../phpoption/src/PhpOption/LazyOption.php | 175 +++++++ .../phpoption/src/PhpOption/None.php | 136 +++++ .../phpoption/src/PhpOption/Option.php | 434 ++++++++++++++++ .../phpoption/src/PhpOption/Some.php | 169 +++++++ Sources/vendor/psr/container/.gitignore | 3 + Sources/vendor/psr/container/LICENSE | 21 + Sources/vendor/psr/container/README.md | 13 + Sources/vendor/psr/container/composer.json | 27 + .../src/ContainerExceptionInterface.php | 12 + .../psr/container/src/ContainerInterface.php | 36 ++ .../src/NotFoundExceptionInterface.php | 10 + Sources/vendor/symfony/polyfill-php80/LICENSE | 19 + .../vendor/symfony/polyfill-php80/Php80.php | 115 +++++ .../symfony/polyfill-php80/PhpToken.php | 103 ++++ .../vendor/symfony/polyfill-php80/README.md | 25 + .../Resources/stubs/Attribute.php | 31 ++ .../Resources/stubs/PhpToken.php | 16 + .../Resources/stubs/Stringable.php | 20 + .../Resources/stubs/UnhandledMatchError.php | 16 + .../Resources/stubs/ValueError.php | 16 + .../symfony/polyfill-php80/bootstrap.php | 42 ++ .../symfony/polyfill-php80/composer.json | 40 ++ Sources/vendor/theseer/tokenizer/.php_cs.dist | 213 -------- Sources/vendor/theseer/tokenizer/CHANGELOG.md | 6 + Sources/vendor/theseer/tokenizer/LICENSE | 0 Sources/vendor/theseer/tokenizer/README.md | 3 - .../vendor/theseer/tokenizer/composer.json | 0 .../vendor/theseer/tokenizer/composer.lock | 0 .../theseer/tokenizer/src/Exception.php | 0 .../theseer/tokenizer/src/NamespaceUri.php | 0 .../tokenizer/src/NamespaceUriException.php | 0 .../vendor/theseer/tokenizer/src/Token.php | 0 .../theseer/tokenizer/src/TokenCollection.php | 0 .../src/TokenCollectionException.php | 0 .../theseer/tokenizer/src/Tokenizer.php | 21 +- .../theseer/tokenizer/src/XMLSerializer.php | 0 Sources/vendor/twig/twig/CHANGELOG | 10 + Sources/vendor/twig/twig/LICENSE | 0 Sources/vendor/twig/twig/README.rst | 0 Sources/vendor/twig/twig/composer.json | 3 +- .../twig/twig/src/Cache/CacheInterface.php | 0 .../twig/twig/src/Cache/FilesystemCache.php | 2 +- .../vendor/twig/twig/src/Cache/NullCache.php | 0 Sources/vendor/twig/twig/src/Compiler.php | 0 Sources/vendor/twig/twig/src/Environment.php | 9 +- Sources/vendor/twig/twig/src/Error/Error.php | 8 +- .../twig/twig/src/Error/LoaderError.php | 0 .../twig/twig/src/Error/RuntimeError.php | 0 .../twig/twig/src/Error/SyntaxError.php | 2 +- .../vendor/twig/twig/src/ExpressionParser.php | 7 +- .../twig/src/Extension/AbstractExtension.php | 0 .../twig/twig/src/Extension/CoreExtension.php | 56 +-- .../twig/src/Extension/DebugExtension.php | 4 +- .../twig/src/Extension/EscaperExtension.php | 4 +- .../twig/src/Extension/ExtensionInterface.php | 0 .../twig/src/Extension/GlobalsInterface.php | 0 .../twig/src/Extension/OptimizerExtension.php | 0 .../twig/src/Extension/ProfilerExtension.php | 0 .../Extension/RuntimeExtensionInterface.php | 0 .../twig/src/Extension/SandboxExtension.php | 0 .../twig/src/Extension/StagingExtension.php | 0 .../src/Extension/StringLoaderExtension.php | 0 Sources/vendor/twig/twig/src/ExtensionSet.php | 0 .../src/FileExtensionEscapingStrategy.php | 2 +- Sources/vendor/twig/twig/src/Lexer.php | 8 +- .../twig/twig/src/Loader/ArrayLoader.php | 0 .../twig/twig/src/Loader/ChainLoader.php | 0 .../twig/twig/src/Loader/FilesystemLoader.php | 4 +- .../twig/twig/src/Loader/LoaderInterface.php | 0 Sources/vendor/twig/twig/src/Markup.php | 0 .../twig/twig/src/Node/AutoEscapeNode.php | 0 .../vendor/twig/twig/src/Node/BlockNode.php | 0 .../twig/twig/src/Node/BlockReferenceNode.php | 0 .../vendor/twig/twig/src/Node/BodyNode.php | 0 .../twig/src/Node/CheckSecurityCallNode.php | 0 .../twig/twig/src/Node/CheckSecurityNode.php | 0 .../twig/twig/src/Node/CheckToStringNode.php | 0 .../twig/twig/src/Node/DeprecatedNode.php | 0 Sources/vendor/twig/twig/src/Node/DoNode.php | 0 .../vendor/twig/twig/src/Node/EmbedNode.php | 0 .../Node/Expression/AbstractExpression.php | 0 .../src/Node/Expression/ArrayExpression.php | 0 .../Expression/ArrowFunctionExpression.php | 0 .../Node/Expression/AssignNameExpression.php | 0 .../Node/Expression/Binary/AbstractBinary.php | 0 .../src/Node/Expression/Binary/AddBinary.php | 0 .../src/Node/Expression/Binary/AndBinary.php | 0 .../Expression/Binary/BitwiseAndBinary.php | 0 .../Expression/Binary/BitwiseOrBinary.php | 0 .../Expression/Binary/BitwiseXorBinary.php | 0 .../Node/Expression/Binary/ConcatBinary.php | 0 .../src/Node/Expression/Binary/DivBinary.php | 0 .../Node/Expression/Binary/EndsWithBinary.php | 2 +- .../Node/Expression/Binary/EqualBinary.php | 0 .../Node/Expression/Binary/FloorDivBinary.php | 0 .../Node/Expression/Binary/GreaterBinary.php | 0 .../Expression/Binary/GreaterEqualBinary.php | 0 .../Node/Expression/Binary/HasEveryBinary.php | 0 .../Node/Expression/Binary/HasSomeBinary.php | 0 .../src/Node/Expression/Binary/InBinary.php | 0 .../src/Node/Expression/Binary/LessBinary.php | 0 .../Expression/Binary/LessEqualBinary.php | 0 .../Node/Expression/Binary/MatchesBinary.php | 0 .../src/Node/Expression/Binary/ModBinary.php | 0 .../src/Node/Expression/Binary/MulBinary.php | 0 .../Node/Expression/Binary/NotEqualBinary.php | 0 .../Node/Expression/Binary/NotInBinary.php | 0 .../src/Node/Expression/Binary/OrBinary.php | 0 .../Node/Expression/Binary/PowerBinary.php | 0 .../Node/Expression/Binary/RangeBinary.php | 0 .../Expression/Binary/SpaceshipBinary.php | 0 .../Expression/Binary/StartsWithBinary.php | 2 +- .../src/Node/Expression/Binary/SubBinary.php | 0 .../Expression/BlockReferenceExpression.php | 0 .../src/Node/Expression/CallExpression.php | 6 +- .../Node/Expression/ConditionalExpression.php | 27 +- .../Node/Expression/ConstantExpression.php | 0 .../Node/Expression/Filter/DefaultFilter.php | 0 .../src/Node/Expression/FilterExpression.php | 0 .../Node/Expression/FunctionExpression.php | 0 .../src/Node/Expression/GetAttrExpression.php | 0 .../twig/src/Node/Expression/InlinePrint.php | 0 .../Node/Expression/MethodCallExpression.php | 0 .../src/Node/Expression/NameExpression.php | 0 .../Expression/NullCoalesceExpression.php | 0 .../src/Node/Expression/ParentExpression.php | 0 .../Node/Expression/TempNameExpression.php | 0 .../src/Node/Expression/Test/ConstantTest.php | 0 .../src/Node/Expression/Test/DefinedTest.php | 0 .../Node/Expression/Test/DivisiblebyTest.php | 0 .../src/Node/Expression/Test/EvenTest.php | 0 .../src/Node/Expression/Test/NullTest.php | 0 .../twig/src/Node/Expression/Test/OddTest.php | 0 .../src/Node/Expression/Test/SameasTest.php | 0 .../src/Node/Expression/TestExpression.php | 0 .../Node/Expression/Unary/AbstractUnary.php | 0 .../src/Node/Expression/Unary/NegUnary.php | 0 .../src/Node/Expression/Unary/NotUnary.php | 0 .../src/Node/Expression/Unary/PosUnary.php | 0 .../Node/Expression/VariadicExpression.php | 0 .../vendor/twig/twig/src/Node/FlushNode.php | 0 .../vendor/twig/twig/src/Node/ForLoopNode.php | 0 Sources/vendor/twig/twig/src/Node/ForNode.php | 0 Sources/vendor/twig/twig/src/Node/IfNode.php | 0 .../vendor/twig/twig/src/Node/ImportNode.php | 0 .../vendor/twig/twig/src/Node/IncludeNode.php | 0 .../vendor/twig/twig/src/Node/MacroNode.php | 0 .../vendor/twig/twig/src/Node/ModuleNode.php | 9 + Sources/vendor/twig/twig/src/Node/Node.php | 1 - .../twig/src/Node/NodeCaptureInterface.php | 0 .../twig/src/Node/NodeOutputInterface.php | 0 .../vendor/twig/twig/src/Node/PrintNode.php | 0 .../vendor/twig/twig/src/Node/SandboxNode.php | 0 Sources/vendor/twig/twig/src/Node/SetNode.php | 0 .../vendor/twig/twig/src/Node/TextNode.php | 0 .../vendor/twig/twig/src/Node/WithNode.php | 2 +- .../vendor/twig/twig/src/NodeTraverser.php | 0 .../src/NodeVisitor/AbstractNodeVisitor.php | 0 .../src/NodeVisitor/EscaperNodeVisitor.php | 10 +- .../MacroAutoImportNodeVisitor.php | 8 +- .../src/NodeVisitor/NodeVisitorInterface.php | 0 .../src/NodeVisitor/OptimizerNodeVisitor.php | 32 +- .../NodeVisitor/SafeAnalysisNodeVisitor.php | 0 .../src/NodeVisitor/SandboxNodeVisitor.php | 0 Sources/vendor/twig/twig/src/Parser.php | 5 +- .../twig/src/Profiler/Dumper/BaseDumper.php | 0 .../src/Profiler/Dumper/BlackfireDumper.php | 0 .../twig/src/Profiler/Dumper/HtmlDumper.php | 2 +- .../twig/src/Profiler/Dumper/TextDumper.php | 0 .../src/Profiler/Node/EnterProfileNode.php | 0 .../src/Profiler/Node/LeaveProfileNode.php | 0 .../NodeVisitor/ProfilerNodeVisitor.php | 0 .../vendor/twig/twig/src/Profiler/Profile.php | 2 +- .../RuntimeLoader/ContainerRuntimeLoader.php | 0 .../RuntimeLoader/FactoryRuntimeLoader.php | 0 .../RuntimeLoader/RuntimeLoaderInterface.php | 0 .../twig/twig/src/Sandbox/SecurityError.php | 0 .../Sandbox/SecurityNotAllowedFilterError.php | 0 .../SecurityNotAllowedFunctionError.php | 0 .../Sandbox/SecurityNotAllowedMethodError.php | 0 .../SecurityNotAllowedPropertyError.php | 0 .../Sandbox/SecurityNotAllowedTagError.php | 0 .../twig/twig/src/Sandbox/SecurityPolicy.php | 10 +- .../src/Sandbox/SecurityPolicyInterface.php | 0 Sources/vendor/twig/twig/src/Source.php | 0 Sources/vendor/twig/twig/src/Template.php | 4 +- .../vendor/twig/twig/src/TemplateWrapper.php | 4 +- .../twig/src/Test/IntegrationTestCase.php | 5 +- .../twig/twig/src/Test/NodeTestCase.php | 2 +- Sources/vendor/twig/twig/src/Token.php | 6 +- .../src/TokenParser/AbstractTokenParser.php | 0 .../twig/src/TokenParser/ApplyTokenParser.php | 0 .../src/TokenParser/AutoEscapeTokenParser.php | 0 .../twig/src/TokenParser/BlockTokenParser.php | 0 .../src/TokenParser/DeprecatedTokenParser.php | 0 .../twig/src/TokenParser/DoTokenParser.php | 0 .../twig/src/TokenParser/EmbedTokenParser.php | 0 .../src/TokenParser/ExtendsTokenParser.php | 0 .../twig/src/TokenParser/FlushTokenParser.php | 0 .../twig/src/TokenParser/ForTokenParser.php | 0 .../twig/src/TokenParser/FromTokenParser.php | 4 +- .../twig/src/TokenParser/IfTokenParser.php | 0 .../src/TokenParser/ImportTokenParser.php | 0 .../src/TokenParser/IncludeTokenParser.php | 0 .../twig/src/TokenParser/MacroTokenParser.php | 0 .../src/TokenParser/SandboxTokenParser.php | 0 .../twig/src/TokenParser/SetTokenParser.php | 0 .../src/TokenParser/TokenParserInterface.php | 0 .../twig/src/TokenParser/UseTokenParser.php | 4 +- .../twig/src/TokenParser/WithTokenParser.php | 0 Sources/vendor/twig/twig/src/TokenStream.php | 0 Sources/vendor/twig/twig/src/TwigFilter.php | 0 Sources/vendor/twig/twig/src/TwigFunction.php | 0 Sources/vendor/twig/twig/src/TwigTest.php | 0 .../twig/src/Util/DeprecationCollector.php | 0 .../twig/src/Util/TemplateDirIterator.php | 0 Sources/vendor/vlucas/phpdotenv/LICENSE | 30 ++ Sources/vendor/vlucas/phpdotenv/composer.json | 60 +++ .../vendor/vlucas/phpdotenv/src/Dotenv.php | 267 ++++++++++ .../src/Exception/ExceptionInterface.php | 12 + .../Exception/InvalidEncodingException.php | 12 + .../src/Exception/InvalidFileException.php | 12 + .../src/Exception/InvalidPathException.php | 12 + .../src/Exception/ValidationException.php | 12 + .../vlucas/phpdotenv/src/Loader/Loader.php | 47 ++ .../phpdotenv/src/Loader/LoaderInterface.php | 20 + .../vlucas/phpdotenv/src/Loader/Resolver.php | 65 +++ .../vlucas/phpdotenv/src/Parser/Entry.php | 59 +++ .../phpdotenv/src/Parser/EntryParser.php | 300 ++++++++++++ .../vlucas/phpdotenv/src/Parser/Lexer.php | 58 +++ .../vlucas/phpdotenv/src/Parser/Lines.php | 127 +++++ .../vlucas/phpdotenv/src/Parser/Parser.php | 53 ++ .../phpdotenv/src/Parser/ParserInterface.php | 19 + .../vlucas/phpdotenv/src/Parser/Value.php | 88 ++++ .../Repository/Adapter/AdapterInterface.php | 15 + .../src/Repository/Adapter/ApacheAdapter.php | 89 ++++ .../src/Repository/Adapter/ArrayAdapter.php | 80 +++ .../Repository/Adapter/EnvConstAdapter.php | 89 ++++ .../src/Repository/Adapter/GuardedWriter.php | 85 ++++ .../Repository/Adapter/ImmutableWriter.php | 110 +++++ .../src/Repository/Adapter/MultiReader.php | 48 ++ .../src/Repository/Adapter/MultiWriter.php | 64 +++ .../src/Repository/Adapter/PutenvAdapter.php | 91 ++++ .../Repository/Adapter/ReaderInterface.php | 17 + .../Repository/Adapter/ReplacingWriter.php | 104 ++++ .../Repository/Adapter/ServerConstAdapter.php | 89 ++++ .../Repository/Adapter/WriterInterface.php | 27 + .../src/Repository/AdapterRepository.php | 107 ++++ .../src/Repository/RepositoryBuilder.php | 272 ++++++++++ .../src/Repository/RepositoryInterface.php | 51 ++ .../vlucas/phpdotenv/src/Store/File/Paths.php | 44 ++ .../phpdotenv/src/Store/File/Reader.php | 81 +++ .../vlucas/phpdotenv/src/Store/FileStore.php | 72 +++ .../phpdotenv/src/Store/StoreBuilder.php | 141 ++++++ .../phpdotenv/src/Store/StoreInterface.php | 17 + .../phpdotenv/src/Store/StringStore.php | 37 ++ .../vlucas/phpdotenv/src/Util/Regex.php | 112 +++++ .../vendor/vlucas/phpdotenv/src/Util/Str.php | 98 ++++ .../vendor/vlucas/phpdotenv/src/Validator.php | 209 ++++++++ 325 files changed, 9274 insertions(+), 423 deletions(-) create mode 100644 Sources/src/app/App.php create mode 100644 Sources/src/app/AppCreator.php create mode 100644 Sources/src/app/Container.php create mode 100644 Sources/src/app/controller/BaseController.php create mode 100644 Sources/src/app/controller/Controller.php create mode 100644 Sources/src/app/controller/FrontController.php create mode 100644 Sources/src/app/router/Route.php create mode 100644 Sources/src/app/router/Router.php create mode 100644 Sources/src/app/router/Session.php create mode 100644 Sources/src/app/router/middleware/HttpValidationMiddleware.php create mode 100644 Sources/src/app/router/middleware/IHttpMiddleware.php create mode 100644 Sources/src/app/router/middleware/LoggingMiddleware.php create mode 100644 Sources/src/app/router/middleware/Middleware.php create mode 100644 Sources/src/app/router/request/ContentStrategy.php create mode 100644 Sources/src/app/router/request/ContentStrategyFactory.php create mode 100644 Sources/src/app/router/request/FormContentStrategy.php create mode 100644 Sources/src/app/router/request/HttpRequest.php create mode 100644 Sources/src/app/router/request/IRequest.php create mode 100644 Sources/src/app/router/request/JsonContentStrategy.php create mode 100644 Sources/src/app/router/request/RequestFactory.php create mode 100644 Sources/src/app/router/response/IResponse.php create mode 100644 Sources/src/app/router/response/RedirectResponse.php create mode 100644 Sources/src/app/router/response/Response.php create mode 100644 Sources/src/app/views/directives/Navigate.php create mode 100644 Sources/src/shared/ArgumentControllerResolver.php create mode 100644 Sources/src/shared/IArgumentResolver.php create mode 100644 Sources/src/shared/Log.php create mode 100644 Sources/src/shared/attributes/Route.php create mode 100644 Sources/src/shared/exception/HttpException.php create mode 100644 Sources/src/shared/exception/NotFoundHttpException.php create mode 100644 Sources/src/shared/exception/NotImplementedException.php create mode 100644 Sources/src/shared/exception/ValidationException.php create mode 100644 Sources/vendor/altorouter/altorouter/.travis.yml create mode 100644 Sources/vendor/altorouter/altorouter/AltoRouter.php create mode 100644 Sources/vendor/altorouter/altorouter/AltoRouterTest.php create mode 100644 Sources/vendor/altorouter/altorouter/README.md create mode 100644 Sources/vendor/altorouter/altorouter/composer.json create mode 100644 Sources/vendor/altorouter/altorouter/examples/basic/.htaccess create mode 100644 Sources/vendor/altorouter/altorouter/examples/basic/index.php create mode 100644 Sources/vendor/graham-campbell/result-type/LICENSE create mode 100644 Sources/vendor/graham-campbell/result-type/composer.json create mode 100644 Sources/vendor/graham-campbell/result-type/src/Error.php create mode 100644 Sources/vendor/graham-campbell/result-type/src/Result.php create mode 100644 Sources/vendor/graham-campbell/result-type/src/Success.php create mode 100644 Sources/vendor/phpoption/phpoption/LICENSE create mode 100644 Sources/vendor/phpoption/phpoption/composer.json create mode 100644 Sources/vendor/phpoption/phpoption/src/PhpOption/LazyOption.php create mode 100644 Sources/vendor/phpoption/phpoption/src/PhpOption/None.php create mode 100644 Sources/vendor/phpoption/phpoption/src/PhpOption/Option.php create mode 100644 Sources/vendor/phpoption/phpoption/src/PhpOption/Some.php create mode 100644 Sources/vendor/psr/container/.gitignore create mode 100644 Sources/vendor/psr/container/LICENSE create mode 100644 Sources/vendor/psr/container/README.md create mode 100644 Sources/vendor/psr/container/composer.json create mode 100644 Sources/vendor/psr/container/src/ContainerExceptionInterface.php create mode 100644 Sources/vendor/psr/container/src/ContainerInterface.php create mode 100644 Sources/vendor/psr/container/src/NotFoundExceptionInterface.php create mode 100644 Sources/vendor/symfony/polyfill-php80/LICENSE create mode 100644 Sources/vendor/symfony/polyfill-php80/Php80.php create mode 100644 Sources/vendor/symfony/polyfill-php80/PhpToken.php create mode 100644 Sources/vendor/symfony/polyfill-php80/README.md create mode 100644 Sources/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php create mode 100644 Sources/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php create mode 100644 Sources/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php create mode 100644 Sources/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php create mode 100644 Sources/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php create mode 100644 Sources/vendor/symfony/polyfill-php80/bootstrap.php create mode 100644 Sources/vendor/symfony/polyfill-php80/composer.json delete mode 100755 Sources/vendor/theseer/tokenizer/.php_cs.dist mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/CHANGELOG.md mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/LICENSE mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/README.md mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/composer.json mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/composer.lock mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/src/Exception.php mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/src/NamespaceUri.php mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/src/NamespaceUriException.php mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/src/Token.php mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/src/TokenCollection.php mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/src/TokenCollectionException.php mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/src/Tokenizer.php mode change 100755 => 100644 Sources/vendor/theseer/tokenizer/src/XMLSerializer.php mode change 100755 => 100644 Sources/vendor/twig/twig/CHANGELOG mode change 100755 => 100644 Sources/vendor/twig/twig/LICENSE mode change 100755 => 100644 Sources/vendor/twig/twig/README.rst mode change 100755 => 100644 Sources/vendor/twig/twig/composer.json mode change 100755 => 100644 Sources/vendor/twig/twig/src/Cache/CacheInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Cache/FilesystemCache.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Cache/NullCache.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Compiler.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Environment.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Error/Error.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Error/LoaderError.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Error/RuntimeError.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Error/SyntaxError.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/ExpressionParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/AbstractExtension.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/CoreExtension.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/DebugExtension.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/EscaperExtension.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/ExtensionInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/GlobalsInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/OptimizerExtension.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/ProfilerExtension.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/SandboxExtension.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/StagingExtension.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Extension/StringLoaderExtension.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/ExtensionSet.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/FileExtensionEscapingStrategy.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Lexer.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Loader/ArrayLoader.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Loader/ChainLoader.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Loader/FilesystemLoader.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Loader/LoaderInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Markup.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/AutoEscapeNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/BlockNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/BlockReferenceNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/BodyNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/CheckSecurityCallNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/CheckSecurityNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/CheckToStringNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/DeprecatedNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/DoNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/EmbedNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/AbstractExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/ArrayExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/HasEveryBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/HasSomeBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/CallExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/ConstantExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/FilterExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/FunctionExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/InlinePrint.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/NameExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/ParentExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/TempNameExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Test/NullTest.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Test/OddTest.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/TestExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Expression/VariadicExpression.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/FlushNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/ForLoopNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/ForNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/IfNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/ImportNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/IncludeNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/MacroNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/ModuleNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/Node.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/NodeCaptureInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/NodeOutputInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/PrintNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/SandboxNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/SetNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/TextNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Node/WithNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/NodeTraverser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Parser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Profiler/Profile.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Sandbox/SecurityError.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Sandbox/SecurityPolicy.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Source.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Template.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TemplateWrapper.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Test/IntegrationTestCase.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Test/NodeTestCase.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Token.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/BlockTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/DoTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/FlushTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/ForTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/FromTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/IfTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/ImportTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/MacroTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/SetTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/TokenParserInterface.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/UseTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenParser/WithTokenParser.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TokenStream.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TwigFilter.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TwigFunction.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/TwigTest.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Util/DeprecationCollector.php mode change 100755 => 100644 Sources/vendor/twig/twig/src/Util/TemplateDirIterator.php create mode 100644 Sources/vendor/vlucas/phpdotenv/LICENSE create mode 100644 Sources/vendor/vlucas/phpdotenv/composer.json create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Dotenv.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Exception/InvalidEncodingException.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Exception/InvalidFileException.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Exception/InvalidPathException.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Exception/ValidationException.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Loader/Loader.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Loader/LoaderInterface.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Loader/Resolver.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Parser/Entry.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Parser/EntryParser.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Parser/Lexer.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Parser/Lines.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Parser/Parser.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Parser/ParserInterface.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Parser/Value.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/AdapterInterface.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/ApacheAdapter.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/EnvConstAdapter.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/GuardedWriter.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/ImmutableWriter.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiReader.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiWriter.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/PutenvAdapter.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/ReaderInterface.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/ReplacingWriter.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/ServerConstAdapter.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/Adapter/WriterInterface.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/AdapterRepository.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/RepositoryBuilder.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Repository/RepositoryInterface.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Store/File/Paths.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Store/File/Reader.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Store/FileStore.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Store/StoreBuilder.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Store/StoreInterface.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Store/StringStore.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Util/Regex.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Util/Str.php create mode 100644 Sources/vendor/vlucas/phpdotenv/src/Validator.php diff --git a/.gitignore b/.gitignore index cab49048..b67a9030 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ .idea -*.ben -*.txt node_modules dist .vscode diff --git a/Sources/composer.json b/Sources/composer.json index 72979bf7..f60dc811 100755 --- a/Sources/composer.json +++ b/Sources/composer.json @@ -3,19 +3,34 @@ "autoload": { "psr-4": { "Hearttrack\\": "src/", - "Console\\":"src/Console" + "Console\\": "src/console", + "App\\": "src/app", + "App\\Router\\": "src/app/router", + "App\\Controller\\": "src/app/controller", + "App\\Router\\Response\\" : "src/app/router/response", + "App\\Router\\Middleware\\" : "src/app/router/middleware", + "App\\Router\\Request\\" : "src/app/router/request", + "Shared\\": "src/shared/", + "Shared\\Exception\\": "src/shared/exception", + "Shared\\Attributes\\": "src/shared/attributes", + "App\\Views\\Directives\\" : "src/app/views/directives" + + } }, "require": { - "twig/twig": "^3.0" + "twig/twig": "^3.0", + "altorouter/altorouter": "1.1.0", + "vlucas/phpdotenv": "^5.5", + "psr/container": "^2.0" + }, "require-dev": { "phpunit/phpunit": "*" }, "scripts": { "dev": "php -S localhost:8080 -t public -d display_errors=1 -d error_reporting=E_ALL", - "dev:console": "export APP_ENV=console && php public/index.php" - - } - + "dev:console": "export APP_ENV=console && php public/index.php", + "dev:html" : "export APP_ENV=html && php -S localhost:8080 -t public -d display_errors=1 -d error_reporting=E_ALL" + } } diff --git a/Sources/composer.lock b/Sources/composer.lock index bfd52d0b..42ce6584 100755 --- a/Sources/composer.lock +++ b/Sources/composer.lock @@ -4,8 +4,253 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b084bad56d99d613841073027e5f5e7e", + "content-hash": "c8acec96dcc23612616eedff9886528e", "packages": [ + { + "name": "altorouter/altorouter", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/dannyvankooten/AltoRouter.git", + "reference": "09d9d946c546bae6d22a7654cdb3b825ffda54b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/09d9d946c546bae6d22a7654cdb3b825ffda54b4", + "reference": "09d9d946c546bae6d22a7654cdb3b825ffda54b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "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/master" + }, + "time": "2014-04-16T09:44:40+00:00" + }, + { + "name": "graham-campbell/result-type", + "version": "v1.1.2", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/fbd48bce38f73f8a4ec8583362e732e4095e5862", + "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "support": { + "issues": "https://github.com/GrahamCampbell/Result-Type/issues", + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2023-11-12T22:16:48+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.9.2", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/80735db690fe4fc5c76dfa7f9b770634285fa820", + "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.9.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2023-11-12T21:59:55+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, { "name": "symfony/polyfill-ctype", "version": "v1.28.0", @@ -171,28 +416,112 @@ ], "time": "2023-07-28T09:04:16+00:00" }, + { + "name": "symfony/polyfill-php80", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.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": "2023-01-26T09:26:14+00:00" + }, { "name": "twig/twig", - "version": "v3.7.1", + "version": "v3.8.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "a0ce373a0ca3bf6c64b9e3e2124aca502ba39554" + "reference": "9d15f0ac07f44dc4217883ec6ae02fd555c6f71d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/a0ce373a0ca3bf6c64b9e3e2124aca502ba39554", - "reference": "a0ce373a0ca3bf6c64b9e3e2124aca502ba39554", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/9d15f0ac07f44dc4217883ec6ae02fd555c6f71d", + "reference": "9d15f0ac07f44dc4217883ec6ae02fd555c6f71d", "shasum": "" }, "require": { "php": ">=7.2.5", "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3" + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php80": "^1.22" }, "require-dev": { "psr/container": "^1.0|^2.0", - "symfony/phpunit-bridge": "^5.4.9|^6.3" + "symfony/phpunit-bridge": "^5.4.9|^6.3|^7.0" }, "type": "library", "autoload": { @@ -228,7 +557,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.7.1" + "source": "https://github.com/twigphp/Twig/tree/v3.8.0" }, "funding": [ { @@ -240,7 +569,91 @@ "type": "tidelift" } ], - "time": "2023-08-28T11:09:02+00:00" + "time": "2023-11-21T18:54:41+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v5.6.0", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", + "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "graham-campbell/result-type": "^1.1.2", + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.2", + "symfony/polyfill-ctype": "^1.24", + "symfony/polyfill-mbstring": "^1.24", + "symfony/polyfill-php80": "^1.24" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-filter": "*", + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator." + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, + "branch-alias": { + "dev-master": "5.6-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "time": "2023-11-12T22:43:29+00:00" } ], "packages-dev": [ @@ -1928,16 +2341,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -1966,7 +2379,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -1974,7 +2387,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" } ], "aliases": [], diff --git a/Sources/config/config.php b/Sources/config/config.php index 24a01547..080b042c 100755 --- a/Sources/config/config.php +++ b/Sources/config/config.php @@ -1,16 +1,20 @@ safeLoad(); +// apenrently getEnv is not a good thing cause // const DB_HOST = $_ENV['DB_HOST'] ?? 'localhost'; // const DB_DATABASE = $_ENV['DB_DATABASE'] ?? 'heartTrack'; // const DB_USER = $_ENV['DB_USER'] ?? 'toto'; // const DB_PASSWORD = $_ENV['DB_PASSWORD'] ?? 'achanger'; -// const APP_ENV = $_ENV['APP_ENV'] ?? 'development'; -const DB_HOST ='localhost'; -const DB_DATABASE = 'heartTrack'; +define("APP_ENV", getenv('APP_ENV') ?? 'development'); + +const DB_HOST = 'localhost'; +const DB_DATABASE = 'heartTrack'; const DB_USER = 'toto'; -const DB_PASSWORD = 'achanger'; -const APP_ENV = 'development'; +const DB_PASSWORD = 'achanger'; const DSN = "mysql:host=" . DB_HOST . ";dbname=" . DB_DATABASE; diff --git a/Sources/public/index.php b/Sources/public/index.php index 0a70f945..d38ebc5b 100755 --- a/Sources/public/index.php +++ b/Sources/public/index.php @@ -1,9 +1,36 @@ registerService(IArgumentResolver::class, ArgumentControllerResolver::class); + +$appFactory->registerService(\Twig\Loader\LoaderInterface::class, function() { + return new FilesystemLoader(__DIR__ . '/../src/app/views/Templates'); +}); + +$appFactory->registerService(\Twig\Environment::class,\Twig\Environment::class); + +// Connexion à la base de données +// $databaseContext = DatabaseContext::getInstance(); + +$appFactory->AddControllers(); +$app = $appFactory->create(); +if (!is_null($app)){ + // Ajout des Middleware + /*$app->use(new LoggingMiddleware());*/ + + $app->mapControllers(); + $app->run(RequestFactory::createFromGlobals()); } + diff --git a/Sources/src/app/App.php b/Sources/src/app/App.php new file mode 100644 index 00000000..c80e71f3 --- /dev/null +++ b/Sources/src/app/App.php @@ -0,0 +1,158 @@ +appName = $appName; + $this->version = $version; + $this->container = $diContainer; + $this->router = new Router(""); + $this->frontController = new FrontController($this->router,$this->container); + } + + public function use(IHttpMiddleware $middleware) + { + if ($this->middlewarePipeline === null) { + $this->middlewarePipeline = $middleware; + } else { + // Chain the new middleware to the end of the existing pipeline + $currentMiddleware = $this->middlewarePipeline; + while ($currentMiddleware->getNext() !== null) { + $currentMiddleware = $currentMiddleware->getNext(); + } + $currentMiddleware->setNext($middleware); + } + } + + public function getAppName(): string + { + return $this->appName; + } + +/* public function twigConfigure(array $extensionClassNames = []): void + { + if (!$this->container->has(\Twig\Environment::class)) { + throw new \LogicException('You cannot use the "twigConfigure" method if the Twig Bundle is not available. Try running "composer require twig/twig".'); + } + + $twigEnvironment = $this->container->get(\Twig\Environment::class); + + if (empty($extensionClassNames)) { + $twigEnvironment->addExtension(new Navigate($this->router)); + + } else { + foreach ($extensionClassNames as $extensionClassName) { + if (class_exists($extensionClassName)) { + $extensionInstance = new $extensionClassName(); + if ($extensionInstance instanceof \Twig\Extension\ExtensionInterface) { + $twigEnvironment->addExtension($extensionInstance); + } else { + throw new \InvalidArgumentException("Class '$extensionClassName' does not implement Twig\Extension\ExtensionInterface."); + } + } else { + throw new \InvalidArgumentException("Class '$extensionClassName' does not exist."); + } + } + } + }*/ + + + + public function getVersion(): int + { + return $this->version; + } + + public function run(IRequest $request) + { + if ($this->middlewarePipeline == null) { + return $this->frontController->dispatch($request); + } + // Exécutez le middleware en utilisant le pipeline + return $this->middlewarePipeline->handle($request, function($request) { + // Logique de gestion principale de la requête ici + $this->frontController->dispatch($request); + }); + + } + + /** + * @throws \ReflectionException + */ + public function mapControllers(): void + { + $classes = $this->container->getAllRegisteredClassNames(); + + foreach ($classes as $class) { + if ($this->isController($class)) { + $this->mapControllerRoutes($class); + } + } + } + /** + * @throws \ReflectionException + */ + function mapControllerRoutes(string $controllerClass): void + { + $reflectionClass = new \ReflectionClass($controllerClass); + $attributes = $reflectionClass->getAttributes(RouteAttribute::class); + $prefix = ''; + if (!empty($attributes)) { + + $prefix = $attributes[0]->newInstance()->getPath(); + } + + foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { + + foreach ($method->getAttributes(RouteAttribute::class) as $attribute) { + + /** @var RouteAttribute $route */ + $route = $attribute->newInstance(); + + $this->router->addControllerRoute( + implode('|', $route->getMethods()), + $prefix . $route->getPath(), + $controllerClass, + $method->getName(), + $route->getName() + ); + } + } + } + + + function isController(string $class): bool + { + $reflectionClass = new \ReflectionClass($class); + return $reflectionClass->isSubclassOf(BaseController::class); + } +} + diff --git a/Sources/src/app/AppCreator.php b/Sources/src/app/AppCreator.php new file mode 100644 index 00000000..d2ac0de6 --- /dev/null +++ b/Sources/src/app/AppCreator.php @@ -0,0 +1,91 @@ +container = new Container; + } + + public function registerService(string $serviceId, callable|string $service): self + { + $this->container->set($serviceId, $service); + $this->services[] = $serviceId; + return $this; + } + + /** + * Create an instance or perform actions based on the current application environment. + * + * @return App|null An instance of the App class in the 'development' environment, or null in other environments. + */ + public function create(): ?App + { + // Check the application environment + switch (APP_ENV) { + case 'console': + // Load the Console.php file in case of the 'console' environment + require_once __DIR__ . '/../console/Console.php'; + break; + case 'development': + // Create a new instance of the App class in the 'development' environment + return new App("HeartTrack", 1, $this->container); + break; + case 'html': + // Load the index.test.php file in case of the 'html' environment + require_once __DIR__ . '/index.test.php'; + break; + default: + // Handle other environment cases here, if necessary + break; + } + return null; + } + + + + function AddControllers($namespacePrefix = 'App\Controller', $pathToControllers = __DIR__ . '/controller'): self + { + $controllerFiles = glob($pathToControllers . '/*.php'); + + foreach ($controllerFiles as $file) { + // Get class name from file name + $class = basename($file, '.php'); + $fullClassName = $namespacePrefix . '\\' . $class; + if (!class_exists($fullClassName)) { + continue; + } + + // Use reflection to check if class extends BaseController + $reflectionClass = new \ReflectionClass($fullClassName); + if ($reflectionClass->isSubclassOf(BaseController::class)) { + // Register in DI container + $this->container->set($fullClassName, function () use ($fullClassName) { + $controllerInstance = new $fullClassName(); + $controllerInstance->setContainer($this->container); + return $controllerInstance; + }); + + } + } + + return $this; + } + + public function getServiceRegistered(): array + { + return $this->services; + } +} + + diff --git a/Sources/src/app/Container.php b/Sources/src/app/Container.php new file mode 100644 index 00000000..b254271f --- /dev/null +++ b/Sources/src/app/Container.php @@ -0,0 +1,109 @@ +has($id)) { + $entry = $this->entries[$id]; + if (is_callable($entry)) { + + return $entry($this); + } + + $id = $entry; + } + + return $this->resolve($id); + } + + + public function has(string $id): bool + { + return isset($this->entries[$id]); + } + + public function set(string $id, callable|string $concrete): void + { + $this->entries[$id] = $concrete; + + } + + public function resolve(string $id) + { + // 1. Inspect the class that we are trying to get from the container + try { + $reflectionClass = new \ReflectionClass($id); + } catch (\ReflectionException $e) { + throw new \Exception($e->getMessage(), $e->getCode(), $e); + } + if (!$reflectionClass->isInstantiable()) { + throw new \Exception('Class "' . $id . '" is not instantiable'); + } + + // 2. Inspect the constructor of the class + $constructor = $reflectionClass->getConstructor(); + + if (!$constructor) { + return new $id; + } + + // 3. Inspect the constructor parameters (dependencies) + $parameters = $constructor->getParameters(); + + if (!$parameters) { + return new $id; + } + + // 4. If the constructor parameter is a class then try to resolve that class using the container + $dependencies = array_map( + function (\ReflectionParameter $param) use ($id) { + $name = $param->getName(); + $type = $param->getType(); + + // Check for a default value + if ($param->isDefaultValueAvailable()) { + return $param->getDefaultValue(); + } + + if (!$type) { + throw new \Exception( + 'Failed to resolve class "' . $id . '" because param "' . $name . '" is missing a type hint' + ); + } + + if ($type instanceof \ReflectionUnionType) { + throw new \Exception( + 'Failed to resolve class "' . $id . '" because of union type for param "' . $name . '"' + ); + } + + if ($type instanceof \ReflectionNamedType && !$type->isBuiltin()) { + return $this->get($type->getName()); + } + + throw new \Exception( + 'Failed to resolve class "' . $id . '" because invalid param "' . $name . '"' + ); + }, + $parameters + ); + + return $reflectionClass->newInstanceArgs($dependencies); + } + + public function getAllRegisteredClassNames(): array + { + return array_keys($this->entries); + } +} \ No newline at end of file diff --git a/Sources/src/app/controller/BaseController.php b/Sources/src/app/controller/BaseController.php new file mode 100644 index 00000000..5e321b07 --- /dev/null +++ b/Sources/src/app/controller/BaseController.php @@ -0,0 +1,74 @@ +container = $container; + } + + abstract public function index(): Response; + + protected function renderView(string $view, array $parameters = []): string + { + if (!$this->container->has(\Twig\Environment::class)) { + throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".'); + } + + return $this->container->get(\Twig\Environment::class)->render($view, $parameters); + } + /** + * Renders a view. + * + * If an invalid form is found in the list of parameters, a 422 status code is returned. + * Forms found in parameters are auto-cast to form views. + */ + protected function render(string $view, array $parameters = [], Response $response = null): Response + { + $content = $this->renderView($view, $parameters); + $response ??= new Response(); + + /* if (200 === $response->getStatusCode()) { + foreach ($parameters as $v) { + if ($v instanceof FormInterface && $v->isSubmitted() && !$v->isValid()) { + $response->setStatusCode(422); + break; + } + } + }*/ + + $response->setContent($content); + + return $response; + } + + protected function redirect(string $url, int $status = 302): RedirectResponse + { + return new RedirectResponse($url, $status); + } + + protected function redirectToRoute(string $route, array $parameters = [], int $status = 302): RedirectResponse + { + return $this->redirect($this->generateUrl($route, $parameters), $status); + } + + /* + * TODO : Should hanle ierror if the route is not existing + * */ + protected function generateUrl(string $route, array $parameters = []): string + { + return $this->container->get(\App\Router\Router::class)->generate($route, $parameters); + } + + +} \ No newline at end of file diff --git a/Sources/src/app/controller/Controller.php b/Sources/src/app/controller/Controller.php new file mode 100644 index 00000000..29ad5cd4 --- /dev/null +++ b/Sources/src/app/controller/Controller.php @@ -0,0 +1,141 @@ +render('./page/home.html.twig',[ + 'pp' => "test2", + 'user' => "Ladmion le Cochon", + 'role' => "Athlète", + 'friendship' => [], + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => [], + 'member' => [] + ]); + } + + #[Route(path: '/exercice', name: 'exercice', methods: ['GET'])] // 8 + public function exercice(): Response + { + return $this->render('./page/exercice.html.twig',[ + 'pp' => "test2", + 'user' => "Ladmion le Cochon", + 'role' => "Athlète", + 'friendship' => [], + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => [], + 'member' => [] + ]); + } + + #[Route(path: '/friend', name: 'friend', methods: ['GET'])] // 8 + public function friend(): Response + { + return $this->render('./page/friend.html.twig',[ + 'pp' => "test2", + 'user' => "Ladmion le Cochon", + 'role' => "Athlète", + 'friendship' => [], + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => [], + 'member' => [] + ]); + } + + #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])] // 8 + public function coaching(): Response + { + return $this->render('./page/coaching.html.twig',[ + 'pp' => "test2", + 'user' => "Ladmion le Cochon", + 'role' => "Athlète", + 'friendship' => [], + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => [], + 'member' => [] + ]); + } + + #[Route(path: '/mail', name: 'mail', methods: ['GET'])] // 8 + public function mail(): Response + { + return $this->render('./page/mail.html.twig',[ + 'pp' => "test2", + 'user' => "Ladmion le Cochon", + 'role' => "Athlète", + 'friendship' => [], + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => [], + 'member' => [] + ]); + } + + #[Route(path: '/import', name: 'import', methods: ['GET'])] // 8 + public function import(): Response + { + return $this->render('./page/import.html.twig',[ + 'pp' => "test2", + 'user' => "Ladmion le Cochon", + 'role' => "Athlète", + 'friendship' => [], + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => [], + 'member' => [] + ]); + } + + + + + #[Route(path: '/hello', name: 'hello', methods: ['GET'])] + public function hello(): Response + { + return new Response('Hello'); + } + + #[Route(path: '/hi', name: 'hi', methods: ['GET'])] + public function hi(string $name, IRequest $req): Response + { + return new Response($name); + } + +} + + + diff --git a/Sources/src/app/controller/FrontController.php b/Sources/src/app/controller/FrontController.php new file mode 100644 index 00000000..5fa64fac --- /dev/null +++ b/Sources/src/app/controller/FrontController.php @@ -0,0 +1,73 @@ +router = $router; + $this->container = $container; + + } + + public function dispatch(IRequest $request) { + try { + $match = $this->router->match($request); + if (!is_null($match)) { + $method = $match['target']; + + $controller = $this->getController($match['target']); + $callable = array($controller,$method[1]); + $request->addToBody($match['params']); + + if (!is_callable($callable)){ + throw new NotImplementedException('Controller target is not callable' .'Handle when route target is not a callable : not handle'); + } + $argumentResolver = $this->container->get(IArgumentResolver::class); + $arguments = $argumentResolver->getArguments($request, $callable); + // check role + $response = call_user_func_array($callable, $arguments); + + // should handle response properly like if it's a HTML, STING, JSON,.... + $response->send(); + } else { + $this->handleError(404, "Page not found"); + } + } catch (NotFoundHttpException $e) { + $this->handleError(404, $e->getMessage()); + } + } + + private function getController($controllerSpec) { + if (is_array($controllerSpec)) { + $controllerName = $controllerSpec[0]; + } else { + $controllerName = $controllerSpec; + } + + return $this->container->get($controllerName); + } + + // TODO : Don't work need Antoine help + private function handleError(int $statusCode, $message) : void { + if (!$this->container->has(\Twig\Environment::class)) { + throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".'); + } + + $response = new Response($this->container->get(\Twig\Environment::class)->render('./errorbase.html.twig',['title'=> $message , "nb" => $statusCode, "name" => $message, "descr" => $message ]),$statusCode); + $response->send(); + } + +} + +?> diff --git a/Sources/src/app/router/Route.php b/Sources/src/app/router/Route.php new file mode 100644 index 00000000..97727e68 --- /dev/null +++ b/Sources/src/app/router/Route.php @@ -0,0 +1,94 @@ +path = $path; + $this->callable = $callable; + $this->name = $name; + } + + /** + * Gets the name of the route. + * + * @return string|null The name of the route. + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets the name of the route. + * + * @param string|null $name The name to set. + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * Gets the callable associated with the route. + * + * @return callable The callable for this route. + */ + public function getCallable() + { + return $this->callable; + } + + /** + * Gets the path for the route. + * + * @return string The path for the route. + */ + public function getPath(): string + { + return $this->path; + } + + /** + * Sets the callable for the route. + * + * @param callable $callable The callable to set for this route. + */ + public function setCallable(callable $callable) + { + $this->callable = $callable; + } +} diff --git a/Sources/src/app/router/Router.php b/Sources/src/app/router/Router.php new file mode 100644 index 00000000..1461e7cf --- /dev/null +++ b/Sources/src/app/router/Router.php @@ -0,0 +1,116 @@ +path = $path; + $this->routes = new \AltoRouter(); + } + + /** + * Adds a new Route to the collection. + * + * @param string $method The HTTP method. + * @param Route $route The route object. + * @throws \InvalidArgumentException If method is not supported. + */ + public function add(string $method, Route $route) { + if (!in_array($method, self::$verbs)) { + throw new \InvalidArgumentException("Method not supported"); + } + $this->routes->map($method, $route->getPath(), $route->getCallable(), $route->getName()); + } + + /** + * Adds a route for a controller action. + * + * @param string $method The HTTP method. + * @param string $path The path for the route. + * @param mixed $controller The controller object. + * @param string $action The action method in the controller. + * @param string $name (Optional) The name of the route. + * @throws \InvalidArgumentException If method is not supported. + */ + public function addControllerRoute(string $method, string $path, $controller, string $action, string $name = '') { + if (!in_array($method, self::$verbs)) { + throw new \InvalidArgumentException("Method not supported"); + } + $this->routes->map($method, $path, [$controller, $action], $name); + } + + // TODO: Implement the extractParams method. + // public function extractParams(string $path) {} + + /** + * Adds a GET route. + * + * @param string $path The path for the route. + * @param callable $callable The callback function. + * @param string $name The name of the route. + */ + public function get(string $path, callable $callable, $name) { + $this->routes->map('GET', $path, $callable, $name); + } + + // Similar methods for post, put, etc. can be added here. + + /** + * Checks if the request can be processed. + * + * @param IRequest $request The request object. + * @return array|null The matched route or null if no match. + */ + public function match(IRequest $request): ?array { + return $this->routes->match($request->getRequestUri(), $request->getMethod()) ?: null; + } + + /** + * Returns all routes. + * + * @return array The array of routes. + */ + public function getRoutes() { + return []; // TODO: Implement the actual logic to return routes. + } + + + public function generate (string $routeName, array $params = array()): string + { + return $this->routes->generate($routeName,$params); + } + +} + +?> diff --git a/Sources/src/app/router/Session.php b/Sources/src/app/router/Session.php new file mode 100644 index 00000000..3c97d606 --- /dev/null +++ b/Sources/src/app/router/Session.php @@ -0,0 +1,121 @@ +startSession(); + + return self::$instance; + } + + + /** + * (Re)starts the session. + * + * @return bool TRUE if the session has been initialized, else FALSE. + **/ + + private function startSession() + { + if ( $this->sessionState == self::SESSION_NOT_STARTED ) + { + $this->sessionState = session_start(); + } + + return $this->sessionState; + } + + + /** + * Stores datas in the session. + * Example: $instance->foo = 'bar'; + * + * @param name Name of the datas. + * @param value Your datas. + * @return void + **/ + + public function __set( $name , $value ) + { + $_SESSION[$name] = $value; + } + + + /** + * Gets datas from the session. + * Example: echo $instance->foo; + * + * @param name Name of the datas to get. + * @return mixed Datas stored in session. + **/ + + public function __get( string $name ) + { + if ( isset($_SESSION[$name])) + { + return $_SESSION[$name]; + } + } + + + public function __isset( $name ) + { + return isset($_SESSION[$name]); + } + + + public function __unset( $name ) + { + unset( $_SESSION[$name] ); + } + + + /** + * Destroys the current session. + * + * @return bool TRUE is session has been deleted, else FALSE. + **/ + + public function destroy() + { + if ( $this->sessionState == self::SESSION_STARTED ) + { + $this->sessionState = !session_destroy(); + unset( $_SESSION ); + + return !$this->sessionState; + } + + return FALSE; + } +} diff --git a/Sources/src/app/router/middleware/HttpValidationMiddleware.php b/Sources/src/app/router/middleware/HttpValidationMiddleware.php new file mode 100644 index 00000000..9c03bd0e --- /dev/null +++ b/Sources/src/app/router/middleware/HttpValidationMiddleware.php @@ -0,0 +1,39 @@ +validator = $validator; + $this->rules = $rules; + } + + public function handle(IRequest $request, callable $next) { + $this->validateRequest($request); + return parent::handle($request, $next); + } + + private function validateRequest(IRequest $request) { + foreach ($this->rules as $param => $ruleSet) { + foreach ($ruleSet as $rule) { + $this->validator->rule($param, $rule['callback'], $rule['message']); + } + } + + $requestData = array_merge($request->getQueryParameters(), $request->getRequestParameters()); + $this->validator->assert($requestData); + } + +} + +// $validationRules = [ +// 'email' => [ +// ['callback' => Validator::required(), 'message' => 'Email is required.'], +// ['callback' => Validator::email(), 'message' => 'Email must be a valid email address.'] +// ], +// // Add more rules as needed +// ]; \ No newline at end of file diff --git a/Sources/src/app/router/middleware/IHttpMiddleware.php b/Sources/src/app/router/middleware/IHttpMiddleware.php new file mode 100644 index 00000000..a8e69938 --- /dev/null +++ b/Sources/src/app/router/middleware/IHttpMiddleware.php @@ -0,0 +1,9 @@ +getMethod()}, URI: {$request->getRequestUri()}\n"; + return parent::handle($request, $next); + } +} \ No newline at end of file diff --git a/Sources/src/app/router/middleware/Middleware.php b/Sources/src/app/router/middleware/Middleware.php new file mode 100644 index 00000000..5cfe8f39 --- /dev/null +++ b/Sources/src/app/router/middleware/Middleware.php @@ -0,0 +1,20 @@ +next = $nextMiddleware; + } + + public function handle(IRequest $request, callable $next) { + if ($this->next !== null) { + return $this->next->handle($request, $next); + } + return $next($request); + } +} diff --git a/Sources/src/app/router/request/ContentStrategy.php b/Sources/src/app/router/request/ContentStrategy.php new file mode 100644 index 00000000..00743dda --- /dev/null +++ b/Sources/src/app/router/request/ContentStrategy.php @@ -0,0 +1,6 @@ + JsonContentStrategy::class, + // Format... + ]; + + public static function createContentStrategy(string $contentType, string $requestMethod): ContentStrategy { + foreach (self::$strategyMap as $type => $className) { + if ($contentType === $type || in_array($requestMethod, ['PUT', 'PATCH', 'DELETE'])) { + return new $className(); + } + } + return new FormContentStrategy(); + } + + public static function registerStrategy(string $contentType, string $className): void { + self::$strategyMap[$contentType] = $className; + } +} \ No newline at end of file diff --git a/Sources/src/app/router/request/FormContentStrategy.php b/Sources/src/app/router/request/FormContentStrategy.php new file mode 100644 index 00000000..71bc92a9 --- /dev/null +++ b/Sources/src/app/router/request/FormContentStrategy.php @@ -0,0 +1,9 @@ +queryParameters = $query; + $this->requestUri = $server['REQUEST_URI'] ?? ''; + $this->method = strtoupper($server['REQUEST_METHOD'] ?? 'GET'); + $this->headers = $headers; + $this->requestParameters = $contentStrategy->getContent(); + $this->body = $body; + } + + public function getQueryParameters(): array { + return $this->queryParameters; + } + + public function getRequestParameters(): array { + return $this->requestParameters; + } + + public function getMethod(): string { + return $this->method; + } + + public function getRequestUri(): string { + return $this->requestUri; + } + + public function getHeaders(): array { + return $this->headers; + } + + public function getBody(): array{ + return $this->body; + } + public function addToBody(string|array $attributes){ + $this->body[] = $attributes; + } + +} \ No newline at end of file diff --git a/Sources/src/app/router/request/IRequest.php b/Sources/src/app/router/request/IRequest.php new file mode 100644 index 00000000..987558e1 --- /dev/null +++ b/Sources/src/app/router/request/IRequest.php @@ -0,0 +1,16 @@ + $value) { + if (substr($key, 0, 5) === 'HTTP_') { + $header = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5))))); + $headers[$header] = $value; + } + } + return $headers; + } +} \ No newline at end of file diff --git a/Sources/src/app/router/response/IResponse.php b/Sources/src/app/router/response/IResponse.php new file mode 100644 index 00000000..efb35f78 --- /dev/null +++ b/Sources/src/app/router/response/IResponse.php @@ -0,0 +1,12 @@ +url = $url; + $this->statusCode = $statusCode; + $this->headers = $headers; + $this->content = ''; + } + + public function getContent(): string + { + return $this->content; + } + + public function setContent(string $content): void + { + $this->content = $content; + } + + public function getStatusCode(): int + { + return $this->statusCode; + } + + public function setStatusCode(int $statusCode): void + { + $this->statusCode = $statusCode; + } + + public function getHeaders(): array + { + return $this->headers; + } + + public function setHeader(string $key, string $value): void + { + $this->headers[$key] = $value; + } + + public function send(): void + { + http_response_code($this->statusCode); + + foreach ($this->headers as $name => $value) { + header("$name: $value"); + } + + header("Location: " . $this->url); + + // Optionally echo content if any + echo $this->content; + + exit(); + } +} diff --git a/Sources/src/app/router/response/Response.php b/Sources/src/app/router/response/Response.php new file mode 100644 index 00000000..e3c364ac --- /dev/null +++ b/Sources/src/app/router/response/Response.php @@ -0,0 +1,49 @@ +content = $content; + $this->statusCode = $statusCode; + $this->headers = $headers; + } + + public function getContent(): string { + return $this->content; + } + + public function setContent(string $content): void { + $this->content = $content; + } + + public function getStatusCode(): int { + return $this->statusCode; + } + + public function setStatusCode(int $statusCode): void { + $this->statusCode = $statusCode; + } + + public function getHeaders(): array { + return $this->headers; + } + + public function setHeader(string $key, string $value): void { + $this->headers[$key] = $value; + } + + public function send(): void { + foreach ($this->headers as $key => $value) { + header("{$key}: {$value}"); + } + http_response_code($this->statusCode); + echo $this->content; + } +} + + +?> \ No newline at end of file diff --git a/Sources/src/app/views/Templates/base.html.twig b/Sources/src/app/views/Templates/base.html.twig index d80861c7..6b72d411 100755 --- a/Sources/src/app/views/Templates/base.html.twig +++ b/Sources/src/app/views/Templates/base.html.twig @@ -46,12 +46,12 @@