From be905abfd42e0d51a1288d051e6e5761c86af562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Fri, 7 Apr 2023 20:01:54 +0200 Subject: [PATCH] MAPG-243 use soko-web framework --- .env.example | 1 + composer.json | 14 +- composer.lock | 2358 +++-------------- .../data/20200612_2124_map_area.php | 6 +- .../data/20200614_1328_user_confirmation.php | 6 +- main.php | 10 +- mapg | 2 +- public/index.php | 10 +- src/Cli/AddUserCommand.php | 2 +- src/Cli/LinkViewCommand.php | 2 +- src/Cli/MaintainDatabaseCommand.php | 8 +- src/Cli/MigrateDatabaseCommand.php | 6 +- src/Controller/GameController.php | 20 +- src/Controller/GameFlowController.php | 10 +- src/Controller/HomeController.php | 10 +- src/Controller/LoginController.php | 24 +- src/Controller/MapAdminController.php | 14 +- src/Controller/MapsController.php | 14 +- src/Controller/UserController.php | 23 +- src/Database/Mysql/Connection.php | 114 - src/Database/Mysql/ResultSet.php | 62 - src/Database/Mysql/Statement.php | 79 - src/Database/Query/Modify.php | 140 - src/Database/Query/Select.php | 445 ---- src/Database/RawExpression.php | 16 - src/Database/Utils.php | 8 - src/Http/Request.php | 102 - src/Http/Response.php | 26 - src/Interfaces/Authentication/IUser.php | 16 - src/Interfaces/Authorization/ISecured.php | 6 - src/Interfaces/Database/IConnection.php | 20 - src/Interfaces/Database/IResultSet.php | 16 - src/Interfaces/Database/IStatement.php | 8 - src/Interfaces/Http/IRequest.php | 18 - src/Interfaces/Http/IResponse.php | 8 - src/Interfaces/Request/IRequest.php | 20 - src/Interfaces/Request/ISession.php | 12 - src/Interfaces/Response/IContent.php | 12 - src/Interfaces/Response/IRedirect.php | 12 - src/Interfaces/Session/ISessionHandler.php | 9 - src/Mailing/Mail.php | 87 - src/OAuth/GoogleOAuth.php | 56 - src/PersistentData/Model/Challenge.php | 1 + src/PersistentData/Model/Guess.php | 1 + src/PersistentData/Model/Map.php | 1 + src/PersistentData/Model/Model.php | 69 - src/PersistentData/Model/MultiRoom.php | 1 + src/PersistentData/Model/Place.php | 5 +- src/PersistentData/Model/PlaceInChallenge.php | 2 + src/PersistentData/Model/User.php | 3 +- src/PersistentData/Model/UserConfirmation.php | 1 + src/PersistentData/Model/UserInChallenge.php | 2 + .../Model/UserPasswordResetter.php | 1 + src/PersistentData/Model/UserPlayedPlace.php | 1 + src/PersistentData/PersistentDataManager.php | 235 -- src/Repository/ChallengeRepository.php | 8 +- src/Repository/GuessRepository.php | 7 +- src/Repository/MapRepository.php | 4 +- src/Repository/MultiRoomRepository.php | 4 +- src/Repository/PlaceInChallengeRepository.php | 5 +- src/Repository/PlaceRepository.php | 8 +- src/Repository/UserConfirmationRepository.php | 4 +- src/Repository/UserInChallengeRepository.php | 4 +- .../UserPasswordResetterRepository.php | 4 +- src/Repository/UserPlayedPlaceRepository.php | 5 +- src/Repository/UserRepository.php | 7 +- src/Request/Request.php | 93 - src/Request/Session.php | 37 - src/Response/ContentBase.php | 22 - src/Response/HtmlContent.php | 34 - src/Response/JsonContent.php | 22 - src/Response/Redirect.php | 41 - src/Routing/Route.php | 73 - src/Routing/RouteCollection.php | 88 - src/Session/DatabaseSessionHandler.php | 104 - src/Util/CaptchaValidator.php | 19 - src/Util/JwtParser.php | 33 - src/View/Linker.php | 152 -- src/View/ParsedFragment.php | 48 - src/View/Parser.php | 159 -- tests/OAuth/GoogleOAuthTest.php | 86 - tests/PersistentData/Model/ModelTest.php | 93 - tests/Util/JwtParserTest.php | 51 - tests/View/ParserTest.php | 144 - web.php | 28 +- 85 files changed, 587 insertions(+), 4955 deletions(-) delete mode 100644 src/Database/Mysql/Connection.php delete mode 100644 src/Database/Mysql/ResultSet.php delete mode 100644 src/Database/Mysql/Statement.php delete mode 100755 src/Database/Query/Modify.php delete mode 100644 src/Database/Query/Select.php delete mode 100644 src/Database/RawExpression.php delete mode 100644 src/Database/Utils.php delete mode 100644 src/Http/Request.php delete mode 100644 src/Http/Response.php delete mode 100644 src/Interfaces/Authentication/IUser.php delete mode 100644 src/Interfaces/Authorization/ISecured.php delete mode 100644 src/Interfaces/Database/IConnection.php delete mode 100644 src/Interfaces/Database/IResultSet.php delete mode 100644 src/Interfaces/Database/IStatement.php delete mode 100644 src/Interfaces/Http/IRequest.php delete mode 100644 src/Interfaces/Http/IResponse.php delete mode 100644 src/Interfaces/Request/IRequest.php delete mode 100644 src/Interfaces/Request/ISession.php delete mode 100644 src/Interfaces/Response/IContent.php delete mode 100644 src/Interfaces/Response/IRedirect.php delete mode 100644 src/Interfaces/Session/ISessionHandler.php delete mode 100644 src/Mailing/Mail.php delete mode 100644 src/OAuth/GoogleOAuth.php delete mode 100644 src/PersistentData/Model/Model.php delete mode 100644 src/PersistentData/PersistentDataManager.php delete mode 100644 src/Request/Request.php delete mode 100644 src/Request/Session.php delete mode 100644 src/Response/ContentBase.php delete mode 100644 src/Response/HtmlContent.php delete mode 100644 src/Response/JsonContent.php delete mode 100644 src/Response/Redirect.php delete mode 100644 src/Routing/Route.php delete mode 100644 src/Routing/RouteCollection.php delete mode 100644 src/Session/DatabaseSessionHandler.php delete mode 100644 src/Util/CaptchaValidator.php delete mode 100644 src/Util/JwtParser.php delete mode 100644 src/View/Linker.php delete mode 100644 src/View/ParsedFragment.php delete mode 100644 src/View/Parser.php delete mode 100644 tests/OAuth/GoogleOAuthTest.php delete mode 100644 tests/PersistentData/Model/ModelTest.php delete mode 100644 tests/Util/JwtParserTest.php delete mode 100644 tests/View/ParserTest.php diff --git a/.env.example b/.env.example index ee070c8..3b6ecd4 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ APP_NAME=MapGuesser +APP_URL=mapguesser.dev DEV=1 DB_HOST=mariadb DB_USER=mapguesser diff --git a/composer.json b/composer.json index 752c079..801c89f 100644 --- a/composer.json +++ b/composer.json @@ -3,16 +3,16 @@ "type": "project", "description": "MapGuesser Application", "license": "GNU GPL 3.0", + "repositories": [ + { + "url": "https://git.esoko.eu/esoko/soko-web.git", + "type": "git" + } + ], "require": { - "vlucas/phpdotenv": "^4.1", - "symfony/console": "^5.1", - "phpmailer/phpmailer": "^6.1", + "esoko/soko-web": "0.1", "fzaninotto/faker": "^1.9" }, - "require-dev": { - "phpunit/phpunit": "^9", - "phpstan/phpstan": "^0.12.32" - }, "autoload": { "psr-4": { "MapGuesser\\": "src" diff --git a/composer.lock b/composer.lock index c736b8e..66fea5f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,37 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b71c0ffc0761a6b90f6242346b735a09", + "content-hash": "7e8a0b8c5d6e36cdb73339ba6635876f", "packages": [ + { + "name": "esoko/soko-web", + "version": "v0.1", + "source": { + "type": "git", + "url": "https://git.esoko.eu/esoko/soko-web.git", + "reference": "a17a88e9d44e42cef3d996fc66b4dd1134b85def" + }, + "require": { + "phpmailer/phpmailer": "^6.8", + "symfony/console": "^5.4", + "vlucas/phpdotenv": "^5.5" + }, + "require-dev": { + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "SokoWeb\\": "src" + } + }, + "license": [ + "GNU GPL 3.0" + ], + "description": "Lightweight web framework", + "time": "2023-04-07T17:32:15+00:00" + }, { "name": "fzaninotto/faker", "version": "v1.9.2", @@ -62,36 +91,106 @@ "time": "2020-12-11T09:56:16+00:00" }, { - "name": "phpmailer/phpmailer", - "version": "v6.1.6", + "name": "graham-campbell/result-type", + "version": "v1.1.1", "source": { "type": "git", - "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3" + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "672eff8cf1d6fe1ef09ca0f89c4b287d6a3eb831" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3", - "reference": "c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/672eff8cf1d6fe1ef09ca0f89c4b287d6a3eb831", + "reference": "672eff8cf1d6fe1ef09ca0f89c4b287d6a3eb831", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.32 || ^9.6.3 || ^10.0.12" + }, + "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.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2023-02-25T20:23:15+00:00" + }, + { + "name": "phpmailer/phpmailer", + "version": "v6.8.0", + "source": { + "type": "git", + "url": "https://github.com/PHPMailer/PHPMailer.git", + "reference": "df16b615e371d81fb79e506277faea67a1be18f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/df16b615e371d81fb79e506277faea67a1be18f1", + "reference": "df16b615e371d81fb79e506277faea67a1be18f1", "shasum": "" }, "require": { "ext-ctype": "*", "ext-filter": "*", + "ext-hash": "*", "php": ">=5.5.0" }, "require-dev": { - "doctrine/annotations": "^1.2", - "friendsofphp/php-cs-fixer": "^2.2", - "phpunit/phpunit": "^4.8 || ^5.7" + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", + "doctrine/annotations": "^1.2.6 || ^1.13.3", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcompatibility/php-compatibility": "^9.3.5", + "roave/security-advisories": "dev-latest", + "squizlabs/php_codesniffer": "^3.7.1", + "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { - "ext-mbstring": "Needed to send email in multibyte encoding charset", + "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", + "ext-openssl": "Needed for secure SMTP sending and DKIM signing", + "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", - "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", - "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" + "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", + "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" }, "type": "library", "autoload": { @@ -121,39 +220,47 @@ } ], "description": "PHPMailer is a full-featured email creation and transfer class for PHP", + "support": { + "issues": "https://github.com/PHPMailer/PHPMailer/issues", + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.0" + }, "funding": [ { - "url": "https://github.com/synchro", + "url": "https://github.com/Synchro", "type": "github" } ], - "time": "2020-05-27T12:24:03+00:00" + "time": "2023-03-06T14:43:22+00:00" }, { "name": "phpoption/phpoption", - "version": "1.7.3", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "4acfd6a4b33a509d8c88f50e5222f734b6aeebae" + "reference": "dd3a383e599f49777d8b628dadbb90cae435b87e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/4acfd6a4b33a509d8c88f50e5222f734b6aeebae", - "reference": "4acfd6a4b33a509d8c88f50e5222f734b6aeebae", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/dd3a383e599f49777d8b628dadbb90cae435b87e", + "reference": "dd3a383e599f49777d8b628dadbb90cae435b87e", "shasum": "" }, "require": { - "php": "^5.5.9 || ^7.0 || ^8.0" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.3", - "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.32 || ^9.6.3 || ^10.0.12" }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -168,11 +275,13 @@ "authors": [ { "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com" + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" }, { "name": "Graham Campbell", - "email": "graham@alt-three.com" + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" } ], "description": "Option Type for PHP", @@ -182,31 +291,40 @@ "php", "type" ], - "time": "2020-03-21T18:07:53+00:00" + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.9.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2023-02-25T19:38:58+00:00" }, { "name": "psr/container", - "version": "1.0.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.4.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -219,7 +337,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common Container Interface (PHP FIG PSR-11)", @@ -231,31 +349,37 @@ "container-interop", "psr" ], - "time": "2017-02-14T16:28:37+00:00" + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" }, { "name": "symfony/console", - "version": "v5.1.0", + "version": "v5.4.22", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "00bed125812716d09b163f0727ef33bb49bf3448" + "reference": "3cd51fd2e6c461ca678f84d419461281bd87a0a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/00bed125812716d09b163f0727ef33bb49bf3448", - "reference": "00bed125812716d09b163f0727ef33bb49bf3448", + "url": "https://api.github.com/repos/symfony/console/zipball/3cd51fd2e6c461ca678f84d419461281bd87a0a8", + "reference": "3cd51fd2e6c461ca678f84d419461281bd87a0a8", "shasum": "" }, "require": { "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", "symfony/dotenv": "<5.1", "symfony/event-dispatcher": "<4.4", @@ -263,16 +387,16 @@ "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -281,11 +405,6 @@ "symfony/process": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -308,8 +427,17 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.22" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -324,24 +452,94 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:35:19+00:00" + "time": "2023-03-25T09:27:28+00:00" }, { - "name": "symfony/polyfill-ctype", - "version": "v1.17.0", + "name": "symfony/deprecation-contracts", + "version": "v2.5.2", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.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/v2.5.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" @@ -349,16 +547,20 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -382,6 +584,9 @@ "polyfill", "portable" ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -396,24 +601,24 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:14:59+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.17.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "e094b0770f7833fdf257e6ba4775be4e258230b2" + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/e094b0770f7833fdf257e6ba4775be4e258230b2", - "reference": "e094b0770f7833fdf257e6ba4775be4e258230b2", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-intl": "For best performance" @@ -421,16 +626,20 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -456,6 +665,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -470,24 +682,24 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:47:27+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.17.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "1357b1d168eb7f68ad6a134838e46b0b159444a9" + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/1357b1d168eb7f68ad6a134838e46b0b159444a9", - "reference": "1357b1d168eb7f68ad6a134838e46b0b159444a9", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-intl": "For best performance" @@ -495,16 +707,20 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -533,6 +749,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -547,24 +766,27 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:14:59+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.17.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" }, "suggest": { "ext-mbstring": "For best performance" @@ -572,16 +794,20 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -606,6 +832,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -620,38 +849,42 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:47:27+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.17.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "a760d8964ff79ab9bf057613a5808284ec852ccc" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a760d8964ff79ab9bf057613a5808284ec852ccc", - "reference": "a760d8964ff79ab9bf057613a5808284ec852ccc", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -678,6 +911,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -692,38 +928,42 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:47:27+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.17.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "5e30b2799bc1ad68f7feb62b60a73743589438dd" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/5e30b2799bc1ad68f7feb62b60a73743589438dd", - "reference": "5e30b2799bc1ad68f7feb62b60a73743589438dd", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { - "php": ">=7.0.8" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -754,6 +994,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -768,25 +1011,29 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:47:27+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.1.2", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "66a8f0957a3ca54e4f724e49028ab19d75a8918b" + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/66a8f0957a3ca54e4f724e49028ab19d75a8918b", - "reference": "66a8f0957a3ca54e4f724e49028ab19d75a8918b", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.0" + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -794,7 +1041,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -826,6 +1077,9 @@ "interoperability", "standards" ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -840,20 +1094,20 @@ "type": "tidelift" } ], - "time": "2020-05-20T17:43:50+00:00" + "time": "2022-05-30T19:17:29+00:00" }, { "name": "symfony/string", - "version": "v5.1.0", + "version": "v5.4.22", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "90c2a5103f07feb19069379f3abdcdbacc7753a9" + "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/90c2a5103f07feb19069379f3abdcdbacc7753a9", - "reference": "90c2a5103f07feb19069379f3abdcdbacc7753a9", + "url": "https://api.github.com/repos/symfony/string/zipball/8036a4c76c0dd29e60b6a7cafcacc50cf088ea62", + "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62", "shasum": "" }, "require": { @@ -864,25 +1118,23 @@ "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "~1.15" }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -901,7 +1153,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony String component", + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", "homepage": "https://symfony.com", "keywords": [ "grapheme", @@ -911,6 +1163,9 @@ "utf-8", "utf8" ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.4.22" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -925,41 +1180,47 @@ "type": "tidelift" } ], - "time": "2020-05-20T17:43:50+00:00" + "time": "2023-03-14T06:11:53+00:00" }, { "name": "vlucas/phpdotenv", - "version": "v4.1.5", + "version": "v5.5.0", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "539bb6927c101a5605d31d11a2d17185a2ce2bf1" + "reference": "1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/539bb6927c101a5605d31d11a2d17185a2ce2bf1", - "reference": "539bb6927c101a5605d31d11a2d17185a2ce2bf1", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7", + "reference": "1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7", "shasum": "" }, "require": { - "php": "^5.5.9 || ^7.0 || ^8.0", - "phpoption/phpoption": "^1.7.2", - "symfony/polyfill-ctype": "^1.9" + "ext-pcre": "*", + "graham-campbell/result-type": "^1.0.2", + "php": "^7.1.3 || ^8.0", + "phpoption/phpoption": "^1.8", + "symfony/polyfill-ctype": "^1.23", + "symfony/polyfill-mbstring": "^1.23.1", + "symfony/polyfill-php80": "^1.23.1" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.3", + "bamarni/composer-bin-plugin": "^1.4.1", "ext-filter": "*", - "ext-pcre": "*", - "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^7.5.20 || ^8.5.30 || ^9.5.25" }, "suggest": { - "ext-filter": "Required to use the boolean validator.", - "ext-pcre": "Required to use most of the library." + "ext-filter": "Required to use the boolean validator." }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "5.5-dev" } }, "autoload": { @@ -974,13 +1235,13 @@ "authors": [ { "name": "Graham Campbell", - "email": "graham@alt-three.com", - "homepage": "https://gjcampbell.co.uk/" + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" }, { "name": "Vance Lucas", "email": "vance@vancelucas.com", - "homepage": "https://vancelucas.com/" + "homepage": "https://github.com/vlucas" } ], "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", @@ -989,6 +1250,10 @@ "env", "environment" ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v5.5.0" + }, "funding": [ { "url": "https://github.com/GrahamCampbell", @@ -999,1765 +1264,10 @@ "type": "tidelift" } ], - "time": "2020-05-02T14:08:57+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.3.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2020-05-29T17:27:14+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.9.5", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2020-01-17T21:11:47+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", - "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2020-04-27T09:25:28+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "shasum": "" - }, - "require": { - "ext-filter": "^7.1", - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1" - }, - "require-dev": { - "doctrine/instantiator": "^1", - "mockery/mockery": "^1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-22T12:28:44+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "30441f2752e493c639526b215ed81d54f369d693" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30441f2752e493c639526b215ed81d54f369d693", - "reference": "30441f2752e493c639526b215ed81d54f369d693", - "shasum": "" - }, - "require": { - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "^7.2", - "mockery/mockery": "~1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-06-19T20:22:09+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.10.3", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "451c3cd1418cf640de218914901e51b064abb093" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", - "reference": "451c3cd1418cf640de218914901e51b064abb093", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2020-03-05T15:02:03+00:00" - }, - { - "name": "phpstan/phpstan", - "version": "0.12.32", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "d03863f504c8432b3de4d1881f73f6acb8c0e67c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d03863f504c8432b3de4d1881f73f6acb8c0e67c", - "reference": "d03863f504c8432b3de4d1881f73f6acb8c0e67c", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "conflict": { - "phpstan/phpstan-shim": "*" - }, - "bin": [ - "phpstan", - "phpstan.phar" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.12-dev" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" - } - ], - "time": "2020-07-01T11:57:52+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "8.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca6647ffddd2add025ab3f21644a441d7c146cdc", - "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.3", - "phpunit/php-file-iterator": "^3.0", - "phpunit/php-text-template": "^2.0", - "phpunit/php-token-stream": "^4.0", - "sebastian/code-unit-reverse-lookup": "^2.0", - "sebastian/environment": "^5.0", - "sebastian/version": "^3.0", - "theseer/tokenizer": "^1.1.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-05-23T08:02:54+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "eba15e538f2bb3fe018b7bbb47d2fe32d404bfd2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/eba15e538f2bb3fe018b7bbb47d2fe32d404bfd2", - "reference": "eba15e538f2bb3fe018b7bbb47d2fe32d404bfd2", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T12:54:35+00:00" - }, - { - "name": "phpunit/php-invoker", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "62f696ad0d140e0e513e69eaafdebb674d622b4c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/62f696ad0d140e0e513e69eaafdebb674d622b4c", - "reference": "62f696ad0d140e0e513e69eaafdebb674d622b4c", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^9.0" - }, - "suggest": { - "ext-pcntl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T13:10:07+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "0c69cbf965d5317ba33f24a352539f354a25db09" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c69cbf965d5317ba33f24a352539f354a25db09", - "reference": "0c69cbf965d5317ba33f24a352539f354a25db09", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T12:52:43+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "5.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "b0d089de001ba60ffa3be36b23e1b8150d072238" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/b0d089de001ba60ffa3be36b23e1b8150d072238", - "reference": "b0d089de001ba60ffa3be36b23e1b8150d072238", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-07T12:05:53+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "4.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e61c593e9734b47ef462340c24fca8d6a57da14e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e61c593e9734b47ef462340c24fca8d6a57da14e", - "reference": "e61c593e9734b47ef462340c24fca8d6a57da14e", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-16T07:00:44+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "9.2.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ad7cc5ec3ab2597b329880e30442d9054526023b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ad7cc5ec3ab2597b329880e30442d9054526023b", - "reference": "ad7cc5ec3ab2597b329880e30442d9054526023b", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2.0", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.9.1", - "phar-io/manifest": "^1.0.3", - "phar-io/version": "^2.0.1", - "php": "^7.3", - "phpspec/prophecy": "^1.8.1", - "phpunit/php-code-coverage": "^8.0.1", - "phpunit/php-file-iterator": "^3.0", - "phpunit/php-invoker": "^3.0", - "phpunit/php-text-template": "^2.0", - "phpunit/php-timer": "^5.0", - "sebastian/code-unit": "^1.0.2", - "sebastian/comparator": "^4.0", - "sebastian/diff": "^4.0", - "sebastian/environment": "^5.0.1", - "sebastian/exporter": "^4.0", - "sebastian/global-state": "^4.0", - "sebastian/object-enumerator": "^4.0", - "sebastian/resource-operations": "^3.0", - "sebastian/type": "^2.1", - "sebastian/version": "^3.0" - }, - "require-dev": { - "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ], - "files": [ - "src/Framework/Assert/Functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "funding": [ - { - "url": "https://phpunit.de/donate.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-22T07:10:55+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "d650ef9b1fece15ed4d6eaed6e6b469b7b81183a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/d650ef9b1fece15ed4d6eaed6e6b469b7b81183a", - "reference": "d650ef9b1fece15ed4d6eaed6e6b469b7b81183a", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T13:11:26+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "c771130f0e8669104a4320b7101a81c2cc2963ef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c771130f0e8669104a4320b7101a81c2cc2963ef", - "reference": "c771130f0e8669104a4320b7101a81c2cc2963ef", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T12:56:39+00:00" - }, - { - "name": "sebastian/comparator", - "version": "4.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "266d85ef789da8c41f06af4093c43e9798af2784" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/266d85ef789da8c41f06af4093c43e9798af2784", - "reference": "266d85ef789da8c41f06af4093c43e9798af2784", - "shasum": "" - }, - "require": { - "php": "^7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T15:04:48+00:00" - }, - { - "name": "sebastian/diff", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3e523c576f29dacecff309f35e4cc5a5c168e78a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3e523c576f29dacecff309f35e4cc5a5c168e78a", - "reference": "3e523c576f29dacecff309f35e4cc5a5c168e78a", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0", - "symfony/process": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-05-08T05:01:12+00:00" - }, - { - "name": "sebastian/environment", - "version": "5.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "16eb0fa43e29c33d7f2117ed23072e26fc5ab34e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/16eb0fa43e29c33d7f2117ed23072e26fc5ab34e", - "reference": "16eb0fa43e29c33d7f2117ed23072e26fc5ab34e", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T13:00:01+00:00" - }, - { - "name": "sebastian/exporter", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d12fbca85da932d01d941b59e4b71a0d559db091" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d12fbca85da932d01d941b59e4b71a0d559db091", - "reference": "d12fbca85da932d01d941b59e4b71a0d559db091", - "shasum": "" - }, - "require": { - "php": "^7.3", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T13:12:44+00:00" - }, - { - "name": "sebastian/global-state", - "version": "4.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bdb1e7c79e592b8c82cb1699be3c8743119b8a72", - "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72", - "shasum": "" - }, - "require": { - "php": "^7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^9.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2020-02-07T06:11:37+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "15f319d67c49fc55ebcdbffb3377433125588455" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/15f319d67c49fc55ebcdbffb3377433125588455", - "reference": "15f319d67c49fc55ebcdbffb3377433125588455", - "shasum": "" - }, - "require": { - "php": "^7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T13:15:25+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "14e04b3c25b821cc0702d4837803fe497680b062" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/14e04b3c25b821cc0702d4837803fe497680b062", - "reference": "14e04b3c25b821cc0702d4837803fe497680b062", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T13:08:02+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "a32789e5f0157c10cf216ce6c5136db12a12b847" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/a32789e5f0157c10cf216ce6c5136db12a12b847", - "reference": "a32789e5f0157c10cf216ce6c5136db12a12b847", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T13:06:44+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "71421c1745788de4facae1b79af923650bd3ec15" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/71421c1745788de4facae1b79af923650bd3ec15", - "reference": "71421c1745788de4facae1b79af923650bd3ec15", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-15T13:17:14+00:00" - }, - { - "name": "sebastian/type", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "bad49207c6f854e7a25cef0ea948ac8ebe3ef9d8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/bad49207c6f854e7a25cef0ea948ac8ebe3ef9d8", - "reference": "bad49207c6f854e7a25cef0ea948ac8ebe3ef9d8", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-01T12:21:09+00:00" - }, - { - "name": "sebastian/version", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "0411bde656dce64202b39c2f4473993a9081d39e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/0411bde656dce64202b39c2f4473993a9081d39e", - "reference": "0411bde656dce64202b39c2f4473993a9081d39e", - "shasum": "" - }, - "require": { - "php": "^7.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2020-01-21T06:36:37+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-06-13T22:48:21+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.9.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" - }, - "type": "library", - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2020-06-16T10:16:42+00:00" + "time": "2022-10-16T01:01:54+00:00" } ], + "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": [], @@ -2765,5 +1275,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.3.0" } diff --git a/database/migrations/data/20200612_2124_map_area.php b/database/migrations/data/20200612_2124_map_area.php index dae5e11..98f35ef 100644 --- a/database/migrations/data/20200612_2124_map_area.php +++ b/database/migrations/data/20200612_2124_map_area.php @@ -1,8 +1,8 @@ columns(['id']); diff --git a/main.php b/main.php index fbf78d9..f3a2309 100644 --- a/main.php +++ b/main.php @@ -14,10 +14,10 @@ $dotenv->load(); class Container { - static MapGuesser\Interfaces\Database\IConnection $dbConnection; - static MapGuesser\Routing\RouteCollection $routeCollection; - static MapGuesser\Interfaces\Session\ISessionHandler $sessionHandler; - static MapGuesser\Interfaces\Request\IRequest $request; + static SokoWeb\Interfaces\Database\IConnection $dbConnection; + static SokoWeb\Routing\RouteCollection $routeCollection; + static SokoWeb\Interfaces\Session\ISessionHandler $sessionHandler; + static SokoWeb\Interfaces\Request\IRequest $request; } -Container::$dbConnection = new MapGuesser\Database\Mysql\Connection($_ENV['DB_HOST'], $_ENV['DB_USER'], $_ENV['DB_PASSWORD'], $_ENV['DB_NAME']); +Container::$dbConnection = new SokoWeb\Database\Mysql\Connection($_ENV['DB_HOST'], $_ENV['DB_USER'], $_ENV['DB_PASSWORD'], $_ENV['DB_NAME']); diff --git a/mapg b/mapg index 65ffefd..503b535 100755 --- a/mapg +++ b/mapg @@ -8,6 +8,6 @@ $app = new Symfony\Component\Console\Application('MapGuesser Console', ''); $app->add(new MapGuesser\Cli\MigrateDatabaseCommand()); $app->add(new MapGuesser\Cli\AddUserCommand()); $app->add(new MapGuesser\Cli\LinkViewCommand()); -$app->add(new \MapGuesser\Cli\MaintainDatabaseCommand()); +$app->add(new MapGuesser\Cli\MaintainDatabaseCommand()); $app->run(); diff --git a/public/index.php b/public/index.php index e58da6f..d48250f 100644 --- a/public/index.php +++ b/public/index.php @@ -19,14 +19,14 @@ if ($match !== null) { $handler = $route->getHandler(); $controller = new $handler[0](Container::$request); - if ($controller instanceof MapGuesser\Interfaces\Authorization\ISecured) { + if ($controller instanceof SokoWeb\Interfaces\Authorization\ISecured) { $authorized = $controller->authorize(); } else { $authorized = true; } if ($method === 'post' && Container::$request->post('anti_csrf_token') !== Container::$request->session()->get('anti_csrf_token')) { - $content = new MapGuesser\Response\JsonContent(['error' => 'no_valid_anti_csrf_token']); + $content = new SokoWeb\Response\JsonContent(['error' => 'no_valid_anti_csrf_token']); header('Content-Type: text/html; charset=UTF-8', true, 403); $content->render(); return; @@ -35,12 +35,12 @@ if ($match !== null) { if ($authorized) { $response = call_user_func([$controller, $handler[1]]); - if ($response instanceof MapGuesser\Interfaces\Response\IContent) { + if ($response instanceof SokoWeb\Interfaces\Response\IContent) { header('Content-Type: ' . $response->getContentType() . '; charset=UTF-8'); $response->render(); return; - } elseif ($response instanceof MapGuesser\Interfaces\Response\IRedirect) { + } elseif ($response instanceof SokoWeb\Interfaces\Response\IRedirect) { header('Location: ' . $response->getUrl(), true, $response->getHttpCode()); return; @@ -48,6 +48,6 @@ if ($match !== null) { } } -$content = new MapGuesser\Response\HtmlContent('error/404'); +$content = new SokoWeb\Response\HtmlContent('error/404'); header('Content-Type: text/html; charset=UTF-8', true, 404); $content->render(); diff --git a/src/Cli/AddUserCommand.php b/src/Cli/AddUserCommand.php index b63a0d2..8e6036f 100644 --- a/src/Cli/AddUserCommand.php +++ b/src/Cli/AddUserCommand.php @@ -1,7 +1,7 @@ request->query('challengeToken'); return new HtmlContent('game', ['challengeToken' => $challengeToken]); @@ -120,7 +120,7 @@ class GameController implements ISecured $challenge = new Challenge(); $challenge->setToken($challengeToken); $challenge->setCreatedDate(new DateTime()); - + if ($this->request->post('timerEnabled') !== null && $this->request->post('timeLimit') !== null) { $challenge->setTimeLimit($this->request->post('timeLimit')); } diff --git a/src/Controller/GameFlowController.php b/src/Controller/GameFlowController.php index 3f4c586..48e4dd2 100644 --- a/src/Controller/GameFlowController.php +++ b/src/Controller/GameFlowController.php @@ -1,13 +1,13 @@ connection = new mysqli($host, $user, $password, $db, $port, $socket); - - if ($this->connection->connect_error) { - throw new \Exception('Connection failed: ' . $this->connection->connect_error); - } - - if (!$this->connection->set_charset('utf8mb4')) { - throw new \Exception($this->connection->error); - } - } - - public function __destruct() - { - $this->connection->close(); - } - - public function startTransaction(): void - { - if (!$this->connection->autocommit(false)) { - throw new \Exception($this->connection->error); - } - } - - public function commit(): void - { - if (!$this->connection->commit() || !$this->connection->autocommit(true)) { - throw new \Exception($this->connection->error); - } - } - - public function rollback(): void - { - if (!$this->connection->rollback() || !$this->connection->autocommit(true)) { - throw new \Exception($this->connection->error); - } - } - - public function query(string $query): ?IResultSet - { - if (!($result = $this->connection->query($query))) { - throw new \Exception($this->connection->error . '. Query: ' . $query); - } - - if ($result !== true) { - return new ResultSet($result); - } - - return null; - } - - public function multiQuery(string $query): array - { - if (!$this->connection->multi_query($query)) { - throw new \Exception($this->connection->error . '. Query: ' . $query); - } - - $ret = []; - do { - if ($result = $this->connection->store_result()) { - $ret[] = new ResultSet($result); - } else { - $ret[] = null; - } - - $this->connection->more_results(); - } while ($this->connection->next_result()); - - if ($this->connection->error) { - throw new \Exception($this->connection->error . '. Query: ' . $query); - } - - return $ret; - } - - public function prepare(string $query): IStatement - { - if (!($stmt = $this->connection->prepare($query))) { - throw new \Exception($this->connection->error . '. Query: ' . $query); - } - - return new Statement($stmt); - } - - public function lastId(): int - { - return $this->connection->insert_id; - } - - public function getAffectedRows(): int - { - return $this->connection->affected_rows; - } -} diff --git a/src/Database/Mysql/ResultSet.php b/src/Database/Mysql/ResultSet.php deleted file mode 100644 index adb7288..0000000 --- a/src/Database/Mysql/ResultSet.php +++ /dev/null @@ -1,62 +0,0 @@ -result = $result; - } - - public function fetch(int $type = IResultSet::FETCH_ASSOC): ?array - { - return $this->result->fetch_array($this->convertFetchType($type)); - } - - public function fetchAll(int $type = IResultSet::FETCH_ASSOC): array - { - return $this->result->fetch_all($this->convertFetchType($type)); - } - - public function fetchOneColumn(string $valueName, string $keyName = null): array - { - $array = []; - - while ($r = $this->fetch(IResultSet::FETCH_ASSOC)) { - if (isset($keyName)) { - $array[$r[$keyName]] = $r[$valueName]; - } else { - $array[] = $r[$valueName]; - } - } - - return $array; - } - - private function convertFetchType(int $type): int - { - switch ($type) { - case IResultSet::FETCH_ASSOC: - $internal_type = MYSQLI_ASSOC; - break; - - case IResultSet::FETCH_BOTH: - $internal_type = MYSQLI_BOTH; - break; - - case IResultSet::FETCH_NUM: - $internal_type = MYSQLI_NUM; - break; - - default: - $internal_type = MYSQLI_BOTH; - break; - } - - return $internal_type; - } -} diff --git a/src/Database/Mysql/Statement.php b/src/Database/Mysql/Statement.php deleted file mode 100644 index c380d54..0000000 --- a/src/Database/Mysql/Statement.php +++ /dev/null @@ -1,79 +0,0 @@ -stmt = $stmt; - } - - public function __destruct() - { - $this->stmt->close(); - } - - public function execute(array $params = []): ?IResultSet - { - if ($params) { - $ref_params = ['']; - - foreach ($params as &$param) { - $type = gettype($param); - - switch ($type) { - case 'integer': - case 'double': - case 'string': - $t = $type[0]; - break; - - case 'NULL': - $t = 's'; - break; - - case 'boolean': - $param = (string) (int) $param; - $t = 's'; - break; - - case 'array': - $param = json_encode($param); - $t = 's'; - break; - } - - if (!isset($t)) { - throw new \Exception('Data type ' . $type . ' not supported!'); - } - - $ref_params[] = &$param; - $ref_params[0] .= $t; - } - - if (!call_user_func_array([$this->stmt, 'bind_param'], $ref_params)) { - throw new \Exception($this->stmt->error); - } - } - - if (!$this->stmt->execute()) { - throw new \Exception($this->stmt->error); - } - - if ($result_set = $this->stmt->get_result()) { - return new ResultSet($result_set); - } - - return null; - } - - public function getAffectedRows(): int - { - return $this->stmt->affected_rows; - } -} diff --git a/src/Database/Query/Modify.php b/src/Database/Query/Modify.php deleted file mode 100755 index 321c78c..0000000 --- a/src/Database/Query/Modify.php +++ /dev/null @@ -1,140 +0,0 @@ -connection = $connection; - $this->table = $table; - } - - public function setIdName(string $idName): Modify - { - $this->idName = $idName; - - return $this; - } - - public function setExternalId($id): Modify - { - $this->externalId = $id; - - return $this; - } - - public function setAutoIncrement(bool $autoIncrement = true): Modify - { - $this->autoIncrement = $autoIncrement; - - return $this; - } - - public function fill(array $attributes): Modify - { - $this->attributes = array_merge($this->attributes, $attributes); - - return $this; - } - - public function set(string $name, $value): Modify - { - $this->attributes[$name] = $value; - - return $this; - } - - public function setId($id): Modify - { - $this->attributes[$this->idName] = $id; - - return $this; - } - - public function getId() - { - return $this->attributes[$this->idName]; - } - - public function save(): void - { - if (isset($this->attributes[$this->idName])) { - $this->update(); - } else { - $this->insert(); - } - } - - public function delete(): void - { - if (!isset($this->attributes[$this->idName])) { - throw new \Exception('No primary key specified!'); - } - - $query = 'DELETE FROM ' . Utils::backtick($this->table) . ' WHERE ' . Utils::backtick($this->idName) . '=?'; - - $stmt = $this->connection->prepare($query); - $stmt->execute([$this->idName => $this->attributes[$this->idName]]); - } - - private function insert(): void - { - if ($this->externalId !== null) { - $this->attributes[$this->idName] = $this->externalId; - } elseif (!$this->autoIncrement) { - $this->attributes[$this->idName] = $this->generateKey(); - } - - $set = $this->generateColumnsWithBinding(array_keys($this->attributes)); - - $query = 'INSERT INTO ' . Utils::backtick($this->table) . ' SET ' . $set; - - $stmt = $this->connection->prepare($query); - $stmt->execute($this->attributes); - - if ($this->autoIncrement) { - $this->attributes[$this->idName] = $this->connection->lastId(); - } - } - - private function update(): void - { - $attributes = $this->attributes; - unset($attributes[$this->idName]); - - $set = $this->generateColumnsWithBinding(array_keys($attributes)); - - $query = 'UPDATE ' . Utils::backtick($this->table) . ' SET ' . $set . ' WHERE ' . Utils::backtick($this->idName) . '=?'; - - $stmt = $this->connection->prepare($query); - $stmt->execute(array_merge($attributes, [$this->idName => $this->attributes[$this->idName]])); - } - - public static function generateColumnsWithBinding(array $columns): string - { - array_walk($columns, function(&$value, $key) { - $value = Utils::backtick($value) . '=?'; - }); - - return implode(',', $columns); - } - - private function generateKey(): string - { - return substr(hash('sha256', serialize($this->attributes) . random_bytes(5) . microtime()), 0, 7); - } -} diff --git a/src/Database/Query/Select.php b/src/Database/Query/Select.php deleted file mode 100644 index f9c2879..0000000 --- a/src/Database/Query/Select.php +++ /dev/null @@ -1,445 +0,0 @@ - [], self::CONDITION_HAVING => []]; - - private array $groups = []; - - private array $orders = []; - - private ?array $limit; - - public function __construct(IConnection $connection, ?string $table = null) - { - $this->connection = $connection; - - if ($table !== null) { - $this->table = $table; - } - } - - public function setIdName(string $idName): Select - { - $this->idName = $idName; - - return $this; - } - - public function setTableAliases(array $tableAliases): Select - { - $this->tableAliases = array_merge($this->tableAliases, $tableAliases); - - return $this; - } - - public function setDerivedTableAlias(string $tableAlias): Select - { - return $this->setTableAliases([Select::DERIVED_TABLE_KEY => $tableAlias]); - } - - public function from(string $table): Select - { - $this->table = $table; - - return $this; - } - - public function columns(array $columns): Select - { - $this->columns = array_merge($this->columns, $columns); - - return $this; - } - - public function innerJoin($table, $column1, string $relation, $column2): Select - { - $this->addJoin('INNER', $table, $column1, $relation, $column2); - - return $this; - } - - public function leftJoin($table, $column1, string $relation, $column2): Select - { - $this->addJoin('LEFT', $table, $column1, $relation, $column2); - - return $this; - } - - public function whereId($value): Select - { - $this->addWhereCondition('AND', $this->idName, '=', $value); - - return $this; - } - - public function where($column, string $relation = null, $value = null): Select - { - $this->addWhereCondition('AND', $column, $relation, $value); - - return $this; - } - - public function orWhere($column, string $relation = null, $value = null): Select - { - $this->addWhereCondition('OR', $column, $relation, $value); - - return $this; - } - - public function having($column, string $relation = null, $value = null): Select - { - $this->addHavingCondition('AND', $column, $relation, $value); - - return $this; - } - - public function orHaving($column, string $relation = null, $value = null): Select - { - $this->addHavingCondition('OR', $column, $relation, $value); - - return $this; - } - - public function groupBy($column): Select - { - $this->groups[] = $column; - - return $this; - } - - public function orderBy($column, string $type = 'ASC'): Select - { - $this->orders[] = [$column, $type]; - - return $this; - } - - public function limit(int $limit, int $offset = 0): Select - { - $this->limit = [$limit, $offset]; - - return $this; - } - - public function resetLimit(): void - { - $this->limit = null; - } - - public function paginate(int $page, int $itemsPerPage): Select - { - $this->limit($itemsPerPage, ($page - 1) * $itemsPerPage); - - return $this; - } - - public function execute(): IResultSet - { - list($query, $params) = $this->generateQuery(); - - return $this->connection->prepare($query)->execute($params); - } - - public function count(): int - { - if (count($this->groups) > 0 || count($this->conditions[self::CONDITION_HAVING]) > 0) { - $orders = $this->orders; - - $this->orders = []; - - list($query, $params) = $this->generateQuery(); - - $result = $this->connection->prepare('SELECT COUNT(*) num_rows FROM (' . $query . ') x') - ->execute($params) - ->fetch(IResultSet::FETCH_NUM); - - $this->orders = $orders; - - return $result[0]; - } else { - $columns = $this->columns; - $orders = $this->orders; - - $this->columns = [new RawExpression('COUNT(*) num_rows')]; - $this->orders = []; - - list($query, $params) = $this->generateQuery(); - - $result = $this->connection->prepare($query) - ->execute($params) - ->fetch(IResultSet::FETCH_NUM); - - $this->columns = $columns; - $this->orders = $orders; - - return $result[0]; - } - } - - private function isDerivedTable(): bool - { - return array_key_exists(Select::DERIVED_TABLE_KEY, $this->tableAliases); - } - - private function addJoin(string $type, $table, $column1, string $relation, $column2): void - { - $this->joins[] = [$type, $table, $column1, $relation, $column2]; - } - - private function addWhereCondition(string $logic, $column, string $relation, $value): void - { - $this->conditions[self::CONDITION_WHERE][] = [$logic, $column, $relation, $value]; - } - - private function addHavingCondition(string $logic, $column, string $relation, $value): void - { - $this->conditions[self::CONDITION_HAVING][] = [$logic, $column, $relation, $value]; - } - - private function generateQuery(): array - { - list($tableQuery, $tableParams) = $this->generateTable($this->table, true); - $queryString = 'SELECT ' . $this->generateColumns() . ' FROM ' . $tableQuery; - - if (count($this->joins) > 0) { - list($joinQuery, $joinParams) = $this->generateJoins(); - $queryString .= ' ' . $joinQuery; - } else { - $joinParams = []; - } - - if (count($this->conditions[self::CONDITION_WHERE]) > 0) { - list($wheres, $whereParams) = $this->generateConditions(self::CONDITION_WHERE); - - $queryString .= ' WHERE ' . $wheres; - } else { - $whereParams = []; - } - - if (count($this->groups) > 0) { - $queryString .= ' GROUP BY ' . $this->generateGroupBy(); - } - - if (count($this->conditions[self::CONDITION_HAVING]) > 0) { - list($havings, $havingParams) = $this->generateConditions(self::CONDITION_HAVING); - - $queryString .= ' HAVING ' . $havings; - } else { - $havingParams = []; - } - - if (count($this->orders) > 0) { - $queryString .= ' ORDER BY ' . $this->generateOrderBy(); - } - - if (isset($this->limit)) { - $queryString .= ' LIMIT ' . $this->limit[1] . ', ' . $this->limit[0]; - } - - if ($this->isDerivedTable()) { - $queryString = '(' . $queryString . ') AS ' . $this->tableAliases[Select::DERIVED_TABLE_KEY]; - } - - return [$queryString, array_merge($tableParams, $joinParams, $whereParams, $havingParams)]; - } - - private function generateTable($table, bool $defineAlias = false): array - { - $params = []; - - if ($table instanceof RawExpression) { - return [(string) $table, $params]; - } - - if ($table instanceof Select) - { - return $table->generateQuery(); - } - - if (isset($this->tableAliases[$table])) { - $queryString = ($defineAlias ? Utils::backtick($this->tableAliases[$table]) . ' ' . Utils::backtick($table) : Utils::backtick($table)); - return [$queryString, $params]; - } - - return [Utils::backtick($table), $params]; - } - - private function generateColumn($column): string - { - if ($column instanceof RawExpression) { - return (string) $column; - } - - if (is_array($column)) { - $out = ''; - - if ($column[0]) { - list($tableName, $params) = $this->generateTable($column[0]); - $out .= $tableName . '.'; - } - - $out .= Utils::backtick($column[1]); - - if (!empty($column[2])) { - $out .= ' ' . Utils::backtick($column[2]); - } - - return $out; - } else { - return Utils::backtick($column); - } - } - - private function generateColumns(): string - { - $columns = $this->columns; - - array_walk($columns, function (&$value, $key) { - $value = $this->generateColumn($value); - }); - - return implode(',', $columns); - } - - private function generateJoins(): array - { - - $joinQueries = []; - $params = []; - - foreach ($this->joins as $join) { - list($joinQueryFragment, $paramsFragment) = $this->generateTable($join[1], true); - $joinQueries[] = $join[0] . ' JOIN ' . $joinQueryFragment . ' ON ' . $this->generateColumn($join[2]) . ' ' . $join[3] . ' ' . $this->generateColumn($join[4]); - $params = array_merge($params, $paramsFragment); - } - - return [implode(' ', $joinQueries), $params]; - } - - private function generateConditions(int $type): array - { - $conditions = ''; - $params = []; - - foreach ($this->conditions[$type] as $condition) { - list($logic, $column, $relation, $value) = $condition; - - if ($column instanceof Closure) { - list($conditionsStringFragment, $paramsFragment) = $this->generateComplexConditionFragment($type, $column); - } else { - list($conditionsStringFragment, $paramsFragment) = $this->generateConditionFragment($condition); - } - - if ($conditions !== '') { - $conditions .= ' ' . $logic . ' '; - } - - $conditions .= $conditionsStringFragment; - $params = array_merge($params, $paramsFragment); - } - - return [$conditions, $params]; - } - - private function generateConditionFragment(array $condition): array - { - list($logic, $column, $relation, $value) = $condition; - - if ($column instanceof RawExpression) { - return [(string) $column, []]; - } - - $conditionsString = $this->generateColumn($column) . ' '; - - if ($value === null) { - return [$conditionsString . ($relation == '=' ? 'IS NULL' : 'IS NOT NULL'), []]; - } - - $conditionsString .= strtoupper($relation) . ' ';; - - switch ($relation = strtolower($relation)) { - case 'between': - $params = [$value[0], $value[1]]; - - $conditionsString .= '? AND ?'; - break; - - case 'in': - case 'not in': - $params = $value; - - if (count($value) > 0) { - $conditionsString .= '(' . implode(', ', array_fill(0, count($value), '?')) . ')'; - } else { - $conditionsString = $relation == 'in' ? '0' : '1'; - } - break; - - default: - $params = [$value]; - - $conditionsString .= '?'; - } - - return [$conditionsString, $params]; - } - - private function generateComplexConditionFragment(int $type, Closure $conditionCallback): array - { - $instance = new self($this->connection, $this->table); - $instance->tableAliases = $this->tableAliases; - - $conditionCallback($instance); - - list($conditions, $params) = $instance->generateConditions($type); - - return ['(' . $conditions . ')', $params]; - } - - private function generateGroupBy(): string - { - $groups = $this->groups; - - array_walk($groups, function (&$value, $key) { - $value = $this->generateColumn($value); - }); - - return implode(',', $groups); - } - - private function generateOrderBy(): string - { - $orders = $this->orders; - - array_walk($orders, function (&$value, $key) { - $value = $this->generateColumn($value[0]) . ' ' . strtoupper($value[1]); - }); - - return implode(',', $orders); - } -} diff --git a/src/Database/RawExpression.php b/src/Database/RawExpression.php deleted file mode 100644 index e2b0328..0000000 --- a/src/Database/RawExpression.php +++ /dev/null @@ -1,16 +0,0 @@ -expression = $expression; - } - - public function __toString(): string - { - return $this->expression; - } -} diff --git a/src/Database/Utils.php b/src/Database/Utils.php deleted file mode 100644 index be025c4..0000000 --- a/src/Database/Utils.php +++ /dev/null @@ -1,8 +0,0 @@ -url = $url; - $this->method = $method; - } - - public function setUrl(string $url): void - { - $this->url = $url; - } - - public function setMethod(int $method): void - { - $this->method = $method; - } - - public function setQuery($query): void - { - if (is_string($query)) { - $this->query = $query; - } else { - $this->query = http_build_query($query); - } - } - - public function setHeaders(array $headers): void - { - $this->headers = array_merge($this->headers, $headers); - } - - public function send(): IResponse - { - $ch = curl_init(); - - if ($this->method === self::HTTP_POST) { - $url = $this->url; - - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, $this->query); - } else { - $url = $this->url . '?' . $this->query; - } - - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); - curl_setopt($ch, CURLOPT_TIMEOUT, 20); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt($ch, CURLOPT_USERAGENT, 'MapGuesser cURL/1.0'); - - if (count($this->headers) > 0) { - curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers); - } - - $responseHeaders = []; - curl_setopt( - $ch, - CURLOPT_HEADERFUNCTION, - function ($ch, $header) use (&$responseHeaders) { - $len = strlen($header); - $header = explode(':', $header, 2); - - if (count($header) < 2) { - return $len; - } - - $responseHeaders[strtolower(trim($header[0]))][] = trim($header[1]); - - return $len; - } - ); - - $responseBody = curl_exec($ch); - - if ($responseBody === false) { - $error = curl_error($ch); - - curl_close($ch); - - throw new \Exception($error); - } - - curl_close($ch); - - return new Response($responseBody, $responseHeaders); - } -} diff --git a/src/Http/Response.php b/src/Http/Response.php deleted file mode 100644 index a7354f3..0000000 --- a/src/Http/Response.php +++ /dev/null @@ -1,26 +0,0 @@ -body = $body; - $this->headers = $headers; - } - - public function getBody(): string - { - return $this->body; - } - - public function getHeaders(): array - { - return $this->headers; - } -} diff --git a/src/Interfaces/Authentication/IUser.php b/src/Interfaces/Authentication/IUser.php deleted file mode 100644 index b5f0182..0000000 --- a/src/Interfaces/Authentication/IUser.php +++ /dev/null @@ -1,16 +0,0 @@ -recipients[] = [$mail, $name]; - } - - public function setSubject(string $subject): void - { - $this->subject = $subject; - } - - public function setBody(string $body): void - { - $this->body = $body; - } - - public function setBodyFromTemplate(string $template, array $params = []): void - { - $this->body = file_get_contents(ROOT . '/mail/' . $template . '.html'); - - $baseParameters = [ - 'APP_NAME' => $_ENV['APP_NAME'], - 'BASE_URL' => \Container::$request->getBase(), - ]; - - $params = array_merge($baseParameters, $params); - - foreach ($params as $key => $param) { - $this->body = str_replace('{{' . $key . '}}', $param, $this->body); - } - } - - public function send(): void - { - $mailer = new PHPMailer(true); - - $mailer->CharSet = 'utf-8'; - $mailer->Hostname = substr($_ENV['MAIL_FROM'], strpos($_ENV['MAIL_FROM'], '@') + 1); - - if (!empty($_ENV['MAIL_HOST'])) { - $mailer->Mailer = 'smtp'; - $mailer->Host = $_ENV['MAIL_HOST']; - $mailer->Port = !empty($_ENV['MAIL_PORT']) ? $_ENV['MAIL_PORT'] : 25; - $mailer->SMTPSecure = !empty($_ENV['MAIL_SECURE']) ? $_ENV['MAIL_SECURE'] : ''; - - if (!empty($_ENV['MAIL_USER'])) { - $mailer->SMTPAuth = true; - $mailer->Username = $_ENV['MAIL_USER']; - $mailer->Password = $_ENV['MAIL_PASSWORD']; - } else { - $mailer->SMTPAuth = false; - } - } else { - $mailer->Mailer = 'mail'; - } - - $mailer->setFrom($_ENV['MAIL_FROM'], $_ENV['APP_NAME']); - $mailer->addReplyTo($_ENV['MAIL_FROM'], $_ENV['APP_NAME']); - - $mailer->Sender = !empty($_ENV['MAIL_BOUNCE']) ? $_ENV['MAIL_BOUNCE'] : $_ENV['MAIL_FROM']; - $mailer->Subject = $this->subject; - $mailer->msgHTML($this->body); - - foreach ($this->recipients as $recipient) { - $this->sendMail($mailer, $recipient); - } - } - - private function sendMail(PHPMailer $mailer, array $recipient): void - { - $mailer->clearAddresses(); - $mailer->addAddress($recipient[0], $recipient[1]); - - $mailer->send(); - } -} diff --git a/src/OAuth/GoogleOAuth.php b/src/OAuth/GoogleOAuth.php deleted file mode 100644 index cfd34f1..0000000 --- a/src/OAuth/GoogleOAuth.php +++ /dev/null @@ -1,56 +0,0 @@ -request = $request; - } - - public function getDialogUrl(string $state, string $redirectUrl, ?string $nonce = null, ?string $loginHint = null): string - { - $oauthParams = [ - 'response_type' => 'code', - 'client_id' => $_ENV['GOOGLE_OAUTH_CLIENT_ID'], - 'scope' => 'openid email', - 'redirect_uri' => $redirectUrl, - 'state' => $state, - ]; - - if ($nonce !== null) { - $oauthParams['nonce'] = $nonce; - } - - if ($loginHint !== null) { - $oauthParams['login_hint'] = $loginHint; - } - - return self::$dialogUrlBase . '?' . http_build_query($oauthParams); - } - - public function getToken(string $code, string $redirectUrl): array - { - $tokenParams = [ - 'code' => $code, - 'client_id' => $_ENV['GOOGLE_OAUTH_CLIENT_ID'], - 'client_secret' => $_ENV['GOOGLE_OAUTH_CLIENT_SECRET'], - 'redirect_uri' => $redirectUrl, - 'grant_type' => 'authorization_code', - ]; - - $this->request->setUrl(self::$tokenUrlBase); - $this->request->setMethod(IRequest::HTTP_POST); - $this->request->setQuery($tokenParams); - $response = $this->request->send(); - - return json_decode($response->getBody(), true); - } -} diff --git a/src/PersistentData/Model/Challenge.php b/src/PersistentData/Model/Challenge.php index 4e61cc9..84e0835 100644 --- a/src/PersistentData/Model/Challenge.php +++ b/src/PersistentData/Model/Challenge.php @@ -1,6 +1,7 @@ id = $id; - } - - public function getId() - { - return $this->id; - } - - public function toArray(): array - { - $array = []; - - foreach (self::getFields() as $key) { - $method = 'get' . str_replace('_', '', ucwords($key, '_')); - - if (method_exists($this, $method)) { - $array[$key] = $this->$method(); - } - } - - return $array; - } - - public function saveSnapshot(): void - { - $this->snapshot = $this->toArray(); - } - - public function resetSnapshot(): void - { - $this->snapshot = []; - } - - public function getSnapshot(): array - { - return $this->snapshot; - } -} diff --git a/src/PersistentData/Model/MultiRoom.php b/src/PersistentData/Model/MultiRoom.php index 9cc137b..0135085 100644 --- a/src/PersistentData/Model/MultiRoom.php +++ b/src/PersistentData/Model/MultiRoom.php @@ -1,6 +1,7 @@ createSelect($select, $type, $useRelations, $withRelations); - - $data = $select->execute()->fetch(IResultSet::FETCH_ASSOC); - - if ($data === null) { - return null; - } - - $model = new $type(); - $this->fillWithData($data, $model, $withRelations); - - return $model; - } - - public function selectMultipleFromDb(Select $select, string $type, bool $useRelations = false, array $withRelations = []): Generator - { - $select = $this->createSelect($select, $type, $useRelations, $withRelations); - $result = $select->execute(); - - while ($data = $result->fetch(IResultSet::FETCH_ASSOC)) { - $model = new $type(); - $this->fillWithData($data, $model, $withRelations); - - yield $model; - } - } - - public function selectFromDbById($id, string $type, bool $useRelations = false) - { - $select = new Select(\Container::$dbConnection); - $select->whereId($id); - - return $this->selectFromDb($select, $type, $useRelations); - } - - public function fillWithData(array &$data, Model $model, array $withRelations = [], ?string $modelKey = null): void - { - $relations = $model::getRelations(); - if (count($withRelations)) { - $relations = array_intersect($relations, $withRelations); - } - - while (key($data)) { - $key = key($data); - $value = current($data); - $relation = key($relations); - - if (strpos($key, '__') == false) { - $method = 'set' . str_replace('_', '', ucwords($key, '_')); - - if (method_exists($model, $method) && isset($value)) { - $model->$method($value); - } - - next($data); - } else if (isset($modelKey) && substr($key, 0, strlen($modelKey . '__')) === $modelKey . '__') { - $key = substr($key, strlen($modelKey) + 2); - - $method = 'set' . str_replace('_', '', ucwords($key, '_')); - - if (method_exists($model, $method) && isset($value)) { - $model->$method($value); - } - - next($data); - } else if (substr($key, 0, strlen($relation . '__')) === $relation . '__') { - $relationType = current($relations); - $relationModel = new $relationType(); - $this->fillWithData($data, $relationModel, $withRelations, $relation); - - $method = 'set' . str_replace('_', '', ucwords($relation, '_')); - $model->$method($relationModel); - - next($relations); - } else { - return; - } - } - - $model->saveSnapshot(); - } - - public function loadRelationsFromDb(Model $model, bool $recursive): void - { - foreach ($model::getRelations() as $relation => $relationType) { - $camel = str_replace('_', '', ucwords($relation, '_')); - - $methodGet = 'get' . $camel . 'Id'; - $methodSet = 'set' . $camel; - - $relationId = $model->$methodGet(); - - if ($relationId !== null) { - $relationModel = $this->selectFromDbById($relationId, $relationType, $recursive); - - $model->$methodSet($relationModel); - } - } - } - - public function saveToDb(Model $model): void - { - $this->syncRelations($model); - - $modified = $model->toArray(); - $id = $model->getId(); - - $modify = new Modify(\Container::$dbConnection, $model::getTable()); - - if ($id !== null) { - $original = $model->getSnapshot(); - - foreach ($original as $key => $value) { - if ($value === $modified[$key]) { - unset($modified[$key]); - } - } - - if (count($modified) > 0) { - $modify->setId($id); - $modify->fill($modified); - $modify->save(); - } - } else { - $modify->fill($modified); - $modify->save(); - - $model->setId($modify->getId()); - } - - $model->saveSnapshot(); - } - - public function deleteFromDb(Model $model): void - { - $modify = new Modify(\Container::$dbConnection, $model::getTable()); - $modify->setId($model->getId()); - $modify->delete(); - - $model->setId(null); - $model->resetSnapshot(); - } - - private function createSelect(Select $select, string $type, bool $useRelations = false, array $withRelations = []): Select - { - $table = call_user_func([$type, 'getTable']); - $fields = call_user_func([$type, 'getFields']); - - $columns = []; - - foreach ($fields as $field) { - $columns[] = [$table, $field]; - } - - $select->from($table); - - if ($useRelations) { - $relations = call_user_func([$type, 'getRelations']); - if (count($withRelations)) { - $relations = array_intersect($relations, $withRelations); - } - - $columns = array_merge($columns, $this->getRelationColumns($relations, $withRelations)); - - $this->leftJoinRelations($select, $table, $relations, $withRelations); - $select->columns($columns); - } else { - $select->columns($columns); - } - - return $select; - } - - private function getRelationColumns(array $relations, array $withRelations): array - { - $columns = []; - - foreach ($relations as $relation => $relationType) { - $relationTable = call_user_func([$relationType, 'getTable']); - foreach (call_user_func([$relationType, 'getFields']) as $relationField) { - $columns[] = [$relationTable, $relationField, $relation . '__' . $relationField]; - } - - $nextOrderRelations = call_user_func([$relationType, 'getRelations']); - if (count($withRelations)) { - $nextOrderRelations = array_intersect($nextOrderRelations, $withRelations); - } - $columns = array_merge($columns, $this->getRelationColumns($nextOrderRelations, $withRelations)); - } - - return $columns; - } - - private function leftJoinRelations(Select $select, string $table, array $relations, array $withRelations): void - { - foreach ($relations as $relation => $relationType) { - $relationTable = call_user_func([$relationType, 'getTable']); - $select->leftJoin($relationTable, [$relationTable, 'id'], '=', [$table, $relation . '_id']); - - $nextOrderRelations = call_user_func([$relationType, 'getRelations']); - if (count($withRelations)) { - $nextOrderRelations = array_intersect($nextOrderRelations, $withRelations); - } - $this->leftJoinRelations($select, $relationTable, $nextOrderRelations, $withRelations); - } - } - - private function syncRelations(Model $model): void - { - foreach ($model::getRelations() as $relation => $relationType) { - $camel = str_replace('_', '', ucwords($relation, '_')); - - $methodGet = 'get' . $camel; - $methodSet = 'set' . $camel . 'Id'; - - $relationModel = $model->$methodGet(); - - if ($relationModel !== null) { - $model->$methodSet($relationModel->getId()); - } - } - } -} diff --git a/src/Repository/ChallengeRepository.php b/src/Repository/ChallengeRepository.php index bcce4d9..60bc42f 100644 --- a/src/Repository/ChallengeRepository.php +++ b/src/Repository/ChallengeRepository.php @@ -1,11 +1,11 @@ where('token', '=', $token); - + return $this->pdm->selectFromDb($select, Challenge::class); } @@ -72,4 +72,4 @@ class ChallengeRepository yield from $this->pdm->selectMultipleFromDb($select, Challenge::class); } -} \ No newline at end of file +} diff --git a/src/Repository/GuessRepository.php b/src/Repository/GuessRepository.php index 9e54b1b..307429c 100644 --- a/src/Repository/GuessRepository.php +++ b/src/Repository/GuessRepository.php @@ -1,14 +1,13 @@ where('challenge_id', '=', $challenge->getId()); $select->where('round', '=', $round); diff --git a/src/Repository/MapRepository.php b/src/Repository/MapRepository.php index 6b41dc0..d2a1f83 100644 --- a/src/Repository/MapRepository.php +++ b/src/Repository/MapRepository.php @@ -1,10 +1,10 @@ getRandomOldNForMapWithValidPano($mapId, $n - count($unvisitedPlaces), $userId); - + return array_merge($unvisitedPlaces, $oldPlaces); } } @@ -198,5 +198,5 @@ class PlaceRepository yield from $this->pdm->selectMultipleFromDb($select, Place::class); } - + } diff --git a/src/Repository/UserConfirmationRepository.php b/src/Repository/UserConfirmationRepository.php index d7d80ad..3cd80e0 100644 --- a/src/Repository/UserConfirmationRepository.php +++ b/src/Repository/UserConfirmationRepository.php @@ -1,9 +1,9 @@ base = $base; - $this->get = &$get; - $this->post = &$post; - $this->session = new Session($session); - - $this->userRepository = new UserRepository(); - - $userId = $this->session->get('userId'); - - if ($userId !== null) { - $this->user = $this->userRepository->getById($userId); - } - } - - public function setParsedRouteParams(array &$routeParams): void - { - $this->routeParams = &$routeParams; - } - - public function getBase(): string - { - return $this->base; - } - - public function query($key) - { - if (isset($this->get[$key])) { - return $this->get[$key]; - } - - if (isset($this->routeParams[$key])) { - return $this->routeParams[$key]; - } - - return null; - } - - public function post($key) - { - if (isset($this->post[$key])) { - return $this->post[$key]; - } - - return null; - } - - public function session(): ISession - { - return $this->session; - } - - public function setUser(?IUser $user): void - { - if ($user === null) { - $this->session->delete('userId'); - return; - } - - $this->session->set('userId', $user->getUniqueId()); - } - - public function user(): ?IUser - { - return $this->user; - } -} diff --git a/src/Request/Session.php b/src/Request/Session.php deleted file mode 100644 index 36d4f0f..0000000 --- a/src/Request/Session.php +++ /dev/null @@ -1,37 +0,0 @@ -data = &$data; - } - - public function has(string $key): bool - { - return isset($this->data[$key]); - } - - public function get(string $key) - { - if (isset($this->data[$key])) { - return $this->data[$key]; - } - - return null; - } - - public function set(string $key, $value): void - { - $this->data[$key] = $value; - } - - public function delete(string $key): void - { - unset($this->data[$key]); - } -} diff --git a/src/Response/ContentBase.php b/src/Response/ContentBase.php deleted file mode 100644 index 10cfafc..0000000 --- a/src/Response/ContentBase.php +++ /dev/null @@ -1,22 +0,0 @@ -data = $data; - } - - public function getData(): array - { - return $this->data; - } - - abstract public function render(): void; - - abstract public function getContentType(): string; -} diff --git a/src/Response/HtmlContent.php b/src/Response/HtmlContent.php deleted file mode 100644 index 3dcc29a..0000000 --- a/src/Response/HtmlContent.php +++ /dev/null @@ -1,34 +0,0 @@ -view = $view; - $this->data = $data; - } - - public function render(): void - { - if (!empty($_ENV['DEV'])) { - $generator = new Linker($this->view); - $generator->generate(); - } - - extract($this->data); - - require ROOT . '/cache/views/' . $this->view . '.php'; - - // @phpstan-ignore-next-line - SCRIPT_STARTED is defined in main.php - echo ''; - } - - public function getContentType(): string - { - return 'text/html'; - } -} diff --git a/src/Response/JsonContent.php b/src/Response/JsonContent.php deleted file mode 100644 index 70f4769..0000000 --- a/src/Response/JsonContent.php +++ /dev/null @@ -1,22 +0,0 @@ -data = $data; - } - - public function render(): void - { - // @phpstan-ignore-next-line - SCRIPT_STARTED is defined in main.php - $this->data['__debug__runtime'] = round((hrtime(true) - SCRIPT_STARTED) / 1e+6, 1); - - echo json_encode($this->data); - } - - public function getContentType(): string - { - return 'application/json'; - } -} diff --git a/src/Response/Redirect.php b/src/Response/Redirect.php deleted file mode 100644 index 4560155..0000000 --- a/src/Response/Redirect.php +++ /dev/null @@ -1,41 +0,0 @@ -target = $target; - $this->type = $type; - } - - public function getUrl(): string - { - if (preg_match('/^http(s)?/', $this->target) === 1) { - $link = $this->target; - } else { - $link = \Container::$request->getBase() . '/' . $this->target; - } - - return $link; - } - - public function getHttpCode(): int - { - switch ($this->type) { - case IRedirect::PERMANENT: - return 301; - - case IRedirect::TEMPORARY: - return 302; - - default: - return 302; - } - } -} diff --git a/src/Routing/Route.php b/src/Routing/Route.php deleted file mode 100644 index 5079fad..0000000 --- a/src/Routing/Route.php +++ /dev/null @@ -1,73 +0,0 @@ -id = $id; - $this->pattern = $pattern; - $this->handler = $handler; - } - - public function getId(): string - { - return $this->id; - } - - public function getHandler(): array - { - return $this->handler; - } - - public function generateLink(array $parameters = []): string - { - $link = []; - - foreach ($this->pattern as $fragment) { - if (preg_match('/^{(\\w+)(\\?)?}$/', $fragment, $matches) === 1) { - if (isset($parameters[$matches[1]])) { - $link[] = $parameters[$matches[1]]; - unset($parameters[$matches[1]]); - } elseif (!isset($matches[2])) {//TODO: why? parameter not found but not optional - $link[] = $fragment; - } - } else { - $link[] = $fragment; - } - } - - $queryParams = []; - foreach ($parameters as $key => $value) { - if ($value === null) { - continue; - } - - $queryParams[$key] = $value; - } - - $query = count($queryParams) > 0 ? '?' . http_build_query($queryParams) : ''; - - return implode('/', $link) . $query; - } - - public function testAgainst(array $path): ?array - { - $parameters = []; - - foreach ($path as $i => $fragment) { - if (preg_match('/^{(\\w+)(?:\\?)?}$/', $this->pattern[$i], $matches) === 1) { - $parameters[$matches[1]] = $fragment; - } elseif ($fragment != $this->pattern[$i]) { - return null; - } - } - - return $parameters; - } -} diff --git a/src/Routing/RouteCollection.php b/src/Routing/RouteCollection.php deleted file mode 100644 index 0e65bb3..0000000 --- a/src/Routing/RouteCollection.php +++ /dev/null @@ -1,88 +0,0 @@ - [], - 'post' => [] - ]; - - private array $groupStack = []; - - public function get(string $id, string $pattern, array $handler): void - { - $this->addRoute('get', $id, $pattern, $handler); - } - - public function post(string $id, string $pattern, array $handler): void - { - $this->addRoute('post', $id, $pattern, $handler); - } - - public function group(string $pattern, Closure $group): void - { - $this->groupStack[] = $pattern; - - $group($this); - - array_pop($this->groupStack); - } - - public function getRoute(string $id): ?Route - { - if (!isset($this->routes[$id])) { - return null; - } - - return $this->routes[$id]; - } - - public function match(string $method, array $uri): ?array - { - $groupNumber = count($uri); - - // response to HEAD request with the GET content - if ($method === 'head') { - $method = 'get'; - } - - if (!isset($this->searchTable[$method][$groupNumber])) { - return null; - } - - foreach ($this->searchTable[$method][$groupNumber] as $route) { - if (($parameters = $route->testAgainst($uri)) !== null) { - return [$route, $parameters]; - } - } - - return null; - } - - private function addRoute(string $method, string $id, string $pattern, array $handler): void - { - if (isset($this->routes[$id])) { - throw new \Exception('Route already exists: ' . $id); - } - - $pattern = array_merge($this->groupStack, $pattern === '' ? [] : explode('/', $pattern)); - $route = new Route($id, $pattern, $handler); - - $groupNumber = count($pattern); - - $this->searchTable[$method][$groupNumber][] = $route; - - while (preg_match('/^{\\w+\\?}$/', end($pattern)) === 1) { - $groupNumber--; - array_pop($pattern); - - $this->searchTable[$method][$groupNumber][] = $route; - } - - $this->routes[$id] = $route; - } -} diff --git a/src/Session/DatabaseSessionHandler.php b/src/Session/DatabaseSessionHandler.php deleted file mode 100644 index 64e7d37..0000000 --- a/src/Session/DatabaseSessionHandler.php +++ /dev/null @@ -1,104 +0,0 @@ -columns(['data']); - $select->whereId(substr($id, 0, 32)); - - $result = $select->execute()->fetch(IResultSet::FETCH_ASSOC); - - if ($result === null) { - return ''; - } - - $this->exists = true; - - return $result['data']; - } - - public function write($id, $data): bool - { - $modify = new Modify(\Container::$dbConnection, 'sessions'); - - if ($this->exists) { - $modify->setId(substr($id, 0, 32)); - } else { - $modify->setExternalId(substr($id, 0, 32)); - } - - $modify->set('data', $data); - $modify->set('updated', (new DateTime())->format('Y-m-d H:i:s')); - $modify->save(); - - $this->written = true; - - return true; - } - - public function destroy($id): bool - { - $modify = new Modify(\Container::$dbConnection, 'sessions'); - $modify->setId(substr($id, 0, 32)); - $modify->delete(); - - $this->exists = false; - - return true; - } - - public function gc($maxlifetime): bool - { - // empty on purpose - // old sessions are deleted by MaintainDatabaseCommand - - return true; - } - - public function create_sid(): string - { - return bin2hex(random_bytes(16)); - } - - public function validateId($id): bool - { - return preg_match('/^[a-f0-9]{32}$/', $id) === 1; - } - - public function updateTimestamp($id, $data): bool - { - if ($this->written) { - return true; - } - - $modify = new Modify(\Container::$dbConnection, 'sessions'); - - $modify->setId(substr($id, 0, 32)); - $modify->set('updated', (new DateTime())->format('Y-m-d H:i:s')); - $modify->save(); - - return true; - } -} diff --git a/src/Util/CaptchaValidator.php b/src/Util/CaptchaValidator.php deleted file mode 100644 index 3d4356f..0000000 --- a/src/Util/CaptchaValidator.php +++ /dev/null @@ -1,19 +0,0 @@ -setQuery([ - 'secret' => $_ENV['RECAPTCHA_SECRET'], - 'response' => $response - ]); - - $response = $request->send(); - - return json_decode($response->getBody(), true); - } -} diff --git a/src/Util/JwtParser.php b/src/Util/JwtParser.php deleted file mode 100644 index f9bc38e..0000000 --- a/src/Util/JwtParser.php +++ /dev/null @@ -1,33 +0,0 @@ -setToken($token); - } - } - - public function setToken(string $token): void - { - $this->token = explode('.', str_replace(['_', '-'], ['/', '+'], $token)); - } - - public function getHeader(): array - { - return json_decode(base64_decode($this->token[0]), true); - } - - public function getPayload(): array - { - return json_decode(base64_decode($this->token[1]), true); - } - - public function getSignature(): string - { - return base64_decode($this->token[2]); - } -} diff --git a/src/View/Linker.php b/src/View/Linker.php deleted file mode 100644 index ca67886..0000000 --- a/src/View/Linker.php +++ /dev/null @@ -1,152 +0,0 @@ -view = $view; - } - - public function generate(): void - { - $input = ROOT . '/views/' . $this->view . '.php'; - - $temporaryFiles = []; - $sections = ['externalCss' => '', 'inlineCss' => '', 'externalJs' => '', 'inlineJs' => '']; - $extra = ['', '']; - - do { - $parser = new Parser($input); - $fragment = $parser->parse(); - - $extends = $fragment->getExtends(); - - $this->generateAssets($fragment, $sections); - - $sections = array_merge($sections, $fragment->getSections()); //TODO: detect if section defined multiple times - $extra[0] = $fragment->getExtra()[0] . $extra[0]; - $extra[1] = $extra[1] . $fragment->getExtra()[1]; - - if ($extends === null) { - $this->writeFinal($extra, $input, ROOT . '/cache/views/' . $this->view . '.php'); - break; - } - - $tmpFile = tempnam(sys_get_temp_dir(), 'mapg-view-'); - $temporaryFiles[] = $tmpFile; - - $this->extendTemplate($sections, ROOT . '/views/' . $extends . '.php', $tmpFile); - - $input = $tmpFile; - } while (true); - - foreach ($temporaryFiles as $tmpFile) { - unlink($tmpFile); - } - } - - private function extendTemplate(array $sections, string $file, string $output): void - { - $inputFileHandle = fopen($file, 'r'); - if (!$inputFileHandle) { - throw new \Exception('Cannot open file ' . $file); - } - - $outputFileHandle = fopen($output, 'w'); - if (!$outputFileHandle) { - throw new \Exception('Cannot open file ' . $output . 'for writing.'); - } - - $lineNumber = 0; - while (($line = fgets($inputFileHandle)) !== false) { - ++$lineNumber; - - if (preg_match('/^\s*@yields\(\'([\w\/]+)\'\)\s*$/', $line, $matches) === 1) { - if (isset($sections[$matches[1]])) { - fwrite($outputFileHandle, $sections[$matches[1]]); - } - } else { - fwrite($outputFileHandle, $line); - } - } - - fclose($inputFileHandle); - fclose($outputFileHandle); - } - - private function writeFinal(array $extra, string $file, string $output): void - { - $dirname = pathinfo($output, PATHINFO_DIRNAME); - if (!is_dir($dirname)) { - mkdir($dirname, 0755, true); - } - - $inputFileHandle = fopen($file, 'r'); - if (!$inputFileHandle) { - throw new \Exception('Cannot open file ' . $file); - } - - $outputFileHandle = fopen($output, 'w'); - if (!$outputFileHandle) { - throw new \Exception('Cannot open file ' . $output . 'for writing.'); - } - - fwrite($outputFileHandle, $extra[0]); - while (($line = fgets($inputFileHandle)) !== false) { - fwrite($outputFileHandle, $line); - } - fwrite($outputFileHandle, $extra[1]); - - fclose($inputFileHandle); - fclose($outputFileHandle); - } - - private function generateAssets(ParsedFragment $fragment, array &$sections): void - { - foreach ($fragment->getCss() as $cssFile) { - $asset = $this->parseAsset($cssFile); - if (isset($asset['code'])) { - $sections['inlineCss'] .= '' . PHP_EOL; - } elseif (isset($asset['file'])) { - $sections['externalCss'] .= '' . PHP_EOL; - } - } - - foreach ($fragment->getJs() as $jsFile) { - $asset = $this->parseAsset($jsFile); - if (isset($asset['code'])) { - $sections['inlineJs'] .= '' . PHP_EOL; - } elseif (isset($asset['file'])) { - $sections['externalJs'] .= '' . PHP_EOL; - } - } - } - - private function parseAsset(string $asset): array - { - $output = []; - - if (preg_match('/^[\w\/\.]+$/', $asset) === 1) { - if ( - empty($_ENV['DEV']) && - filesize(ROOT . '/public/static/' . $asset) < self::INLINE_ASSET_LIMIT - ) { - $output['code'] = file_get_contents(ROOT . '/public/static/' . $asset); - } else { - $output['file'] = '/' . $asset . '?rev='; - } - } else { - $output['file'] = $asset; - } - - return $output; - } -} diff --git a/src/View/ParsedFragment.php b/src/View/ParsedFragment.php deleted file mode 100644 index a270a32..0000000 --- a/src/View/ParsedFragment.php +++ /dev/null @@ -1,48 +0,0 @@ -extends = $extends; - $this->css = $css; - $this->js = $js; - $this->sections = $sections; - $this->extra = $extra; - } - - public function getExtends(): ?string - { - return $this->extends; - } - - public function getCss(): array - { - return $this->css; - } - - public function getJs(): array - { - return $this->js; - } - - public function getSections(): array - { - return $this->sections; - } - - public function getExtra(): array - { - return $this->extra; - } -} diff --git a/src/View/Parser.php b/src/View/Parser.php deleted file mode 100644 index 29be6a6..0000000 --- a/src/View/Parser.php +++ /dev/null @@ -1,159 +0,0 @@ -file = $file; - } - - public function parse(): ParsedFragment - { - $sectionOpen = null; - $extraOpen = false; - - $extends = null; - $js = []; - $css = []; - $sections = []; - $extra = ['', '']; - - $fileHandle = fopen($this->file, 'r'); - if (!$fileHandle) { - throw new \Exception('Cannot open file ' . $this->file); - } - - $lineNumber = 0; - while (($line = fgets($fileHandle)) !== false) { - ++$lineNumber; - - if (($cssMatched = $this->matchCss($line)) !== null) { - $css[] = $cssMatched; - - continue; - } - - if (($jsMatched = $this->matchJs($line)) !== null) { - $js[] = $jsMatched; - - continue; - } - - if (($extendsMatched = $this->matchExtends($line)) !== null) { - if ($extends !== null) { - throw new \Exception('Error in file ' . $this->file . ' in line ' . $lineNumber . ' - There is already an \'@extends\' declared.'); - } - - $extends = $extendsMatched; - - continue; - } - - if (($sectionMatched = $this->matchSection($line)) !== null) { - if ($extends === null) { - throw new \Exception('Error in file ' . $this->file . ' in line ' . $lineNumber . ' - \'@section\' has no meaning if view extends nothing.'); - } - if ($sectionOpen !== null) { - throw new \Exception('Parse error in file ' . $this->file . ' in line ' . $lineNumber . ' - A \'@section\' is already open (no \'@endsection\' found).'); - } - - $sectionOpen = $sectionMatched; - $sections[$sectionOpen] = ''; - - continue; - } - - if ($this->matchEndSection($line)) { - if ($sectionOpen === null) { - throw new \Exception('Parse error in file ' . $this->file . ' in line ' . $lineNumber . ' - Cannot end section until no \'@section\' is open.'); - } - - $sectionOpen = null; - } - - if ($this->matchExtra($line)) { - if ($extraOpen) { - throw new \Exception('Parse error in file ' . $this->file . ' in line ' . $lineNumber . ' - An \'@extra\' is already open (no \'@endextra\' found).'); - } - - $extraOpen = true; - - continue; - } - - if ($this->matchEndExtra($line)) { - if (!$extraOpen) { - throw new \Exception('Parse error in file ' . $this->file . ' in line ' . $lineNumber . ' - Cannot end extra until no \'@extra\' is open.'); - } - - $extraOpen = false; - } - - if ($sectionOpen !== null) { - $sections[$sectionOpen] .= $line; - } - - if ($extraOpen) { - $offset = $extends === null ? 0 : 1; - $extra[$offset] .= $line; - } - } - - fclose($fileHandle); - - return new ParsedFragment($extends, $css, $js, $sections, $extra); - } - - private function matchCss(string $line): ?string - { - if (preg_match('/^\s*@css\((.*)\)\s*$/', $line, $matches) === 1) { - return $matches[1]; - } - - return null; - } - - private function matchJs(string $line): ?string - { - if (preg_match('/^\s*@js\((.*)\)\s*$/', $line, $matches) === 1) { - return $matches[1]; - } - - return null; - } - - private function matchExtends(string $line): ?string - { - if (preg_match('/^\s*@extends\(([\w\/]+)\)\s*$/', $line, $matches) === 1) { - return $matches[1]; - } - - return null; - } - - private function matchSection(string $line): ?string - { - if (preg_match('/^\s*@section\((\w+)\)\s*$/', $line, $matches) === 1) { - return $matches[1]; - } - - return null; - } - - private function matchEndSection(string $line): bool - { - return preg_match('/^\s*@endsection(?:\(\))?\s*$/', $line) === 1; - } - - private function matchExtra(string $line): bool - { - return preg_match('/^\s*@extra(?:\(\))?\s*$/', $line) === 1; - } - - private function matchEndExtra(string $line): bool - { - return preg_match('/^\s*@endextra(?:\(\))?\s*$/', $line) === 1; - } -} diff --git a/tests/OAuth/GoogleOAuthTest.php b/tests/OAuth/GoogleOAuthTest.php deleted file mode 100644 index 301c6ce..0000000 --- a/tests/OAuth/GoogleOAuthTest.php +++ /dev/null @@ -1,86 +0,0 @@ -getMockBuilder(IRequest::class) - ->setMethods(['setUrl', 'setMethod', 'setQuery', 'setHeaders', 'send']) - ->getMock(); - $googleOAuth = new GoogleOAuth($requestMock); - - $dialogUrl = $googleOAuth->getDialogUrl($state, $redirectUrl, $nonce); - $dialogUrlParsed = explode('?', $dialogUrl); - - $this->assertEquals('https://accounts.google.com/o/oauth2/v2/auth', $dialogUrlParsed[0]); - - parse_str($dialogUrlParsed[1], $dialogUrlQueryParams); - - $expectedQueryParams = [ - 'response_type' => 'code', - 'client_id' => $_ENV['GOOGLE_OAUTH_CLIENT_ID'], - 'scope' => 'openid email', - 'redirect_uri' => $redirectUrl, - 'state' => $state, - 'nonce' => $nonce, - ]; - - $this->assertEquals($expectedQueryParams, $dialogUrlQueryParams); - } - - public function testCanRequestToken(): void - { - $_ENV['GOOGLE_OAUTH_CLIENT_ID'] = 'abc'; - $_ENV['GOOGLE_OAUTH_CLIENT_SECRET'] = 'xxx'; - $code = 'code_from_google'; - $redirectUrl = 'http://example.com/oauth'; - - $requestMock = $this->getMockBuilder(IRequest::class) - ->setMethods(['setUrl', 'setMethod', 'setQuery', 'setHeaders', 'send']) - ->getMock(); - $responseMock = $this->getMockBuilder(IResponse::class) - ->setMethods(['getBody', 'getHeaders']) - ->getMock(); - $googleOAuth = new GoogleOAuth($requestMock); - - $expectedQueryParams = [ - 'code' => $code, - 'client_id' => $_ENV['GOOGLE_OAUTH_CLIENT_ID'], - 'client_secret' => $_ENV['GOOGLE_OAUTH_CLIENT_SECRET'], - 'redirect_uri' => $redirectUrl, - 'grant_type' => 'authorization_code', - ]; - - $requestMock->expects($this->once()) - ->method('setUrl') - ->with($this->equalTo('https://oauth2.googleapis.com/token')); - $requestMock->expects($this->once()) - ->method('setMethod') - ->with($this->equalTo(IRequest::HTTP_POST)); - $requestMock->expects($this->once()) - ->method('setQuery') - ->with($this->equalTo($expectedQueryParams)); - $requestMock->expects($this->once()) - ->method('send') - ->will($this->returnValue($responseMock)); - $responseMock->expects($this->once()) - ->method('getBody') - ->will($this->returnValue('{"test":"json"}')); - - $token = $googleOAuth->getToken($code, $redirectUrl); - - $this->assertEquals(['test' => 'json'], $token); - } -} diff --git a/tests/PersistentData/Model/ModelTest.php b/tests/PersistentData/Model/ModelTest.php deleted file mode 100644 index 8cad912..0000000 --- a/tests/PersistentData/Model/ModelTest.php +++ /dev/null @@ -1,93 +0,0 @@ - OtherModel::class]; - - private string $name; - - private bool $valid; - - public function setName(string $name): void - { - $this->name = $name; - } - - public function setValid(bool $valid): void - { - $this->valid = $valid; - } - - public function getName(): string - { - return $this->name; - } - - public function getValid(): bool - { - return $this->valid; - } -} - -final class ModelTest extends TestCase -{ - public function testCanReturnTable(): void - { - $this->assertEquals('test_table', DummyModel::getTable()); - } - - public function testCanReturnFields(): void - { - $this->assertEquals(['id', 'name', 'valid'], DummyModel::getFields()); - } - - public function testCanReturnRelations(): void - { - $this->assertEquals(['other_model' => OtherModel::class], DummyModel::getRelations()); - } - - public function testCanBeConvertedToArray(): void - { - $model = new DummyModel(); - $model->setId(123); - $model->setName('John'); - $model->setValid(true); - - $this->assertEquals([ - 'id' => 123, - 'name' => 'John', - 'valid' => true - ], $model->toArray()); - } - - public function testCanSaveAndResetSnapshot(): void - { - $model = new DummyModel(); - $model->setId(123); - $model->setName('John'); - $model->setValid(true); - - $model->saveSnapshot(); - - $this->assertEquals([ - 'id' => 123, - 'name' => 'John', - 'valid' => true - ], $model->getSnapshot()); - - $model->resetSnapshot(); - - $this->assertEquals([], $model->getSnapshot()); - } -} diff --git a/tests/Util/JwtParserTest.php b/tests/Util/JwtParserTest.php deleted file mode 100644 index 468f93b..0000000 --- a/tests/Util/JwtParserTest.php +++ /dev/null @@ -1,51 +0,0 @@ -jwtParser = new JwtParser( - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' - ); - } - - public function testSettingTokenIsTheSameAsCreatingWithToken(): void - { - $jwtParser2 = new JwtParser(); - $jwtParser2->setToken( - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' - ); - - $this->assertEquals($this->jwtParser, $jwtParser2); - } - - public function testCanParseTokenHeader(): void - { - $this->assertEquals([ - 'alg' => 'HS256', - 'typ' => 'JWT' - ], $this->jwtParser->getHeader()); - } - - public function testCanParseTokenPayload(): void - { - $this->assertEquals([ - 'sub' => '1234567890', - 'name' => 'John Doe', - 'iat' => 1516239022 - ], $this->jwtParser->getPayload()); - } - - public function testCanParseTokenSignature(): void - { - $this->assertEquals( - '49f94ac7044948c78a285d904f87f0a4c7897f7e8f3a4eb2255fda750b2cc397', - bin2hex($this->jwtParser->getSignature()) - ); - } -} diff --git a/tests/View/ParserTest.php b/tests/View/ParserTest.php deleted file mode 100644 index df7f633..0000000 --- a/tests/View/ParserTest.php +++ /dev/null @@ -1,144 +0,0 @@ -parse(); - - $expected = new ParsedFragment( - null, - [], - [], - [], - ['', ''] - ); - - $this->assertEquals($expected, $fragment); - } - - public function testCanParseViewWithAssets(): void - { - $file = realpath(self::TEST_VIEWS_PATH . '/view_with_assets.php'); - - $parser = new Parser($file); - $fragment = $parser->parse(); - - $expected = new ParsedFragment( - null, - [ - 'test.css' - ], - [ - 'test.js', - 'test_' - ], - [], - ['', ''] - ); - - $this->assertEquals($expected, $fragment); - } - - public function testCanParseViewWithExtends(): void - { - $file = realpath(self::TEST_VIEWS_PATH . '/view_with_extends.php'); - - $parser = new Parser($file); - $fragment = $parser->parse(); - - $expected = new ParsedFragment( - 'parent', - [], - [], - [ - 'section1' => '
Test HTML with @extends
' . "\n" - ], - ['', ''] - ); - - $this->assertEquals($expected, $fragment); - } - - public function testCanParseComplexView(): void - { - $file = realpath(self::TEST_VIEWS_PATH . '/view_complex.php'); - - $parser = new Parser($file); - $fragment = $parser->parse(); - - $expected = new ParsedFragment( - 'parent', - [ - 'test1.css' - ], - [ - 'test1.js', - 'test2_' - ], - [ - 'section1' => '
Test HTML with @extends - section 1
' . "\n", - 'section2' => '
Test HTML with @extends - section 2
' . "\n" - ], - [ - '' . "\n", - '' . "\n" . 'EXTRA' . "\n", - ] - ); - - $this->assertEquals($expected, $fragment); - } - - public function testFailsIfMultipleExtendsGiven(): void - { - $file = realpath(self::TEST_VIEWS_PATH . '/view_invalid_multiple_extends.php'); - - $parser = new Parser($file); - - $this->expectExceptionMessage('Error in file ' . $file . ' in line 3 - There is already an \'@extends\' declared.'); - - $parser->parse(); - } - - public function testFailsIfSectionWithoutExtendsGiven(): void - { - $file = realpath(self::TEST_VIEWS_PATH . '/view_invalid_section_without_extends.php'); - - $parser = new Parser($file); - - $this->expectExceptionMessage('Error in file ' . $file . ' in line 1 - \'@section\' has no meaning if view extends nothing.'); - - $parser->parse(); - } - - public function testFailsIfOpeningSectionBeforePreviousClosed(): void - { - $file = realpath(self::TEST_VIEWS_PATH . '/view_invalid_multiple_sections_open.php'); - - $parser = new Parser($file); - - $this->expectExceptionMessage('Parse error in file ' . $file . ' in line 4 - A \'@section\' is already open (no \'@endsection\' found).'); - - $parser->parse(); - } - - public function testFailsIfClosingSectionWhenNoSectionIsOpen(): void - { - $file = realpath(self::TEST_VIEWS_PATH . '/view_invalid_section_not_open.php'); - - $parser = new Parser($file); - - $this->expectExceptionMessage('Parse error in file ' . $file . ' in line 4 - Cannot end section until no \'@section\' is open.'); - - $parser->parse(); - } -} diff --git a/web.php b/web.php index 8e72033..3bd3a10 100644 --- a/web.php +++ b/web.php @@ -10,17 +10,17 @@ if (!empty($_ENV['DEV'])) { ini_set('display_errors', '0'); } -Container::$routeCollection = new MapGuesser\Routing\RouteCollection(); +Container::$routeCollection = new SokoWeb\Routing\RouteCollection(); Container::$routeCollection->get('index', '', [MapGuesser\Controller\MapsController::class, 'getMaps']); Container::$routeCollection->get('startSession', 'startSession.json', [MapGuesser\Controller\HomeController::class, 'startSession']); -Container::$routeCollection->group('login', function (MapGuesser\Routing\RouteCollection $routeCollection) { +Container::$routeCollection->group('login', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->get('login', '', [MapGuesser\Controller\LoginController::class, 'getLoginForm']); $routeCollection->post('login-action', '', [MapGuesser\Controller\LoginController::class, 'login']); $routeCollection->get('login-google', 'google', [MapGuesser\Controller\LoginController::class, 'getGoogleLoginRedirect']); $routeCollection->get('login-google-action', 'google/code', [MapGuesser\Controller\LoginController::class, 'loginWithGoogle']); }); -Container::$routeCollection->group('signup', function (MapGuesser\Routing\RouteCollection $routeCollection) { +Container::$routeCollection->group('signup', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->get('signup', '', [MapGuesser\Controller\LoginController::class, 'getSignupForm']); $routeCollection->post('signup-action', '', [MapGuesser\Controller\LoginController::class, 'signup']); $routeCollection->get('signup-google', 'google', [MapGuesser\Controller\LoginController::class, 'getSignupWithGoogleForm']); @@ -31,7 +31,7 @@ Container::$routeCollection->group('signup', function (MapGuesser\Routing\RouteC $routeCollection->get('signup.activate', 'activate/{token}', [MapGuesser\Controller\LoginController::class, 'activate']); $routeCollection->get('signup.cancel', 'cancel/{token}', [MapGuesser\Controller\LoginController::class, 'cancel']); }); -Container::$routeCollection->group('password', function (MapGuesser\Routing\RouteCollection $routeCollection) { +Container::$routeCollection->group('password', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->get('password-requestReset', 'requestReset', [MapGuesser\Controller\LoginController::class, 'getRequestPasswordResetForm']); $routeCollection->post('password-requestReset-action', 'requestReset', [MapGuesser\Controller\LoginController::class, 'requestPasswordReset']); $routeCollection->get('password-requestReset.success', 'requestReset/success', [MapGuesser\Controller\LoginController::class, 'getRequestPasswordResetSuccess']); @@ -39,7 +39,7 @@ Container::$routeCollection->group('password', function (MapGuesser\Routing\Rout $routeCollection->post('password-reset.action', 'reset/{token}', [MapGuesser\Controller\LoginController::class, 'resetPassword']); }); Container::$routeCollection->get('logout', 'logout', [MapGuesser\Controller\LoginController::class, 'logout']); -Container::$routeCollection->group('account', function (MapGuesser\Routing\RouteCollection $routeCollection) { +Container::$routeCollection->group('account', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->get('account', '', [MapGuesser\Controller\UserController::class, 'getAccount']); $routeCollection->post('account-action', '', [MapGuesser\Controller\UserController::class, 'saveAccount']); $routeCollection->get('account.delete', 'delete', [MapGuesser\Controller\UserController::class, 'getDeleteAccount']); @@ -48,13 +48,13 @@ Container::$routeCollection->group('account', function (MapGuesser\Routing\Route $routeCollection->get('account.googleAuthenticate-action', 'googleAuthenticate/code', [MapGuesser\Controller\UserController::class, 'authenticateWithGoogle']); }); //Container::$routeCollection->get('maps', 'maps', [MapGuesser\Controller\MapsController::class, 'getMaps']); -Container::$routeCollection->group('game', function (MapGuesser\Routing\RouteCollection $routeCollection) { +Container::$routeCollection->group('game', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->get('game', '{mapId}', [MapGuesser\Controller\GameController::class, 'getGame']); $routeCollection->post('game.prepare-json', '{mapId}/prepare.json', [MapGuesser\Controller\GameController::class, 'prepareGame']); $routeCollection->post('game.initialData-json', '{mapId}/initialData.json', [MapGuesser\Controller\GameFlowController::class, 'initialData']); $routeCollection->post('game.guess-json', '{mapId}/guess.json', [MapGuesser\Controller\GameFlowController::class, 'guess']); }); -Container::$routeCollection->group('multiGame', function (MapGuesser\Routing\RouteCollection $routeCollection) { +Container::$routeCollection->group('multiGame', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->get('multiGame.new', 'new/{mapId}', [MapGuesser\Controller\GameController::class, 'getNewMultiGame']); $routeCollection->get('multiGame', '{roomId}', [MapGuesser\Controller\GameController::class, 'getMultiGame']); $routeCollection->post('multiGame.prepare-json', '{roomId}/prepare.json', [MapGuesser\Controller\GameController::class, 'prepareMultiGame']); @@ -62,14 +62,14 @@ Container::$routeCollection->group('multiGame', function (MapGuesser\Routing\Rou $routeCollection->post('multiGame.nextRound-json', '{roomId}/nextRound.json', [MapGuesser\Controller\GameFlowController::class, 'multiNextRound']); $routeCollection->post('multiGame.guess-json', '{roomId}/guess.json', [MapGuesser\Controller\GameFlowController::class, 'multiGuess']); }); -Container::$routeCollection->group('challenge', function (MapGuesser\Routing\RouteCollection $routeCollection) { +Container::$routeCollection->group('challenge', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->post('challenge.create', 'create.json', [\MapGuesser\Controller\GameController::class, 'createNewChallenge']); $routeCollection->get('challenge', '{challengeToken}', [MapGuesser\Controller\GameController::class, 'getChallenge']); $routeCollection->post('challenge.prepare-json', '{challengeToken}/prepare.json', [MapGuesser\Controller\GameController::class, 'prepareChallenge']); $routeCollection->post('challenge.initialData-json', '{challengeToken}/initialData.json', [MapGuesser\Controller\GameFlowController::class, 'challengeInitialData']); $routeCollection->post('challenge.guess-json', '{challengeToken}/guess.json', [MapGuesser\Controller\GameFlowController::class, 'challengeGuess']); }); -Container::$routeCollection->group('admin', function (MapGuesser\Routing\RouteCollection $routeCollection) { +Container::$routeCollection->group('admin', function (SokoWeb\Routing\RouteCollection $routeCollection) { $routeCollection->get('admin.mapEditor', 'mapEditor/{mapId?}', [MapGuesser\Controller\MapAdminController::class, 'getMapEditor']); $routeCollection->get('admin.place', 'place.json/{placeId}', [MapGuesser\Controller\MapAdminController::class, 'getPlace']); $routeCollection->post('admin.saveMap', 'saveMap/{mapId}/json', [MapGuesser\Controller\MapAdminController::class, 'saveMap']); @@ -77,7 +77,7 @@ Container::$routeCollection->group('admin', function (MapGuesser\Routing\RouteCo }); if (isset($_COOKIE['COOKIES_CONSENT'])) { - Container::$sessionHandler = new MapGuesser\Session\DatabaseSessionHandler(); + Container::$sessionHandler = new SokoWeb\Session\DatabaseSessionHandler(); session_set_save_handler(Container::$sessionHandler, true); session_start([ @@ -106,7 +106,13 @@ if (isset($_COOKIE['COOKIES_CONSENT'])) { $_SESSION = []; } -Container::$request = new MapGuesser\Request\Request($_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'], $_GET, $_POST, $_SESSION); +Container::$request = new SokoWeb\Request\Request( + $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'], + $_GET, + $_POST, + $_SESSION, + new MapGuesser\Repository\UserRepository() +); if (!Container::$request->session()->has('anti_csrf_token')) { Container::$request->session()->set('anti_csrf_token', bin2hex(random_bytes(16)));