From b35f5f4411607ffb4d673623260721b346c3ac56 Mon Sep 17 00:00:00 2001 From: Ahmed Saeed Date: Wed, 20 Jul 2022 09:38:35 -0400 Subject: [PATCH 01/40] exclude admin_url from srcset rewrite --- src/Front/CDN.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Front/CDN.php b/src/Front/CDN.php index ede2c04..b30b4d0 100644 --- a/src/Front/CDN.php +++ b/src/Front/CDN.php @@ -113,6 +113,10 @@ private function rewrite_srcset( string $html ): string { return $html; } foreach ( $srcsets as $srcset ) { + if ( stristr( $srcset[0], admin_url() ) ) { + continue; + } + $sources = explode( ',', $srcset['sources'] ); $sources = array_unique( array_map( 'trim', $sources ) ); $cdn_srcset = $srcset['sources']; From 6b60bab79d1caaabfb9551217003819cc62b0107 Mon Sep 17 00:00:00 2001 From: Ahmed Saeed Date: Mon, 1 Aug 2022 04:38:30 -0400 Subject: [PATCH 02/40] move the code to rewrite_url method --- src/Front/CDN.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Front/CDN.php b/src/Front/CDN.php index b30b4d0..f6b7750 100644 --- a/src/Front/CDN.php +++ b/src/Front/CDN.php @@ -113,10 +113,6 @@ private function rewrite_srcset( string $html ): string { return $html; } foreach ( $srcsets as $srcset ) { - if ( stristr( $srcset[0], admin_url() ) ) { - continue; - } - $sources = explode( ',', $srcset['sources'] ); $sources = array_unique( array_map( 'trim', $sources ) ); $cdn_srcset = $srcset['sources']; @@ -140,6 +136,10 @@ private function rewrite_srcset( string $html ): string { * @return string */ public function rewrite_url( string $url ): string { + if ( false !== stripos( $url, admin_url() ) ) { + return $url; + } + $cdn_url = $this->options->get( 'cdn_url' ); if ( ! $cdn_url ) { From 4b0ea47227b02f1f6cba6f9b85c49306b9ec424f Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 15 May 2024 15:59:22 +0200 Subject: [PATCH 03/40] Added launchpad --- .gitignore | 2 +- composer.json | 10 +- composer.lock | 2011 ++++++++++++----- configs/parameters.php | 10 + configs/providers.php | 10 + includes/main.php | 15 - rocketcdn.php | 6 +- src/API/Client.php | 23 +- src/API/ServiceProvider.php | 24 +- src/Admin/AdminBar/AdminBar.php | 15 +- src/Admin/AdminBar/ServiceProvider.php | 52 +- src/Admin/Notices/Notices.php | 15 +- src/Admin/Notices/ServiceProvider.php | 49 +- src/Admin/Settings/Page.php | 16 +- src/Admin/Settings/ServiceProvider.php | 54 +- .../Argument/ArgumentResolverInterface.php | 28 - .../Argument/ArgumentResolverTrait.php | 120 - .../League/Container/Argument/ClassName.php | 29 - .../Container/Argument/ClassNameInterface.php | 13 - .../Argument/ClassNameWithOptionalValue.php | 39 - .../League/Container/Argument/RawArgument.php | 29 - .../Argument/RawArgumentInterface.php | 13 - .../League/Container/Container.php | 248 -- .../Container/ContainerAwareInterface.php | 40 - .../League/Container/ContainerAwareTrait.php | 76 - .../Container/Definition/Definition.php | 278 --- .../Definition/DefinitionAggregate.php | 124 - .../DefinitionAggregateInterface.php | 67 - .../Definition/DefinitionInterface.php | 120 - .../Exception/ContainerException.php | 10 - .../Container/Exception/NotFoundException.php | 10 - .../League/Container/Inflector/Inflector.php | 123 - .../Inflector/InflectorAggregate.php | 58 - .../Inflector/InflectorAggregateInterface.php | 27 - .../Inflector/InflectorInterface.php | 60 - .../League/Container/ReflectionContainer.php | 131 -- .../AbstractServiceProvider.php | 46 - .../BootableServiceProviderInterface.php | 14 - .../ServiceProviderAggregate.php | 106 - .../ServiceProviderAggregateInterface.php | 36 - .../ServiceProviderInterface.php | 46 - .../Container/ContainerExceptionInterface.php | 13 - .../Psr/Container/ContainerInterface.php | 37 - .../Container/NotFoundExceptionInterface.php | 13 - src/EventManagement/EventManager.php | 134 -- src/EventManagement/SubscriberInterface.php | 4 +- src/Front/CDN.php | 22 +- src/Front/ServiceProvider.php | 46 +- src/Options/AbstractOptions.php | 67 - src/Options/Options.php | 59 - src/Options/OptionsInterface.php | 56 - src/Plugin.php | 128 -- .../Front/CDN/Subscriber/addPreconnectCdn.php | 1 - tests/Integration/AdminTestCase.php | 9 +- tests/Integration/AjaxTestCase.php | 24 +- tests/Integration/CapTrait.php | 6 +- .../AdminBar/Subscriber/addAdminBarMenu.php | 4 +- .../Admin/AdminBar/Subscriber/purgeCache.php | 12 +- .../Notices/Subscriber/emptyApiKeyNotice.php | 4 +- .../Notices/Subscriber/wrongApiKeyNotice.php | 4 +- .../Settings/Subscriber/enqueueAssets.php | 4 +- .../Admin/Settings/Subscriber/purgeCache.php | 2 +- .../Settings/Subscriber/updateApiKey.php | 4 +- .../Settings/Subscriber/validateApiKey.php | 8 +- .../Front/CDN/Subscriber/addPreconnectCdn.php | 4 +- 65 files changed, 1577 insertions(+), 3291 deletions(-) create mode 100644 configs/parameters.php create mode 100644 configs/providers.php delete mode 100644 includes/main.php delete mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php delete mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverTrait.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassName.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassNameInterface.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassNameWithOptionalValue.php delete mode 100644 src/Dependencies/League/Container/Argument/RawArgument.php delete mode 100644 src/Dependencies/League/Container/Argument/RawArgumentInterface.php delete mode 100644 src/Dependencies/League/Container/Container.php delete mode 100644 src/Dependencies/League/Container/ContainerAwareInterface.php delete mode 100644 src/Dependencies/League/Container/ContainerAwareTrait.php delete mode 100644 src/Dependencies/League/Container/Definition/Definition.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregate.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionInterface.php delete mode 100644 src/Dependencies/League/Container/Exception/ContainerException.php delete mode 100644 src/Dependencies/League/Container/Exception/NotFoundException.php delete mode 100644 src/Dependencies/League/Container/Inflector/Inflector.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregate.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorInterface.php delete mode 100644 src/Dependencies/League/Container/ReflectionContainer.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregate.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderInterface.php delete mode 100644 src/Dependencies/Psr/Container/ContainerExceptionInterface.php delete mode 100644 src/Dependencies/Psr/Container/ContainerInterface.php delete mode 100644 src/Dependencies/Psr/Container/NotFoundExceptionInterface.php delete mode 100644 src/EventManagement/EventManager.php delete mode 100644 src/Options/AbstractOptions.php delete mode 100644 src/Options/Options.php delete mode 100644 src/Options/OptionsInterface.php delete mode 100644 src/Plugin.php diff --git a/.gitignore b/.gitignore index a67d42b..8b92a69 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ composer.phar /vendor/ - +src/Dependencies # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file # composer.lock diff --git a/composer.json b/composer.json index dec1e56..5a87708 100644 --- a/composer.json +++ b/composer.json @@ -34,13 +34,14 @@ "league/container": "^3.3", "phpcompatibility/phpcompatibility-wp": "^2.0", "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^7.5", "phpunit/php-file-iterator": "2.0.3", - "psr/container": "1.0.0", + "phpunit/phpunit": "^7.5 || ^8 || ^9", "roave/security-advisories": "dev-master", "szepeviktor/phpstan-wordpress": "^0.7.0", "wp-coding-standards/wpcs": "^2", - "wp-media/phpunit": "^2.0" + "wp-launchpad/core": "^0.2.6", + "wp-launchpad/framework-options": "^0.1.2", + "wp-media/phpunit": "^3.0" }, "autoload": { "psr-4": { @@ -59,7 +60,8 @@ "classmap_directory": "/src/classes/dependencies/", "classmap_prefix": "RocketCDN_", "packages": [ - "league/container" + "wp-launchpad/core", + "wp-launchpad/framework-options" ] } }, diff --git a/composer.lock b/composer.lock index 2044268..054312b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "935f73171d0cfee36cdc863ebd8d177e", + "content-hash": "05d14a7ac2d918dedecab2a7125d6243", "packages": [ { "name": "composer/installers", @@ -161,16 +161,16 @@ "packages-dev": [ { "name": "antecedent/patchwork", - "version": "2.1.21", + "version": "2.1.28", "source": { "type": "git", "url": "https://github.com/antecedent/patchwork.git", - "reference": "25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d" + "reference": "6b30aff81ebadf0f2feb9268d3e08385cebcc08d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/antecedent/patchwork/zipball/25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d", - "reference": "25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d", + "url": "https://api.github.com/repos/antecedent/patchwork/zipball/6b30aff81ebadf0f2feb9268d3e08385cebcc08d", + "reference": "6b30aff81ebadf0f2feb9268d3e08385cebcc08d", "shasum": "" }, "require": { @@ -191,7 +191,7 @@ } ], "description": "Method redefinition (monkey-patching) functionality for PHP.", - "homepage": "http://patchwork2.org/", + "homepage": "https://antecedent.github.io/patchwork/", "keywords": [ "aop", "aspect", @@ -203,9 +203,9 @@ ], "support": { "issues": "https://github.com/antecedent/patchwork/issues", - "source": "https://github.com/antecedent/patchwork/tree/2.1.21" + "source": "https://github.com/antecedent/patchwork/tree/2.1.28" }, - "time": "2022-02-07T07:28:34+00:00" + "time": "2024-02-06T09:26:11+00:00" }, { "name": "brain/monkey", @@ -239,12 +239,12 @@ } }, "autoload": { - "psr-4": { - "Brain\\Monkey\\": "src/" - }, "files": [ "inc/api.php" - ] + ], + "psr-4": { + "Brain\\Monkey\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -410,31 +410,79 @@ }, "time": "2022-02-04T12:51:07+00:00" }, + { + "name": "doctrine/deprecations", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" + }, + "time": "2024-01-30T19:34:25+00:00" + }, { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -461,7 +509,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -477,7 +525,7 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -611,16 +659,16 @@ }, { "name": "league/flysystem", - "version": "1.1.9", + "version": "1.1.10", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "094defdb4a7001845300334e7c1ee2335925ef99" + "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/094defdb4a7001845300334e7c1ee2335925ef99", - "reference": "094defdb4a7001845300334e7c1ee2335925ef99", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3239285c825c152bcc315fe0e87d6b55f5972ed1", + "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1", "shasum": "" }, "require": { @@ -693,7 +741,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/1.1.9" + "source": "https://github.com/thephpleague/flysystem/tree/1.1.10" }, "funding": [ { @@ -701,30 +749,30 @@ "type": "other" } ], - "time": "2021-12-09T09:40:50+00:00" + "time": "2022-10-04T09:16:37+00:00" }, { "name": "league/mime-type-detection", - "version": "1.9.0", + "version": "1.15.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69" + "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/aa70e813a6ad3d1558fc927863d47309b4c23e69", - "reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", + "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", "shasum": "" }, "require": { "ext-fileinfo": "*", - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.2", "phpstan/phpstan": "^0.12.68", - "phpunit/phpunit": "^8.5.8 || ^9.3" + "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" }, "type": "library", "autoload": { @@ -745,7 +793,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.9.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.15.0" }, "funding": [ { @@ -757,20 +805,20 @@ "type": "tidelift" } ], - "time": "2021-11-21T11:48:40+00:00" + "time": "2024-01-28T23:22:08+00:00" }, { "name": "mikey179/vfsstream", - "version": "v1.6.10", + "version": "v1.6.11", "source": { "type": "git", "url": "https://github.com/bovigo/vfsStream.git", - "reference": "250c0825537d501e327df879fb3d4cd751933b85" + "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/250c0825537d501e327df879fb3d4cd751933b85", - "reference": "250c0825537d501e327df879fb3d4cd751933b85", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", + "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", "shasum": "" }, "require": { @@ -808,39 +856,42 @@ "source": "https://github.com/bovigo/vfsStream/tree/master", "wiki": "https://github.com/bovigo/vfsStream/wiki" }, - "time": "2021-09-25T08:05:01+00:00" + "time": "2022-02-23T02:02:42+00:00" }, { "name": "mockery/mockery", - "version": "1.3.5", + "version": "1.6.11", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" + "reference": "81a161d0b135df89951abd52296adf97deb0723d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/81a161d0b135df89951abd52296adf97deb0723d", + "reference": "81a161d0b135df89951abd52296adf97deb0723d", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": ">=5.6.0" + "php": ">=7.3" + }, + "conflict": { + "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" + "phpunit/phpunit": "^8.5 || ^9.6.17", + "symplify/easy-coding-standard": "^12.1.14" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, "autoload": { - "psr-0": { - "Mockery": "library/" + "files": [ + "library/helpers.php", + "library/Mockery.php" + ], + "psr-4": { + "Mockery\\": "library/Mockery" } }, "notification-url": "https://packagist.org/downloads/", @@ -851,12 +902,20 @@ { "name": "Pádraic Brady", "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "homepage": "https://github.com/padraic", + "role": "Author" }, { "name": "Dave Marshall", "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" + "homepage": "https://davedevelopment.co.uk", + "role": "Developer" + }, + { + "name": "Nathanael Esayeas", + "email": "nathanael.esayeas@protonmail.com", + "homepage": "https://github.com/ghostwriter", + "role": "Lead Developer" } ], "description": "Mockery is a simple yet flexible PHP mock object framework", @@ -874,35 +933,39 @@ "testing" ], "support": { + "docs": "https://docs.mockery.io/", "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.3.5" + "rss": "https://github.com/mockery/mockery/releases.atom", + "security": "https://github.com/mockery/mockery/security/advisories", + "source": "https://github.com/mockery/mockery" }, - "time": "2021-09-13T15:33:03+00:00" + "time": "2024-03-21T18:34:15+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { @@ -927,7 +990,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -935,32 +998,34 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "phar-io/manifest", - "version": "1.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -992,26 +1057,32 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2018-07-08T19:23:20+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", - "version": "2.0.1", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -1043,37 +1114,37 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/master" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2018-07-08T19:19:57+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "php-stubs/wordpress-stubs", - "version": "v5.9.0", + "version": "v5.9.9", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b" + "reference": "06c51c4863659ea9e9f4c2a23293728a677cb059" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b", - "reference": "0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/06c51c4863659ea9e9f4c2a23293728a677cb059", + "reference": "06c51c4863659ea9e9f4c2a23293728a677cb059", "shasum": "" }, - "replace": { - "giacocorsiglia/wordpress-stubs": "*" - }, "require-dev": { - "nikic/php-parser": "< 4.12.0", - "php": "~7.3 || ~8.0", - "php-stubs/generator": "^0.8.0", - "phpdocumentor/reflection-docblock": "^5.3", - "phpstan/phpstan": "^1.2" + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "nikic/php-parser": "^4.13", + "php": "^7.4 || ~8.0.0", + "php-stubs/generator": "^0.8.3", + "phpdocumentor/reflection-docblock": "5.3", + "phpstan/phpstan": "^1.10.49", + "phpunit/phpunit": "^9.5", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.11" }, "suggest": { "paragonie/sodium_compat": "Pure PHP implementation of libsodium", - "symfony/polyfill-php73": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" }, "type": "library", @@ -1090,9 +1161,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v5.9.0" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v5.9.9" }, - "time": "2022-01-26T00:27:45+00:00" + "time": "2024-04-14T17:16:00+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -1158,28 +1229,28 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.1", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43" + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/293975b465e0e709b571cbf0c957c6c0a7b9a2ac", + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac", "shasum": "" }, "require": { "phpcompatibility/php-compatibility": "^9.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "paragonie/random_compat": "dev-master", "paragonie/sodium_compat": "dev-master" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -1204,26 +1275,42 @@ "paragonie", "phpcs", "polyfill", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" }, - "time": "2021-02-15T10:24:51+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:30:46+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.3", + "version": "2.1.5", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308" + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082", "shasum": "" }, "require": { @@ -1231,10 +1318,10 @@ "phpcompatibility/phpcompatibility-paragonie": "^1.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -1258,13 +1345,29 @@ "compatibility", "phpcs", "standards", + "static analysis", "wordpress" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2021-12-30T16:37:40+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-24T21:37:59+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -1321,28 +1424,35 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", + "version": "5.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", + "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.1", "ext-filter": "*", - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", + "phpdocumentor/type-resolver": "^1.7", + "phpstan/phpdoc-parser": "^1.7", "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" + "mockery/mockery": "~1.3.5", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^5.13" }, "type": "library", "extra": { @@ -1366,37 +1476,45 @@ }, { "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" + "email": "opensource@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.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" }, - "time": "2021-10-19T17:43:47+00:00" + "time": "2024-04-09T21:13:58+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.0", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" + "reference": "153ae662783729388a584b4361f2545e4d841e3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", + "reference": "153ae662783729388a584b4361f2545e4d841e3c", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "doctrine/deprecations": "^1.0", + "php": "^7.3 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" }, "type": "library", "extra": { @@ -1422,34 +1540,35 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" }, - "time": "2022-01-04T19:58:01+00:00" + "time": "2024-02-23T11:10:43+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.15.0", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/67a759e7d8746d501c41536ba40cd9c0a07d6a87", + "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", + "doctrine/instantiator": "^1.2 || ^2.0", + "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.*", "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" + "sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0", + "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" }, "type": "library", "extra": { @@ -1482,6 +1601,7 @@ "keywords": [ "Double", "Dummy", + "dev", "fake", "mock", "spy", @@ -1489,22 +1609,69 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.19.0" }, - "time": "2021-12-08T12:19:24+00:00" + "time": "2024-02-29T11:52:51+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.29.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", + "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^4.15", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" + }, + "time": "2024-05-06T12:04:23+00:00" }, { "name": "phpstan/phpstan", - "version": "0.12.99", + "version": "0.12.100", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7" + "reference": "48236ddf823547081b2b153d1cd2994b784328c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b4d40f1d759942f523be267a1bab6884f46ca3f7", - "reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/48236ddf823547081b2b153d1cd2994b784328c3", + "reference": "48236ddf823547081b2b153d1cd2994b784328c3", "shasum": "" }, "require": { @@ -1535,7 +1702,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.99" + "source": "https://github.com/phpstan/phpstan/tree/0.12.100" }, "funding": [ { @@ -1546,53 +1713,49 @@ "url": "https://github.com/phpstan", "type": "github" }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, { "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", "type": "tidelift" } ], - "time": "2021-09-12T20:09:55+00:00" + "time": "2022-11-01T09:52:08+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "7.0.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "40a4ed114a4aea5afd6df8d0f0c9cd3033097f66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/40a4ed114a4aea5afd6df8d0f0c9cd3033097f66", + "reference": "40a4ed114a4aea5afd6df8d0f0c9cd3033097f66", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", + "php": ">=7.2", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", + "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -1620,9 +1783,15 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.17" }, - "time": "2018-10-31T16:06:48+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:09:37+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1731,16 +1900,16 @@ }, { "name": "phpunit/php-timer", - "version": "2.1.3", + "version": "2.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" + "reference": "a691211e94ff39a34811abd521c31bd5b305b0bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/a691211e94ff39a34811abd521c31bd5b305b0bb", + "reference": "a691211e94ff39a34811abd521c31bd5b305b0bb", "shasum": "" }, "require": { @@ -1778,7 +1947,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.4" }, "funding": [ { @@ -1786,33 +1955,33 @@ "type": "github" } ], - "time": "2020-11-30T08:20:02+00:00" + "time": "2024-03-01T13:42:41+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.1.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1837,7 +2006,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" }, "funding": [ { @@ -1846,57 +2015,56 @@ } ], "abandoned": true, - "time": "2021-07-26T12:15:06+00:00" + "time": "2020-08-04T08:28:15+00:00" }, { "name": "phpunit/phpunit", - "version": "7.5.20", + "version": "8.5.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + "reference": "bd5fc77c869e8dd65040dacbad170f074c13796c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bd5fc77c869e8dd65040dacbad170f074c13796c", + "reference": "bd5fc77c869e8dd65040dacbad170f074c13796c", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.0", + "phar-io/manifest": "^2.0.1", + "phar-io/version": "^3.0.2", + "php": ">=7.2", + "phpspec/prophecy": "^1.10.3", + "phpunit/php-code-coverage": "^7.0.12", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.3", + "sebastian/exporter": "^3.1.2", + "sebastian/global-state": "^3.0.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", "sebastian/version": "^2.0.1" }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -1904,7 +2072,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "8.5-dev" } }, "autoload": { @@ -1932,33 +2100,38 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/7.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.18" }, - "time": "2020-01-08T08:45:45+00:00" + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-07-19T06:13:17+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/" @@ -1971,7 +2144,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)", @@ -1985,9 +2158,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/master" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2017-02-14T16:28:37+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "roave/security-advisories", @@ -1995,313 +2168,591 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "2ec9ad634c459ee60c42d99390be37c8a3c6e8e5" + "reference": "8eea9afb8060c8ef05c89f02b123329f43e9ba4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/2ec9ad634c459ee60c42d99390be37c8a3c6e8e5", - "reference": "2ec9ad634c459ee60c42d99390be37c8a3c6e8e5", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/8eea9afb8060c8ef05c89f02b123329f43e9ba4e", + "reference": "8eea9afb8060c8ef05c89f02b123329f43e9ba4e", "shasum": "" }, "conflict": { "3f/pygmentize": "<1.2", + "admidio/admidio": "<4.2.13", "adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3", + "aheinze/cockpit": "<2.2", + "aimeos/aimeos-typo3": "<19.10.12|>=20,<20.10.5", + "airesvsg/acf-to-rest-api": "<=3.1", "akaunting/akaunting": "<2.1.13", + "akeneo/pim-community-dev": "<5.0.119|>=6,<6.0.53", + "alextselegidis/easyappointments": "<1.5", "alterphp/easyadmin-extension-bundle": ">=1.2,<1.2.11|>=1.3,<1.3.1", "amazing/media2click": ">=1,<1.3.3", "amphp/artax": "<1.0.6|>=2,<2.0.6", - "amphp/http": "<1.0.1", + "amphp/http": "<=1.7.2|>=2,<=2.1", "amphp/http-client": ">=4,<4.4", "anchorcms/anchor-cms": "<=0.12.7", - "api-platform/core": ">=2.2,<2.2.10|>=2.3,<2.3.6", + "andreapollastri/cipi": "<=3.1.15", + "andrewhaine/silverstripe-form-capture": ">=0.2,<=0.2.3|>=1,<1.0.2|>=2,<2.2.5", + "apache-solr-for-typo3/solr": "<2.8.3", + "apereo/phpcas": "<1.6", + "api-platform/core": ">=2.2,<2.2.10|>=2.3,<2.3.6|>=2.6,<2.7.10|>=3,<3.0.12|>=3.1,<3.1.3", + "appwrite/server-ce": "<=1.2.1", + "arc/web": "<3", "area17/twill": "<1.2.5|>=2,<2.5.3", - "asymmetricrypt/asymmetricrypt": ">=0,<9.9.99", - "aws/aws-sdk-php": ">=3,<3.2.1", - "bagisto/bagisto": "<0.1.5", + "artesaos/seotools": "<0.17.2", + "asymmetricrypt/asymmetricrypt": "<9.9.99", + "athlon1600/php-proxy": "<=5.1", + "athlon1600/php-proxy-app": "<=3", + "austintoddj/canvas": "<=3.4.2", + "automad/automad": "<=1.10.9", + "automattic/jetpack": "<9.8", + "awesome-support/awesome-support": "<=6.0.7", + "aws/aws-sdk-php": "<3.288.1", + "azuracast/azuracast": "<0.18.3", + "backdrop/backdrop": "<1.24.2", + "backpack/crud": "<3.4.9", + "bacula-web/bacula-web": "<8.0.0.0-RC2-dev", + "badaso/core": "<2.7", + "bagisto/bagisto": "<2.1", "barrelstrength/sprout-base-email": "<1.2.7", "barrelstrength/sprout-forms": "<3.9", - "baserproject/basercms": "<4.5.4", - "billz/raspap-webgui": "<=2.6.6", + "barryvdh/laravel-translation-manager": "<0.6.2", + "barzahlen/barzahlen-php": "<2.0.1", + "baserproject/basercms": "<5.0.9", + "bassjobsen/bootstrap-3-typeahead": ">4.0.2", + "bbpress/bbpress": "<2.6.5", + "bcosca/fatfree": "<3.7.2", + "bedita/bedita": "<4", + "bigfork/silverstripe-form-capture": ">=3,<3.1.1", + "billz/raspap-webgui": "<2.9.5", "bk2k/bootstrap-package": ">=7.1,<7.1.2|>=8,<8.0.8|>=9,<9.0.4|>=9.1,<9.1.3|>=10,<10.0.10|>=11,<11.0.3", + "blueimp/jquery-file-upload": "==6.4.4", + "bmarshall511/wordpress_zero_spam": "<5.2.13", "bolt/bolt": "<3.7.2", - "bolt/core": "<4.1.13", + "bolt/core": "<=4.2", "bottelet/flarepoint": "<2.2.1", + "bref/bref": "<2.1.17", "brightlocal/phpwhois": "<=4.2.5", + "brotkrueml/codehighlight": "<2.7", + "brotkrueml/schema": "<1.13.1|>=2,<2.5.1", + "brotkrueml/typo3-matomo-integration": "<1.3.2", "buddypress/buddypress": "<7.2.1", "bugsnag/bugsnag-laravel": ">=2,<2.0.2", - "bytefury/crater": "<6", + "bytefury/crater": "<6.0.2", "cachethq/cachet": "<2.5.1", - "cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.5.18|>=3.6,<3.6.15|>=3.7,<3.7.7", + "cakephp/cakephp": "<3.10.3|>=4,<4.0.10|>=4.1,<4.1.4|>=4.2,<4.2.12|>=4.3,<4.3.11|>=4.4,<4.4.10", + "cakephp/database": ">=4.2,<4.2.12|>=4.3,<4.3.11|>=4.4,<4.4.10", "cardgate/magento2": "<2.0.33", + "cardgate/woocommerce": "<=3.1.15", "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", "cartalyst/sentry": "<=2.1.6", "catfan/medoo": "<1.7.5", - "centreon/centreon": "<20.10.7", + "causal/oidc": "<2.1", + "cecil/cecil": "<7.47.1", + "centreon/centreon": "<22.10.15", "cesnet/simplesamlphp-module-proxystatistics": "<3.1", + "chriskacerguis/codeigniter-restserver": "<=2.7.1", + "civicrm/civicrm-core": ">=4.2,<4.2.9|>=4.3,<4.3.3", + "ckeditor/ckeditor": "<4.24", + "cockpit-hq/cockpit": "<2.7|==2.7", "codeception/codeception": "<3.1.3|>=4,<4.1.22", - "codeigniter/framework": "<=3.0.6", - "codeigniter4/framework": "<4.1.8", + "codeigniter/framework": "<3.1.9", + "codeigniter4/framework": "<4.4.7", + "codeigniter4/shield": "<1.0.0.0-beta8", "codiad/codiad": "<=2.8.4", - "composer/composer": "<1.10.23|>=2-alpha.1,<2.1.9", - "concrete5/concrete5": "<8.5.5", - "concrete5/core": "<8.5.7", + "composer/composer": "<1.10.27|>=2,<2.2.23|>=2.3,<2.7", + "concrete5/concrete5": "<9.2.8", + "concrete5/core": "<8.5.8|>=9,<9.1", "contao-components/mediaelement": ">=2.14.2,<2.21.1", - "contao/core": ">=2,<3.5.39", - "contao/core-bundle": ">=4,<4.4.56|>=4.5,<4.9.18|>=4.10,<4.11.7|= 4.10.0", - "contao/listing-bundle": ">=4,<4.4.8", - "craftcms/cms": "<3.7.14", - "croogo/croogo": "<3.0.7", + "contao/comments-bundle": ">=2,<4.13.40|>=5.0.0.0-RC1-dev,<5.3.4", + "contao/contao": ">=3,<3.5.37|>=4,<4.4.56|>=4.5,<4.9.40|>=4.10,<4.11.7|>=4.13,<4.13.21|>=5.1,<5.1.4", + "contao/core": "<3.5.39", + "contao/core-bundle": "<4.13.40|>=5,<5.3.4", + "contao/listing-bundle": ">=3,<=3.5.30|>=4,<4.4.8", + "contao/managed-edition": "<=1.5", + "corveda/phpsandbox": "<1.3.5", + "cosenary/instagram": "<=2.3", + "craftcms/cms": "<4.6.2", + "croogo/croogo": "<4", + "cuyz/valinor": "<0.12", + "czproject/git-php": "<4.0.3", + "dapphp/securimage": "<3.6.6", + "darylldoyle/safe-svg": "<1.9.10", "datadog/dd-trace": ">=0.30,<0.30.2", + "datatables/datatables": "<1.10.10", "david-garcia/phpwhois": "<=4.3.1", - "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1", - "directmailteam/direct-mail": "<5.2.4", - "doctrine/annotations": ">=1,<1.2.7", + "dbrisinajumi/d2files": "<1", + "dcat/laravel-admin": "<=2.1.3.0-beta", + "derhansen/fe_change_pwd": "<2.0.5|>=3,<3.0.3", + "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1|>=7,<7.4", + "desperado/xml-bundle": "<=0.1.7", + "devgroup/dotplant": "<2020.09.14-dev", + "directmailteam/direct-mail": "<6.0.3|>=7,<7.0.3|>=8,<9.5.2", + "doctrine/annotations": "<1.2.7", "doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2", - "doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1", + "doctrine/common": "<2.4.3|>=2.5,<2.5.1", "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2|>=3,<3.1.4", "doctrine/doctrine-bundle": "<1.5.2", "doctrine/doctrine-module": "<=0.7.1", - "doctrine/mongodb-odm": ">=1,<1.0.2", - "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", + "doctrine/mongodb-odm": "<1.0.2", + "doctrine/mongodb-odm-bundle": "<3.0.1", "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", - "dolibarr/dolibarr": "<=14.0.5|>= 3.3.beta1, < 13.0.2", - "dompdf/dompdf": ">=0.6,<0.6.2", - "drupal/core": ">=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4", - "drupal/drupal": ">=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4", + "dolibarr/dolibarr": "<=19", + "dompdf/dompdf": "<2.0.4", + "doublethreedigital/guest-entries": "<3.1.2", + "drupal/core": ">=6,<6.38|>=7,<7.96|>=8,<10.1.8|>=10.2,<10.2.2", + "drupal/drupal": ">=5,<5.11|>=6,<6.38|>=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4", + "duncanmcclean/guest-entries": "<3.1.2", "dweeves/magmi": "<=0.7.24", + "ec-cube/ec-cube": "<2.4.4|>=2.11,<=2.17.1|>=3,<=3.0.18.0-patch4|>=4,<=4.1.2", "ecodev/newsletter": "<=4", + "ectouch/ectouch": "<=2.7.2", + "egroupware/egroupware": "<16.1.20170922", + "elefant/cms": "<2.0.7", "elgg/elgg": "<3.3.24|>=4,<4.0.5", + "elijaa/phpmemcacheadmin": "<=1.3", + "encore/laravel-admin": "<=1.8.19", "endroid/qr-code-bundle": "<3.4.2", - "enshrined/svg-sanitize": "<0.13.1", + "enhavo/enhavo-app": "<=0.13.1", + "enshrined/svg-sanitize": "<0.15", "erusev/parsedown": "<1.7.2", "ether/logs": "<3.0.4", - "ezsystems/demobundle": ">=5.4,<5.4.6.1", + "evolutioncms/evolution": "<=3.2.3", + "exceedone/exment": "<4.4.3|>=5,<5.0.3", + "exceedone/laravel-admin": "<2.2.3|==3", + "ezsystems/demobundle": ">=5.4,<5.4.6.1-dev", "ezsystems/ez-support-tools": ">=2.2,<2.2.3", - "ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1", - "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1|>=5.4,<5.4.11.1|>=2017.12,<2017.12.0.1", + "ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1-dev", + "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1-dev|>=5.4,<5.4.11.1-dev|>=2017.12,<2017.12.0.1-dev", "ezsystems/ezplatform": "<=1.13.6|>=2,<=2.5.24", - "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6|>=1.5,<=1.5.25", + "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6|>=1.5,<1.5.29|>=2.3,<2.3.26", "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2.1|>=5,<5.0.1|>=5.1,<5.1.1", - "ezsystems/ezplatform-kernel": "<=1.2.5|>=1.3,<=1.3.1", + "ezsystems/ezplatform-graphql": ">=1.0.0.0-RC1-dev,<1.0.13|>=2.0.0.0-beta1,<2.3.12", + "ezsystems/ezplatform-kernel": "<1.2.5.1-dev|>=1.3,<1.3.35", "ezsystems/ezplatform-rest": ">=1.2,<=1.2.2|>=1.3,<1.3.8", - "ezsystems/ezplatform-richtext": ">=2.3,<=2.3.7", + "ezsystems/ezplatform-richtext": ">=2.3,<2.3.7.1-dev", + "ezsystems/ezplatform-solr-search-engine": ">=1.7,<1.7.12|>=2,<2.0.2|>=3.3,<3.3.15", "ezsystems/ezplatform-user": ">=1,<1.0.1", - "ezsystems/ezpublish-kernel": "<=6.13.8.1|>=7,<7.5.26", - "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.3.5.1", + "ezsystems/ezpublish-kernel": "<6.13.8.2-dev|>=7,<7.5.31", + "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.06,<=2019.03.5.1", "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", - "ezsystems/repository-forms": ">=2.3,<2.3.2.1", + "ezsystems/repository-forms": ">=2.3,<2.3.2.1-dev|>=2.5,<2.5.15", "ezyang/htmlpurifier": "<4.1.1", "facade/ignition": "<1.16.15|>=2,<2.4.2|>=2.5,<2.5.2", + "facturascripts/facturascripts": "<=2022.08", + "fastly/magento2": "<1.2.26", "feehi/cms": "<=2.1.1", - "feehi/feehicms": "<=0.1.3", - "firebase/php-jwt": "<2", - "flarum/core": ">=1,<=1.0.1", - "flarum/sticky": ">=0.1-beta.14,<=0.1-beta.15", - "flarum/tags": "<=0.1-beta.13", + "feehi/feehicms": "<=2.1.1", + "fenom/fenom": "<=2.12.1", + "filegator/filegator": "<7.8", + "filp/whoops": "<2.1.13", + "fineuploader/php-traditional-server": "<=1.2.2", + "firebase/php-jwt": "<6", + "fixpunkt/fp-masterquiz": "<2.2.1|>=3,<3.5.2", + "fixpunkt/fp-newsletter": "<1.1.1|>=2,<2.1.2|>=2.2,<3.2.6", + "flarum/core": "<1.8.5", + "flarum/flarum": "<0.1.0.0-beta8", + "flarum/framework": "<1.8.5", + "flarum/mentions": "<1.6.3", + "flarum/sticky": ">=0.1.0.0-beta14,<=0.1.0.0-beta15", + "flarum/tags": "<=0.1.0.0-beta13", + "floriangaerber/magnesium": "<0.3.1", "fluidtypo3/vhs": "<5.1.1", + "fof/byobu": ">=0.3.0.0-beta2,<1.1.7", + "fof/upload": "<1.2.3", + "foodcoopshop/foodcoopshop": ">=3.2,<3.6.1", "fooman/tcpdf": "<6.2.22", - "forkcms/forkcms": "<=5.9.2", + "forkcms/forkcms": "<5.11.1", "fossar/tcpdf-parser": "<6.2.22", - "francoisjacquet/rosariosis": "<8.1.1", + "francoisjacquet/rosariosis": "<=11.5.1", + "frappant/frp-form-answers": "<3.1.2|>=4,<4.0.2", "friendsofsymfony/oauth2-php": "<1.3", "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", + "friendsofsymfony1/swiftmailer": ">=4,<5.4.13|>=6,<6.2.5", + "friendsofsymfony1/symfony1": ">=1.1,<1.15.19", "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", - "froala/wysiwyg-editor": "<3.2.7", + "friendsoftypo3/openid": ">=4.5,<4.5.31|>=4.7,<4.7.16|>=6,<6.0.11|>=6.1,<6.1.6", + "froala/wysiwyg-editor": "<3.2.7|>=4.0.1,<=4.1.3", + "froxlor/froxlor": "<2.1.9", + "frozennode/administrator": "<=5.0.12", "fuel/core": "<1.8.1", + "funadmin/funadmin": "<=3.2|>=3.3.2,<=3.3.3", "gaoming13/wechat-php-sdk": "<=1.10.2", - "getgrav/grav": "<1.7.28", - "getkirby/cms": "<3.5.8", + "genix/cms": "<=1.1.11", + "getgrav/grav": "<1.7.45", + "getkirby/cms": "<4.1.1", + "getkirby/kirby": "<=2.5.12", "getkirby/panel": "<2.5.14", - "gilacms/gila": "<=1.11.4", + "getkirby/starterkit": "<=3.7.0.2", + "gilacms/gila": "<=1.15.4", + "gleez/cms": "<=1.3|==2", "globalpayments/php-sdk": "<2", + "gogentooss/samlbase": "<1.2.7", + "google/protobuf": "<3.15", "gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3", - "gree/jose": "<=2.2", + "gree/jose": "<2.2.1", "gregwar/rst": "<1.0.3", - "grumpydictator/firefly-iii": "<5.6.5", - "guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1", + "grumpydictator/firefly-iii": "<6.1.7", + "gugoan/economizzer": "<=0.9.0.0-beta1", + "guzzlehttp/guzzle": "<6.5.8|>=7,<7.4.5", + "guzzlehttp/psr7": "<1.9.1|>=2,<2.4.5", + "haffner/jh_captcha": "<=2.1.3|>=3,<=3.0.2", + "harvesthq/chosen": "<1.8.7", "helloxz/imgurl": "<=2.31", + "hhxsv5/laravel-s": "<3.7.36", "hillelcoren/invoice-ninja": "<5.3.35", + "himiklab/yii2-jqgrid-widget": "<1.0.8", "hjue/justwriting": "<=1", "hov/jobfair": "<1.0.13|>=2,<2.0.2", + "httpsoft/http-message": "<1.0.12", + "hyn/multi-tenant": ">=5.6,<5.7.2", + "ibexa/admin-ui": ">=4.2,<4.2.3", + "ibexa/core": ">=4,<4.0.7|>=4.1,<4.1.4|>=4.2,<4.2.3|>=4.5,<4.5.6|>=4.6,<4.6.2", + "ibexa/graphql": ">=2.5,<2.5.31|>=3.3,<3.3.28|>=4.2,<4.2.3", "ibexa/post-install": "<=1.0.4", + "ibexa/solr": ">=4.5,<4.5.4", + "ibexa/user": ">=4,<4.4.3", "icecoder/icecoder": "<=8.1", - "illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10", + "idno/known": "<=1.3.1", + "ilicmiljan/secure-props": ">=1.2,<1.2.2", + "illuminate/auth": "<5.5.10", "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.99999|>=4.2,<=4.2.99999|>=5,<=5.0.99999|>=5.1,<=5.1.99999|>=5.2,<=5.2.99999|>=5.3,<=5.3.99999|>=5.4,<=5.4.99999|>=5.5,<=5.5.49|>=5.6,<=5.6.99999|>=5.7,<=5.7.99999|>=5.8,<=5.8.99999|>=6,<6.18.31|>=7,<7.22.4", "illuminate/database": "<6.20.26|>=7,<7.30.5|>=8,<8.40", "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", "illuminate/view": "<6.20.42|>=7,<7.30.6|>=8,<8.75", - "impresscms/impresscms": "<=1.4.2", - "in2code/femanager": "<5.5.1|>=6,<6.3.1", - "intelliants/subrion": "<=4.2.1", + "imdbphp/imdbphp": "<=5.1.1", + "impresscms/impresscms": "<=1.4.5", + "impresspages/impresspages": "<=1.0.12", + "in2code/femanager": "<5.5.3|>=6,<6.3.4|>=7,<7.2.3", + "in2code/ipandlanguageredirect": "<5.1.2", + "in2code/lux": "<17.6.1|>=18,<24.0.2", + "innologi/typo3-appointments": "<2.0.6", + "intelliants/subrion": "<4.2.2", + "inter-mediator/inter-mediator": "==5.5", + "islandora/islandora": ">=2,<2.4.1", "ivankristianto/phpwhois": "<=4.3", "jackalope/jackalope-doctrine-dbal": "<1.7.4", "james-heinrich/getid3": "<1.9.21", - "joomla/archive": "<1.1.10", + "james-heinrich/phpthumb": "<1.7.12", + "jasig/phpcas": "<1.3.3", + "jcbrand/converse.js": "<3.3.3", + "johnbillion/wp-crontrol": "<1.16.2", + "joomla/application": "<1.0.13", + "joomla/archive": "<1.1.12|>=2,<2.0.1", + "joomla/filesystem": "<1.6.2|>=2,<2.0.1", + "joomla/filter": "<1.4.4|>=2,<2.0.1", + "joomla/framework": "<1.5.7|>=2.5.4,<=3.8.12", + "joomla/input": ">=2,<2.0.2", + "joomla/joomla-cms": ">=2.5,<3.9.12", "joomla/session": "<1.3.1", + "joyqi/hyper-down": "<=2.4.27", + "jsdecena/laracom": "<2.0.9", "jsmitty12/phpwhois": "<5.1", + "juzaweb/cms": "<=3.4", "kazist/phpwhois": "<=4.2.6", + "kelvinmo/simplexrd": "<3.1.1", "kevinpapst/kimai2": "<1.16.7", - "kitodo/presentation": "<3.1.2", + "khodakhah/nodcms": "<=3", + "kimai/kimai": "<2.16", + "kitodo/presentation": "<3.2.3|>=3.3,<3.3.4", "klaviyo/magento2-extension": ">=1,<3", + "knplabs/knp-snappy": "<=1.4.2", + "kohana/core": "<3.3.3", + "krayin/laravel-crm": "<1.2.2", "kreait/firebase-php": ">=3.2,<3.8.1", + "kumbiaphp/kumbiapp": "<=1.1.1", "la-haute-societe/tcpdf": "<6.2.22", + "laminas/laminas-diactoros": "<2.18.1|==2.19|==2.20|==2.21|==2.22|==2.23|>=2.24,<2.24.2|>=2.25,<2.25.2", "laminas/laminas-form": "<2.17.1|>=3,<3.0.2|>=3.1,<3.1.1", "laminas/laminas-http": "<2.14.2", - "laravel/framework": "<6.20.42|>=7,<7.30.6|>=8,<8.75", + "laravel/fortify": "<1.11.1", + "laravel/framework": "<6.20.44|>=7,<7.30.6|>=8,<8.75", + "laravel/laravel": ">=5.4,<5.4.22", "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", "latte/latte": "<2.10.8", - "lavalite/cms": "<=5.8", + "lavalite/cms": "<=9|==10.1", "lcobucci/jwt": ">=3.4,<3.4.6|>=4,<4.0.4|>=4.1,<4.1.5", "league/commonmark": "<0.18.3", "league/flysystem": "<1.1.4|>=2,<2.1.1", + "league/oauth2-server": ">=8.3.2,<8.4.2|>=8.5,<8.5.3", "lexik/jwt-authentication-bundle": "<2.10.7|>=2.11,<2.11.3", - "librenms/librenms": "<=21.11", + "libreform/libreform": ">=2,<=2.0.8", + "librenms/librenms": "<2017.08.18", + "liftkit/database": "<2.13.2", + "lightsaml/lightsaml": "<1.3.5", "limesurvey/limesurvey": "<3.27.19", "livehelperchat/livehelperchat": "<=3.91", - "livewire/livewire": ">2.2.4,<2.2.6", + "livewire/livewire": ">2.2.4,<2.2.6|>=3.3.5,<3.4.9", "lms/routes": "<2.1.1", "localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2", - "magento/community-edition": ">=2,<2.2.10|>=2.3,<2.3.3", - "magento/magento1ce": "<1.9.4.3", - "magento/magento1ee": ">=1,<1.14.4.3", - "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2", + "luyadev/yii-helpers": "<1.2.1", + "magento/community-edition": "<2.4.3.0-patch3|>=2.4.4,<2.4.5", + "magento/core": "<=1.9.4.5", + "magento/magento1ce": "<1.9.4.3-dev", + "magento/magento1ee": ">=1,<1.14.4.3-dev", + "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2.0-patch2", + "magneto/core": "<1.9.4.4-dev", + "maikuolan/phpmussel": ">=1,<1.6", + "mainwp/mainwp": "<=4.4.3.3", + "mantisbt/mantisbt": "<2.26.2", "marcwillmann/turn": "<0.3.3", - "mautic/core": "<4|= 2.13.1", - "mediawiki/core": ">=1.27,<1.27.6|>=1.29,<1.29.3|>=1.30,<1.30.2|>=1.31,<1.31.9|>=1.32,<1.32.6|>=1.32.99,<1.33.3|>=1.33.99,<1.34.3|>=1.34.99,<1.35", - "microweber/microweber": "<1.2.11", + "matyhtf/framework": "<3.0.6", + "mautic/core": "<4.4.12|>=5.0.0.0-alpha,<5.0.4", + "mdanter/ecc": "<2", + "mediawiki/core": "<1.36.2", + "mediawiki/matomo": "<2.4.3", + "mediawiki/semantic-media-wiki": "<4.0.2", + "melisplatform/melis-asset-manager": "<5.0.1", + "melisplatform/melis-cms": "<5.0.1", + "melisplatform/melis-front": "<5.0.1", + "mezzio/mezzio-swoole": "<3.7|>=4,<4.3", + "mgallegos/laravel-jqgrid": "<=1.3", + "microsoft/microsoft-graph": ">=1.16,<1.109.1|>=2,<2.0.1", + "microsoft/microsoft-graph-beta": "<2.0.1", + "microsoft/microsoft-graph-core": "<2.0.2", + "microweber/microweber": "<=2.0.4", + "mikehaertl/php-shellcommand": "<1.6.1", "miniorange/miniorange-saml": "<1.4.3", "mittwald/typo3_forum": "<1.2.1", - "modx/revolution": "<2.8", + "mobiledetect/mobiledetectlib": "<2.8.32", + "modx/revolution": "<=2.8.3.0-patch", + "mojo42/jirafeau": "<4.4", + "mongodb/mongodb": ">=1,<1.9.2", "monolog/monolog": ">=1.8,<1.12", - "moodle/moodle": "<3.9.11|>=3.10-beta,<3.10.8|>=3.11,<3.11.5", + "moodle/moodle": "<=4.3.3", + "mos/cimage": "<0.7.19", + "movim/moxl": ">=0.8,<=0.10", + "movingbytes/social-network": "<=1.2.1", + "mpdf/mpdf": "<=7.1.7", + "munkireport/comment": "<4.1", + "munkireport/managedinstalls": "<2.6", + "munkireport/munki_facts": "<1.5", + "munkireport/munkireport": ">=2.5.3,<5.6.3", + "munkireport/reportdata": "<3.5", + "munkireport/softwareupdate": "<1.6", "mustache/mustache": ">=2,<2.14.1", "namshi/jose": "<2.2", "neoan3-apps/template": "<1.1.1", + "neorazorx/facturascripts": "<2022.04", "neos/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", "neos/form": ">=1.2,<4.3.3|>=5,<5.0.9|>=5.1,<5.1.3", - "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3", + "neos/media-browser": "<7.3.19|>=8,<8.0.16|>=8.1,<8.1.11|>=8.2,<8.2.11|>=8.3,<8.3.9", + "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<5.3.10|>=7,<7.0.9|>=7.1,<7.1.7|>=7.2,<7.2.6|>=7.3,<7.3.4|>=8,<8.0.2", "neos/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", "netgen/tagsbundle": ">=3.4,<3.4.11|>=4,<4.0.15", "nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6", "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", - "nilsteampassnet/teampass": "<=2.1.27.36", - "nukeviet/nukeviet": "<4.3.4", - "nystudio107/craft-seomatic": "<3.3", + "nilsteampassnet/teampass": "<3.0.10", + "nonfiction/nterchange": "<4.1.1", + "notrinos/notrinos-erp": "<=0.7", + "noumo/easyii": "<=0.9", + "novaksolutions/infusionsoft-php-sdk": "<1", + "nukeviet/nukeviet": "<4.5.02", + "nyholm/psr7": "<1.6.1", + "nystudio107/craft-seomatic": "<3.4.12", + "nzedb/nzedb": "<0.8", "nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1", "october/backend": "<1.1.2", - "october/cms": "= 1.1.1|= 1.0.471|= 1.0.469|>=1.0.319,<1.0.469", - "october/october": ">=1.0.319,<1.0.466|>=2.1,<2.1.12", + "october/cms": "<1.0.469|==1.0.469|==1.0.471|==1.1.1", + "october/october": "<=3.4.4", "october/rain": "<1.0.472|>=1.1,<1.1.2", - "october/system": "<1.0.473|>=1.1,<1.1.6|>=2.1,<2.1.12", + "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.34|>=3,<3.5.2", + "omeka/omeka-s": "<4.0.3", "onelogin/php-saml": "<2.10.4", - "oneup/uploader-bundle": "<1.9.3|>=2,<2.1.5", - "opencart/opencart": "<=3.0.3.2", + "oneup/uploader-bundle": ">=1,<1.9.3|>=2,<2.1.5", + "open-web-analytics/open-web-analytics": "<1.7.4", + "opencart/opencart": "<=3.0.3.7|>=4,<4.0.2.3-dev", "openid/php-openid": "<2.3", - "openmage/magento-lts": "<19.4.15|>=20,<20.0.13", - "orchid/platform": ">=9,<9.4.4", + "openmage/magento-lts": "<20.5", + "opensolutions/vimbadmin": "<=3.0.15", + "opensource-workshop/connect-cms": "<1.7.2|>=2,<2.3.2", + "orchid/platform": ">=9,<9.4.4|>=14.0.0.0-alpha4,<14.5", + "oro/calendar-bundle": ">=4.2,<=4.2.6|>=5,<=5.0.6|>=5.1,<5.1.1", + "oro/commerce": ">=4.1,<5.0.11|>=5.1,<5.1.1", "oro/crm": ">=1.7,<1.7.4|>=3.1,<4.1.17|>=4.2,<4.2.7", - "oro/platform": ">=1.7,<1.7.4|>=3.1,<3.1.29|>=4.1,<4.1.17|>=4.2,<4.2.8", + "oro/crm-call-bundle": ">=4.2,<=4.2.5|>=5,<5.0.4|>=5.1,<5.1.1", + "oro/customer-portal": ">=4.1,<=4.1.13|>=4.2,<=4.2.10|>=5,<=5.0.11|>=5.1,<=5.1.3", + "oro/platform": ">=1.7,<1.7.4|>=3.1,<3.1.29|>=4.1,<4.1.17|>=4.2,<=4.2.10|>=5,<=5.0.12|>=5.1,<=5.1.3", + "oxid-esales/oxideshop-ce": "<4.5", + "oxid-esales/paymorrow-module": ">=1,<1.0.2|>=2,<2.0.1", + "packbackbooks/lti-1-3-php-library": "<5", "padraic/humbug_get_contents": "<1.1.2", - "pagarme/pagarme-php": ">=0,<3", + "pagarme/pagarme-php": "<3", "pagekit/pagekit": "<=1.0.18", + "paragonie/ecc": "<2.0.1", "paragonie/random_compat": "<2", - "passbolt/passbolt_api": "<2.11", + "passbolt/passbolt_api": "<4.6.2", + "paypal/adaptivepayments-sdk-php": "<=3.9.2", + "paypal/invoice-sdk-php": "<=3.9", "paypal/merchant-sdk-php": "<3.12", + "paypal/permissions-sdk-php": "<=3.9.1", "pear/archive_tar": "<1.4.14", + "pear/auth": "<1.2.4", + "pear/crypt_gpg": "<1.6.7", + "pear/pear": "<=1.10.1", "pegasus/google-for-jobs": "<1.5.1|>=2,<2.1.1", "personnummer/personnummer": "<3.0.2", "phanan/koel": "<5.1.4", + "phenx/php-svg-lib": "<0.5.2", + "php-censor/php-censor": "<2.0.13|>=2.1,<2.1.5", + "php-mod/curl": "<2.3.2", + "phpbb/phpbb": "<3.2.10|>=3.3,<3.3.1", + "phpems/phpems": ">=6,<=6.1.3", "phpfastcache/phpfastcache": "<6.1.5|>=7,<7.1.2|>=8,<8.0.7", "phpmailer/phpmailer": "<6.5", "phpmussel/phpmussel": ">=1,<1.6", - "phpmyadmin/phpmyadmin": "<4.9.8|>=5,<5.0.3|>=5.1,<5.1.2", - "phpoffice/phpexcel": "<1.8.2", + "phpmyadmin/phpmyadmin": "<5.2.1", + "phpmyfaq/phpmyfaq": "<3.2.5|==3.2.5", + "phpoffice/common": "<0.2.9", + "phpoffice/phpexcel": "<1.8", "phpoffice/phpspreadsheet": "<1.16", - "phpseclib/phpseclib": "<2.0.31|>=3,<3.0.7", - "phpservermon/phpservermon": "<=3.5.2", + "phpseclib/phpseclib": "<2.0.47|>=3,<3.0.36", + "phpservermon/phpservermon": "<3.6", + "phpsysinfo/phpsysinfo": "<3.4.3", "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", "phpwhois/phpwhois": "<=4.2.5", "phpxmlrpc/extras": "<0.6.1", - "pimcore/pimcore": "<=10.2.9", - "pocketmine/pocketmine-mp": "<4.0.7", + "phpxmlrpc/phpxmlrpc": "<4.9.2", + "pi/pi": "<=2.5", + "pimcore/admin-ui-classic-bundle": "<1.3.4", + "pimcore/customer-management-framework-bundle": "<4.0.6", + "pimcore/data-hub": "<1.2.4", + "pimcore/demo": "<10.3", + "pimcore/ecommerce-framework-bundle": "<1.0.10", + "pimcore/perspective-editor": "<1.5.1", + "pimcore/pimcore": "<11.1.6.5-dev|>=11.2,<11.2.3", + "pixelfed/pixelfed": "<0.11.11", + "plotly/plotly.js": "<2.25.2", + "pocketmine/bedrock-protocol": "<8.0.2", + "pocketmine/pocketmine-mp": "<5.11.2", + "pocketmine/raklib": ">=0.14,<0.14.6|>=0.15,<0.15.1", "pressbooks/pressbooks": "<5.18", "prestashop/autoupgrade": ">=4,<4.10.1", - "prestashop/contactform": ">1.0.1,<4.3", + "prestashop/blockreassurance": "<=5.1.3", + "prestashop/blockwishlist": ">=2,<2.1.1", + "prestashop/contactform": ">=1.0.1,<4.3", "prestashop/gamification": "<2.3.2", - "prestashop/prestashop": ">=1.7,<=1.7.8.2", - "prestashop/productcomments": ">=4,<4.2.1", + "prestashop/prestashop": "<8.1.6", + "prestashop/productcomments": "<5.0.2", "prestashop/ps_emailsubscription": "<2.6.1", "prestashop/ps_facetedsearch": "<3.4.1", "prestashop/ps_linklist": "<3.1", - "privatebin/privatebin": "<1.2.2|>=1.3,<1.3.2", - "propel/propel": ">=2-alpha.1,<=2-alpha.7", + "privatebin/privatebin": "<1.4", + "processwire/processwire": "<=3.0.210", + "propel/propel": ">=2.0.0.0-alpha1,<=2.0.0.0-alpha7", "propel/propel1": ">=1,<=1.7.1", - "pterodactyl/panel": "<1.7", + "pterodactyl/panel": "<1.11.6", + "ptheofan/yii2-statemachine": ">=2.0.0.0-RC1-dev,<=2", + "ptrofimov/beanstalk_console": "<1.7.14", + "pubnub/pubnub": "<6.1", "pusher/pusher-php-server": "<2.2.1", - "pwweb/laravel-core": "<=0.3.6-beta", + "pwweb/laravel-core": "<=0.3.6.0-beta", + "pyrocms/pyrocms": "<=3.9.1", + "qcubed/qcubed": "<=3.1.1", + "quickapps/cms": "<=2.0.0.0-beta2", + "rainlab/blog-plugin": "<1.4.1", "rainlab/debugbar-plugin": "<3.1", - "remdex/livehelperchat": "<3.93", + "rainlab/user-plugin": "<=1.4.5", + "rankmath/seo-by-rank-math": "<=1.0.95", + "rap2hpoutre/laravel-log-viewer": "<0.13", + "react/http": ">=0.7,<1.9", + "really-simple-plugins/complianz-gdpr": "<6.4.2", + "redaxo/source": "<=5.15.1", + "remdex/livehelperchat": "<4.29", + "reportico-web/reportico": "<=8.1", + "rhukster/dom-sanitizer": "<1.0.7", "rmccue/requests": ">=1.6,<1.8", - "robrichards/xmlseclibs": "<3.0.4", + "robrichards/xmlseclibs": ">=1,<3.0.4", + "roots/soil": "<4.1", + "rudloff/alltube": "<3.0.3", + "s-cart/core": "<6.9", + "s-cart/s-cart": "<6.9", "sabberworm/php-css-parser": ">=1,<1.0.1|>=2,<2.0.1|>=3,<3.0.1|>=4,<4.0.1|>=5,<5.0.9|>=5.1,<5.1.3|>=5.2,<5.2.1|>=6,<6.0.2|>=7,<7.0.4|>=8,<8.0.1|>=8.1,<8.1.1|>=8.2,<8.2.1|>=8.3,<8.3.1", - "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", - "scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11", + "sabre/dav": ">=1.6,<1.7.11|>=1.8,<1.8.9", + "scheb/two-factor-bundle": "<3.26|>=4,<4.11", "sensiolabs/connect": "<4.2.3", "serluck/phpwhois": "<=4.2.6", - "shopware/core": "<=6.4.6", - "shopware/platform": "<=6.4.6", + "sfroemken/url_redirect": "<=1.2.1", + "sheng/yiicms": "<=1.2", + "shopware/core": "<6.5.8.8-dev|>=6.6.0.0-RC1-dev,<6.6.1", + "shopware/platform": "<6.5.8.8-dev|>=6.6.0.0-RC1-dev,<6.6.1", "shopware/production": "<=6.3.5.2", - "shopware/shopware": "<5.7.7", - "showdoc/showdoc": "<2.10.2", - "silverstripe/admin": ">=1,<1.8.1", - "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", - "silverstripe/cms": "<4.3.6|>=4.4,<4.4.4", + "shopware/shopware": "<6.2.3", + "shopware/storefront": "<=6.4.8.1|>=6.5.8,<6.5.8.7-dev", + "shopxo/shopxo": "<2.2.6", + "showdoc/showdoc": "<2.10.4", + "silverstripe-australia/advancedreports": ">=1,<=2", + "silverstripe/admin": "<1.13.19|>=2,<2.1.8", + "silverstripe/assets": ">=1,<1.11.1", + "silverstripe/cms": "<4.11.3", "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1", "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", - "silverstripe/framework": "<4.7.4", - "silverstripe/graphql": "<3.5.2|>=4-alpha.1,<4-alpha.2", + "silverstripe/framework": "<4.13.39|>=5,<5.1.11", + "silverstripe/graphql": ">=2,<2.0.5|>=3,<3.8.2|>=4,<4.3.7|>=5,<5.1.3", + "silverstripe/hybridsessions": ">=1,<2.4.1|>=2.5,<2.5.1", + "silverstripe/recipe-cms": ">=4.5,<4.5.3", "silverstripe/registry": ">=2.1,<2.1.2|>=2.2,<2.2.1", - "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4", - "silverstripe/subsites": ">=2,<2.1.1", + "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4|>=2.1,<2.1.2", + "silverstripe/silverstripe-omnipay": "<2.5.2|>=3,<3.0.2|>=3.1,<3.1.4|>=3.2,<3.2.1", + "silverstripe/subsites": ">=2,<2.6.1", "silverstripe/taxonomy": ">=1.3,<1.3.1|>=2,<2.0.1", - "silverstripe/userforms": "<3", + "silverstripe/userforms": "<3|>=5,<5.4.2", + "silverstripe/versioned-admin": ">=1,<1.11.1", "simple-updates/phpwhois": "<=1", - "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4", + "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4|==5.0.0.0-alpha12", "simplesamlphp/simplesamlphp": "<1.18.6", "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", + "simplesamlphp/simplesamlphp-module-openid": "<1", + "simplesamlphp/simplesamlphp-module-openidprovider": "<0.9", + "simplesamlphp/xml-security": "==1.6.11", "simplito/elliptic-php": "<1.0.6", + "sitegeist/fluid-components": "<3.5", + "sjbr/sr-freecap": "<2.4.6|>=2.5,<2.5.3", + "slim/psr7": "<1.4.1|>=1.5,<1.5.1|>=1.6,<1.6.1", "slim/slim": "<2.6", - "smarty/smarty": "<3.1.43|>=4,<4.0.3", - "snipe/snipe-it": "<=5.3.7", + "slub/slub-events": "<3.0.3", + "smarty/smarty": "<3.1.48|>=4,<4.3.1", + "snipe/snipe-it": "<=6.2.2", "socalnick/scn-social-auth": "<1.15.2", "socialiteproviders/steam": "<1.1", - "spipu/html2pdf": "<5.2.4", + "spatie/browsershot": "<3.57.4", + "spatie/image-optimizer": "<1.7.3", + "spipu/html2pdf": "<5.2.8", + "spoon/library": "<1.4.1", "spoonity/tcpdf": "<6.2.22", "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1", - "ssddanbrown/bookstack": "<21.12.1", - "stormpath/sdk": ">=0,<9.9.99", - "studio-42/elfinder": "<2.1.59", - "subrion/cms": "<=4.2.1", - "sulu/sulu": "= 2.4.0-RC1|<1.6.44|>=2,<2.2.18|>=2.3,<2.3.8", - "swiftmailer/swiftmailer": ">=4,<5.4.5", + "ssddanbrown/bookstack": "<22.02.3", + "statamic/cms": "<4.46", + "stormpath/sdk": "<9.9.99", + "studio-42/elfinder": "<2.1.62", + "subhh/libconnect": "<7.0.8|>=8,<8.1", + "sukohi/surpass": "<1", + "sulu/sulu": "<1.6.44|>=2,<2.4.17|>=2.5,<2.5.13", + "sumocoders/framework-user-bundle": "<1.4", + "superbig/craft-audit": "<3.0.2", + "swag/paypal": "<5.4.4", + "swiftmailer/swiftmailer": "<6.2.5", + "swiftyedit/swiftyedit": "<1.2", "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", "sylius/grid": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", - "sylius/grid-bundle": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", + "sylius/grid-bundle": "<1.10.1", "sylius/paypal-plugin": ">=1,<1.2.4|>=1.3,<1.3.1", - "sylius/resource-bundle": "<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", - "sylius/sylius": "<1.6.9|>=1.7,<1.7.9|>=1.8,<1.8.3|>=1.9,<1.9.5", + "sylius/resource-bundle": ">=1,<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", + "sylius/sylius": "<1.12.16|>=1.13.0.0-alpha1,<1.13.1", "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", "symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4", + "symbiote/silverstripe-seed": "<6.0.3", "symbiote/silverstripe-versionedfiles": "<=2.0.3", - "symfont/process": ">=0,<4", + "symfont/process": ">=0", "symfony/cache": ">=3.1,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", "symfony/dependency-injection": ">=2,<2.0.17|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/error-handler": ">=4.4,<4.4.4|>=5,<5.0.4", "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", - "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7|>=5.3.14,<=5.3.14|>=5.4.3,<=5.4.3|>=6.0.3,<=6.0.3|= 6.0.3|= 5.4.3|= 5.3.14", + "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7|>=5.3.14,<5.3.15|>=5.4.3,<5.4.4|>=6.0.3,<6.0.4", "symfony/http-foundation": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", - "symfony/http-kernel": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.4.13|>=5,<5.1.5|>=5.2,<5.3.12", + "symfony/http-kernel": ">=2,<4.4.50|>=5,<5.4.20|>=6,<6.0.20|>=6.1,<6.1.12|>=6.2,<6.2.6", "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", "symfony/maker-bundle": ">=1.27,<1.29.2|>=1.30,<1.31.1", "symfony/mime": ">=4.3,<4.3.8", @@ -2311,82 +2762,139 @@ "symfony/proxy-manager-bridge": ">=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/routing": ">=2,<2.0.19", "symfony/security": ">=2,<2.7.51|>=2.8,<3.4.49|>=4,<4.4.24|>=5,<5.2.8", - "symfony/security-bundle": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11|>=5.3,<5.3.12", + "symfony/security-bundle": ">=2,<4.4.50|>=5,<5.4.20|>=6,<6.0.20|>=6.1,<6.1.12|>=6.2,<6.2.6", "symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<3.4.49|>=4,<4.4.24|>=5,<5.2.9", "symfony/security-csrf": ">=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", "symfony/security-guard": ">=2.8,<3.4.48|>=4,<4.4.23|>=5,<5.2.8", - "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<3.4.48|>=4,<4.4.23|>=5,<5.2.8|>=5.3,<5.3.2", + "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7|>=5.1,<5.2.8|>=5.3,<5.3.2|>=5.4,<5.4.31|>=6,<6.3.8", "symfony/serializer": ">=2,<2.0.11|>=4.1,<4.4.35|>=5,<5.3.12", - "symfony/symfony": ">=2,<3.4.49|>=4,<4.4.35|>=5,<5.3.12|>=5.3.14,<=5.3.14|>=5.4.3,<=5.4.3|>=6.0.3,<=6.0.3", + "symfony/symfony": ">=2,<4.4.51|>=5,<5.4.31|>=6,<6.3.8", "symfony/translation": ">=2,<2.0.17", + "symfony/twig-bridge": ">=2,<4.4.51|>=5,<5.4.31|>=6,<6.3.8", + "symfony/ux-autocomplete": "<2.11.2", "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3", "symfony/var-exporter": ">=4.2,<4.2.12|>=4.3,<4.3.8", "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", - "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", - "t3/dce": ">=2.2,<2.6.2", + "symfony/webhook": ">=6.3,<6.3.8", + "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7|>=2.2.0.0-beta1,<2.2.0.0-beta2", + "symphonycms/symphony-2": "<2.6.4", + "t3/dce": "<0.11.5|>=2.2,<2.6.2", "t3g/svg-sanitizer": "<1.0.3", - "tecnickcom/tcpdf": "<6.2.22", - "terminal42/contao-tablelookupwizard": ">=1,<3.3.5", + "t3s/content-consent": "<1.0.3|>=2,<2.0.2", + "tastyigniter/tastyigniter": "<3.3", + "tcg/voyager": "<=1.4", + "tecnickcom/tcpdf": "<=6.7.4", + "terminal42/contao-tablelookupwizard": "<3.3.5", "thelia/backoffice-default-template": ">=2.1,<2.1.2", - "thelia/thelia": ">=2.1-beta.1,<2.1.3", + "thelia/thelia": ">=2.1,<2.1.3", "theonedemon/phpwhois": "<=4.2.5", - "tinymce/tinymce": "<5.10", - "titon/framework": ">=0,<9.9.99", - "topthink/framework": "<6.0.9", - "topthink/think": "<=6.0.9", + "thinkcmf/thinkcmf": "<6.0.8", + "thorsten/phpmyfaq": "<3.2.2", + "tikiwiki/tiki-manager": "<=17.1", + "timber/timber": ">=0.16.6,<1.23.1|>=1.24,<1.24.1|>=2,<2.1", + "tinymce/tinymce": "<7", + "tinymighty/wiki-seo": "<1.2.2", + "titon/framework": "<9.9.99", + "tobiasbg/tablepress": "<=2.0.0.0-RC1", + "topthink/framework": "<6.0.17|>=6.1,<6.1.5|>=8,<8.0.4", + "topthink/think": "<=6.1.1", "topthink/thinkphp": "<=3.2.3", - "tribalsystems/zenario": "<8.8.53370", + "torrentpier/torrentpier": "<=2.4.1", + "tpwd/ke_search": "<4.0.3|>=4.1,<4.6.6|>=5,<5.0.2", + "tribalsystems/zenario": "<9.5.60602", "truckersmp/phpwhois": "<=4.3.1", - "twig/twig": "<1.38|>=2,<2.7", - "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.29|>=10,<10.4.19|>=11,<11.5", - "typo3/cms-backend": ">=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", - "typo3/cms-core": ">=6.2,<=6.2.56|>=7,<=7.6.52|>=8,<=8.7.41|>=9,<9.5.29|>=10,<10.4.19|>=11,<11.5", + "ttskch/pagination-service-provider": "<1", + "twig/twig": "<1.44.7|>=2,<2.15.3|>=3,<3.4.3", + "typo3/cms": "<9.5.29|>=10,<10.4.35|>=11,<11.5.23|>=12,<12.2", + "typo3/cms-backend": "<4.1.14|>=4.2,<4.2.15|>=4.3,<4.3.7|>=4.4,<4.4.4|>=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", + "typo3/cms-core": "<=8.7.56|>=9,<=9.5.47|>=10,<=10.4.44|>=11,<=11.5.36|>=12,<=12.4.14|>=13,<=13.1", + "typo3/cms-extbase": "<6.2.24|>=7,<7.6.8|==8.1.1", + "typo3/cms-fluid": "<4.3.4|>=4.4,<4.4.1", "typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", + "typo3/cms-frontend": "<4.3.9|>=4.4,<4.4.5", + "typo3/cms-install": "<4.1.14|>=4.2,<4.2.16|>=4.3,<4.3.9|>=4.4,<4.4.5|>=12.2,<12.4.8", + "typo3/cms-rte-ckeditor": ">=9.5,<9.5.42|>=10,<10.4.39|>=11,<11.5.30", "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", + "typo3/html-sanitizer": ">=1,<=1.5.2|>=2,<=2.1.3", "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.3.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3", "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", "typo3/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", "typo3fluid/fluid": ">=2,<2.0.8|>=2.1,<2.1.7|>=2.2,<2.2.4|>=2.3,<2.3.7|>=2.4,<2.4.4|>=2.5,<2.5.11|>=2.6,<2.6.10", "ua-parser/uap-php": "<3.8", - "unisharp/laravel-filemanager": "<=2.3", + "uasoft-indonesia/badaso": "<=2.9.7", + "unisharp/laravel-filemanager": "<2.6.4", "userfrosting/userfrosting": ">=0.3.1,<4.6.3", "usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2", + "uvdesk/community-skeleton": "<=1.1.1", + "uvdesk/core-framework": "<=1.1.1", "vanilla/safecurl": "<0.9.2", - "verot/class.upload.php": "<=1.0.3|>=2,<=2.0.4", - "vrana/adminer": "<4.7.9", + "verbb/comments": "<1.5.5", + "verbb/image-resizer": "<2.0.9", + "verbb/knock-knock": "<1.2.8", + "verot/class.upload.php": "<=2.1.6", + "villagedefrance/opencart-overclocked": "<=1.11.1", + "vova07/yii2-fileapi-widget": "<0.1.9", + "vrana/adminer": "<4.8.1", + "waldhacker/hcaptcha": "<2.1.2", "wallabag/tcpdf": "<6.2.22", + "wallabag/wallabag": "<2.6.7", "wanglelecc/laracms": "<=1.0.3", "web-auth/webauthn-framework": ">=3.3,<3.3.4", + "web-feet/coastercms": "==5.5", + "webbuilders-group/silverstripe-kapost-bridge": "<0.4", "webcoast/deferred-image-processing": "<1.0.2", + "webklex/laravel-imap": "<5.3", + "webklex/php-imap": "<5.3", + "webpa/webpa": "<3.1.2", + "wikibase/wikibase": "<=1.39.3", "wikimedia/parsoid": "<0.12.2", "willdurand/js-translation-bundle": "<2.1.1", - "wp-cli/wp-cli": "<2.5", - "yetiforce/yetiforce-crm": "<=6.3", + "winter/wn-backend-module": "<1.2.4", + "winter/wn-dusk-plugin": "<2.1", + "winter/wn-system-module": "<1.2.4", + "wintercms/winter": "<=1.2.3", + "woocommerce/woocommerce": "<6.6", + "wp-cli/wp-cli": ">=0.12,<2.5", + "wp-graphql/wp-graphql": "<=1.14.5", + "wp-premium/gravityforms": "<2.4.21", + "wpanel/wpanel4-cms": "<=4.3.1", + "wpcloud/wp-stateless": "<3.2", + "wpglobus/wpglobus": "<=1.9.6", + "wwbn/avideo": "<=12.4", + "xataface/xataface": "<3", + "xpressengine/xpressengine": "<3.0.15", + "yab/quarx": "<2.4.5", + "yeswiki/yeswiki": "<4.1", + "yetiforce/yetiforce-crm": "<=6.4", "yidashi/yii2cmf": "<=2", "yii2mod/yii2-cms": "<1.9.2", - "yiisoft/yii": ">=1.1.14,<1.1.15", + "yiisoft/yii": "<1.1.29", "yiisoft/yii2": "<2.0.38", + "yiisoft/yii2-authclient": "<2.2.15", "yiisoft/yii2-bootstrap": "<2.0.4", "yiisoft/yii2-dev": "<2.0.43", "yiisoft/yii2-elasticsearch": "<2.0.5", - "yiisoft/yii2-gii": "<2.0.4", + "yiisoft/yii2-gii": "<=2.2.4", "yiisoft/yii2-jui": "<2.0.4", "yiisoft/yii2-redis": "<2.0.8", + "yikesinc/yikes-inc-easy-mailchimp-extender": "<6.8.6", "yoast-seo-for-typo3/yoast_seo": "<7.2.3", "yourls/yourls": "<=1.8.2", + "yuan1994/tpadmin": "<=1.3.12", + "zencart/zencart": "<=1.5.7.0-beta", "zendesk/zendesk_api_client_php": "<2.2.11", "zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3", "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2", "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", - "zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5", + "zendframework/zend-db": "<2.2.10|>=2.3,<2.3.5", "zendframework/zend-developer-tools": ">=1.2.2,<1.2.3", - "zendframework/zend-diactoros": ">=1,<1.8.4", - "zendframework/zend-feed": ">=1,<2.10.3", + "zendframework/zend-diactoros": "<1.8.4", + "zendframework/zend-feed": "<2.10.3", "zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1", - "zendframework/zend-http": ">=1,<2.8.1", + "zendframework/zend-http": "<2.8.1", "zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6", "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", - "zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2", + "zendframework/zend-mail": "<2.4.11|>=2.5,<2.7.2", "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1", "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4", "zendframework/zend-validator": ">=2.3,<2.3.6", @@ -2394,13 +2902,22 @@ "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6", "zendframework/zendframework": "<=3", "zendframework/zendframework1": "<1.12.20", - "zendframework/zendopenid": ">=2,<2.0.2", + "zendframework/zendopenid": "<2.0.2", + "zendframework/zendrest": "<2.0.2", + "zendframework/zendservice-amazon": "<2.0.3", + "zendframework/zendservice-api": "<1", + "zendframework/zendservice-audioscrobbler": "<2.0.2", + "zendframework/zendservice-nirvanix": "<2.0.2", + "zendframework/zendservice-slideshare": "<2.0.2", + "zendframework/zendservice-technorati": "<2.0.2", + "zendframework/zendservice-windowsazure": "<2.0.2", "zendframework/zendxml": ">=1,<1.0.1", + "zenstruck/collection": "<0.2.1", "zetacomponents/mail": "<1.8.2", "zf-commons/zfc-user": "<1.2.2", "zfcampus/zf-apigility-doctrine": ">=1,<1.0.3", "zfr/zfr-oauth2-server-module": "<0.1.2", - "zoujingli/thinkadmin": "<6.0.22" + "zoujingli/thinkadmin": "<=6.1.53" }, "type": "metapackage", "notification-url": "https://packagist.org/downloads/", @@ -2420,6 +2937,9 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", + "keywords": [ + "dev" + ], "support": { "issues": "https://github.com/Roave/SecurityAdvisories/issues", "source": "https://github.com/Roave/SecurityAdvisories/tree/latest" @@ -2434,20 +2954,20 @@ "type": "tidelift" } ], - "time": "2022-02-05T03:12:57+00:00" + "time": "2024-05-14T22:04:50+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + "reference": "92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54", + "reference": "92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54", "shasum": "" }, "require": { @@ -2481,7 +3001,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.3" }, "funding": [ { @@ -2489,20 +3009,20 @@ "type": "github" } ], - "time": "2020-11-30T08:15:22+00:00" + "time": "2024-03-01T13:45:45+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.3", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770", "shasum": "" }, "require": { @@ -2555,7 +3075,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.5" }, "funding": [ { @@ -2563,20 +3083,20 @@ "type": "github" } ], - "time": "2020-11-30T08:04:30+00:00" + "time": "2022-09-14T12:31:48+00:00" }, { "name": "sebastian/diff", - "version": "3.0.3", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + "reference": "98ff311ca519c3aa73ccd3de053bdb377171d7b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/98ff311ca519c3aa73ccd3de053bdb377171d7b6", + "reference": "98ff311ca519c3aa73ccd3de053bdb377171d7b6", "shasum": "" }, "require": { @@ -2621,7 +3141,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.6" }, "funding": [ { @@ -2629,20 +3149,20 @@ "type": "github" } ], - "time": "2020-11-30T07:59:04+00:00" + "time": "2024-03-02T06:16:36+00:00" }, { "name": "sebastian/environment", - "version": "4.2.4", + "version": "4.2.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" + "reference": "56932f6049a0482853056ffd617c91ffcc754205" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/56932f6049a0482853056ffd617c91ffcc754205", + "reference": "56932f6049a0482853056ffd617c91ffcc754205", "shasum": "" }, "require": { @@ -2684,7 +3204,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.5" }, "funding": [ { @@ -2692,24 +3212,24 @@ "type": "github" } ], - "time": "2020-11-30T07:53:42+00:00" + "time": "2024-03-01T13:49:59+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.4", + "version": "3.1.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" + "reference": "1939bc8fd1d39adcfa88c5b35335910869214c56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1939bc8fd1d39adcfa88c5b35335910869214c56", + "reference": "1939bc8fd1d39adcfa88c5b35335910869214c56", "shasum": "" }, "require": { - "php": ">=7.0", + "php": ">=7.2", "sebastian/recursion-context": "^3.0" }, "require-dev": { @@ -2761,7 +3281,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.6" }, "funding": [ { @@ -2769,27 +3289,30 @@ "type": "github" } ], - "time": "2021-11-11T13:51:24+00:00" + "time": "2024-03-02T06:21:38+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "91c7c47047a971f02de57ed6f040087ef110c5d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/91c7c47047a971f02de57ed6f040087ef110c5d9", + "reference": "91c7c47047a971f02de57ed6f040087ef110c5d9", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -2797,7 +3320,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2822,22 +3345,28 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" + "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.5" }, - "time": "2017-04-27T15:39:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:13:16+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.4", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + "reference": "ac5b293dba925751b808e02923399fb44ff0d541" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/ac5b293dba925751b808e02923399fb44ff0d541", + "reference": "ac5b293dba925751b808e02923399fb44ff0d541", "shasum": "" }, "require": { @@ -2873,7 +3402,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.5" }, "funding": [ { @@ -2881,20 +3410,20 @@ "type": "github" } ], - "time": "2020-11-30T07:40:27+00:00" + "time": "2024-03-01T13:54:02+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + "reference": "1d439c229e61f244ff1f211e5c99737f90c67def" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/1d439c229e61f244ff1f211e5c99737f90c67def", + "reference": "1d439c229e61f244ff1f211e5c99737f90c67def", "shasum": "" }, "require": { @@ -2928,7 +3457,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.3" }, "funding": [ { @@ -2936,20 +3465,20 @@ "type": "github" } ], - "time": "2020-11-30T07:37:18+00:00" + "time": "2024-03-01T13:56:04+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + "reference": "9bfd3c6f1f08c026f542032dfb42813544f7d64c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/9bfd3c6f1f08c026f542032dfb42813544f7d64c", + "reference": "9bfd3c6f1f08c026f542032dfb42813544f7d64c", "shasum": "" }, "require": { @@ -2991,7 +3520,7 @@ "homepage": "http://www.github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.2" }, "funding": [ { @@ -2999,20 +3528,20 @@ "type": "github" } ], - "time": "2020-11-30T07:34:24+00:00" + "time": "2024-03-01T14:07:30+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + "reference": "72a7f7674d053d548003b16ff5a106e7e0e06eee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/72a7f7674d053d548003b16ff5a106e7e0e06eee", + "reference": "72a7f7674d053d548003b16ff5a106e7e0e06eee", "shasum": "" }, "require": { @@ -3042,8 +3571,7 @@ "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.3" }, "funding": [ { @@ -3051,7 +3579,63 @@ "type": "github" } ], - "time": "2020-11-30T07:30:19+00:00" + "time": "2024-03-01T13:59:09+00:00" + }, + { + "name": "sebastian/type", + "version": "1.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "18f071c3a29892b037d35e6b20ddf3ea39b42874" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/18f071c3a29892b037d35e6b20ddf3ea39b42874", + "reference": "18f071c3a29892b037d35e6b20ddf3ea39b42874", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.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", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/1.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-01T14:04:07+00:00" }, { "name": "sebastian/version", @@ -3102,16 +3686,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.2", + "version": "3.9.2", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", "shasum": "" }, "require": { @@ -3121,11 +3705,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -3140,34 +3724,58 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2021-12-12T21:44:58+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-04-23T20:25:34+00:00" }, { "name": "symfony/console", - "version": "v5.4.3", + "version": "v5.4.39", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a2a86ec353d825c75856c6fd14fac416a7bdb6b8" + "reference": "f3e591c48688a0cfa1a3296205926c05e84b22b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a2a86ec353d825c75856c6fd14fac416a7bdb6b8", - "reference": "a2a86ec353d825c75856c6fd14fac416a7bdb6b8", + "url": "https://api.github.com/repos/symfony/console/zipball/f3e591c48688a0cfa1a3296205926c05e84b22b1", + "reference": "f3e591c48688a0cfa1a3296205926c05e84b22b1", "shasum": "" }, "require": { @@ -3232,12 +3840,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.3" + "source": "https://github.com/symfony/console/tree/v5.4.39" }, "funding": [ { @@ -3253,29 +3861,29 @@ "type": "tidelift" } ], - "time": "2022-01-26T16:28:35+00:00" + "time": "2024-04-18T08:26:06+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.0", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", - "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3304,7 +3912,7 @@ "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.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" }, "funding": [ { @@ -3320,20 +3928,20 @@ "type": "tidelift" } ], - "time": "2021-07-12T14:48:14+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/finder", - "version": "v5.4.3", + "version": "v5.4.39", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d" + "reference": "f6a96e4fcd468a25fede16ee665f50ced856bd0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d", - "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d", + "url": "https://api.github.com/repos/symfony/finder/zipball/f6a96e4fcd468a25fede16ee665f50ced856bd0a", + "reference": "f6a96e4fcd468a25fede16ee665f50ced856bd0a", "shasum": "" }, "require": { @@ -3367,7 +3975,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.3" + "source": "https://github.com/symfony/finder/tree/v5.4.39" }, "funding": [ { @@ -3383,20 +3991,20 @@ "type": "tidelift" } ], - "time": "2022-01-26T16:34:36+00:00" + "time": "2024-04-18T08:26:06+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.24.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -3410,21 +4018,18 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-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": [ @@ -3449,7 +4054,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -3465,20 +4070,20 @@ "type": "tidelift" } ], - "time": "2021-10-20T20:35:02+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.24.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", "shasum": "" }, "require": { @@ -3489,9 +4094,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -3530,7 +4132,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" }, "funding": [ { @@ -3546,20 +4148,20 @@ "type": "tidelift" } ], - "time": "2021-11-23T21:10:46+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.24.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", "shasum": "" }, "require": { @@ -3570,9 +4172,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -3614,7 +4213,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" }, "funding": [ { @@ -3630,20 +4229,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.24.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -3657,21 +4256,18 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-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": [ @@ -3697,7 +4293,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -3713,20 +4309,20 @@ "type": "tidelift" } ], - "time": "2021-11-30T18:21:41+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.24.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", - "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", "shasum": "" }, "require": { @@ -3734,9 +4330,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -3776,7 +4369,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" }, "funding": [ { @@ -3792,20 +4385,20 @@ "type": "tidelift" } ], - "time": "2021-06-05T21:20:04+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.24.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -3813,9 +4406,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -3859,7 +4449,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -3875,33 +4465,34 @@ "type": "tidelift" } ], - "time": "2021-09-13T13:58:33+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.2.0", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.0" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, - "suggest": { - "symfony/service-implementation": "" + "conflict": { + "ext-psr": "<1.1|>=2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3911,7 +4502,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3938,7 +4532,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/master" + "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" }, "funding": [ { @@ -3954,47 +4548,47 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/string", - "version": "v5.4.3", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10" + "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/92043b7d8383e48104e411bc9434b260dbeb5a10", - "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10", + "url": "https://api.github.com/repos/symfony/string/zipball/ffeb9591c61f65a68d47f77d12b83fa530227a69", + "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { - "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|^6.0" + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -4024,7 +4618,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.3" + "source": "https://github.com/symfony/string/tree/v6.4.7" }, "funding": [ { @@ -4040,7 +4634,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "szepeviktor/phpstan-wordpress", @@ -4108,16 +4702,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -4146,7 +4740,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -4154,25 +4748,25 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2024-03-03T12:36:25+00:00" }, { "name": "webmozart/assert", - "version": "1.10.0", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" + "ext-ctype": "*", + "php": "^7.2 || ^8.0" }, "conflict": { "phpstan/phpstan": "<0.12.20", @@ -4210,9 +4804,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" + "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, - "time": "2021-03-09T10:59:23+00:00" + "time": "2022-06-03T18:03:27+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -4265,18 +4859,186 @@ }, "time": "2020-05-13T23:57:56+00:00" }, + { + "name": "wp-launchpad/core", + "version": "v0.2.6", + "source": { + "type": "git", + "url": "https://github.com/wp-launchpad/core.git", + "reference": "563ee994bd5d058341368ecd053e7a3145791d26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-launchpad/core/zipball/563ee994bd5d058341368ecd053e7a3145791d26", + "reference": "563ee994bd5d058341368ecd053e7a3145791d26", + "shasum": "" + }, + "require": { + "league/container": "^3.3", + "php": ">=7.1", + "wp-launchpad/dispatcher": "^1.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "phpcompatibility/phpcompatibility-wp": "^2.0", + "phpstan/phpstan": "^1.10", + "szepeviktor/phpstan-wordpress": "^1.3", + "wp-coding-standards/wpcs": "^3", + "wp-launchpad/cli": "^1.0.2", + "wp-launchpad/phpunit-wp-hooks": "^1.0", + "wp-media/phpunit": "^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaunchpadCore\\": "inc/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "CrochetFeve0251" + } + ], + "description": "Core from Launchpad", + "keywords": [ + "wordpress" + ], + "support": { + "issues": "https://github.com/wp-launchpad/core/issues", + "source": "https://github.com/wp-launchpad/core/tree/v0.2.6" + }, + "time": "2024-05-13T10:50:45+00:00" + }, + { + "name": "wp-launchpad/dispatcher", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/wp-launchpad/dispatcher.git", + "reference": "76d6b61c5324f2aa750a86b1acb692723a3b368f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-launchpad/dispatcher/zipball/76d6b61c5324f2aa750a86b1acb692723a3b368f", + "reference": "76d6b61c5324f2aa750a86b1acb692723a3b368f", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "wp-launchpad/cli": "^1.0.2", + "wp-launchpad/phpunit-wp-hooks": "^1.0", + "wp-media/phpunit": "^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaunchpadDispatcher\\": "inc/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "CrochetFeve0251" + } + ], + "description": "Dispatcher library for Launchpad framework", + "keywords": [ + "wordpress" + ], + "support": { + "issues": "https://github.com/wp-launchpad/dispatcher/issues", + "source": "https://github.com/wp-launchpad/dispatcher/tree/v1.0.0" + }, + "time": "2024-04-13T15:05:16+00:00" + }, + { + "name": "wp-launchpad/framework-options", + "version": "v0.1.2", + "source": { + "type": "git", + "url": "https://github.com/wp-launchpad/framework-options.git", + "reference": "0941149bc7ba628a1c4fdf380eeef69969ed5ced" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-launchpad/framework-options/zipball/0941149bc7ba628a1c4fdf380eeef69969ed5ced", + "reference": "0941149bc7ba628a1c4fdf380eeef69969ed5ced", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "wp-launchpad/core": "^0.2.4", + "wp-launchpad/options": "^0.1" + }, + "require-dev": { + "wp-media/phpunit": "^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaunchpadFrameworkOptions\\": "inc/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "description": "Options library for the framework Launchpad", + "support": { + "issues": "https://github.com/wp-launchpad/framework-options/issues", + "source": "https://github.com/wp-launchpad/framework-options/tree/v0.1.2" + }, + "time": "2024-05-09T13:30:49+00:00" + }, + { + "name": "wp-launchpad/options", + "version": "v0.1.2", + "source": { + "type": "git", + "url": "https://github.com/wp-launchpad/options.git", + "reference": "fd55e0a440e819a1bb77d9140491b1c5faf648f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-launchpad/options/zipball/fd55e0a440e819a1bb77d9140491b1c5faf648f6", + "reference": "fd55e0a440e819a1bb77d9140491b1c5faf648f6", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaunchpadOptions\\": "inc/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "description": "Options library for Launchpad", + "support": { + "issues": "https://github.com/wp-launchpad/options/issues", + "source": "https://github.com/wp-launchpad/options/tree/v0.1.2" + }, + "time": "2024-05-09T13:05:37+00:00" + }, { "name": "wp-media/phpunit", - "version": "v2.1", + "version": "v3.0.3", "source": { "type": "git", "url": "https://github.com/wp-media/phpunit.git", - "reference": "f832eebe3906fc2fae2ad936b4c4a2acf5d697b5" + "reference": "29a596a83c4d3893f63ea6ae21301bee8be41251" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-media/phpunit/zipball/f832eebe3906fc2fae2ad936b4c4a2acf5d697b5", - "reference": "f832eebe3906fc2fae2ad936b4c4a2acf5d697b5", + "url": "https://api.github.com/repos/wp-media/phpunit/zipball/29a596a83c4d3893f63ea6ae21301bee8be41251", + "reference": "29a596a83c4d3893f63ea6ae21301bee8be41251", "shasum": "" }, "require": { @@ -4310,20 +5072,20 @@ "issues": "https://github.com/wp-media/phpunit/issues", "source": "https://github.com/wp-media/phpunit" }, - "time": "2021-09-30T19:36:23+00:00" + "time": "2023-05-10T15:56:16+00:00" }, { "name": "yoast/phpunit-polyfills", - "version": "1.0.3", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", - "reference": "5ea3536428944955f969bc764bbe09738e151ada" + "reference": "a0f7d708794a738f328d7b6c94380fd1d6c40446" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/5ea3536428944955f969bc764bbe09738e151ada", - "reference": "5ea3536428944955f969bc764bbe09738e151ada", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/a0f7d708794a738f328d7b6c94380fd1d6c40446", + "reference": "a0f7d708794a738f328d7b6c94380fd1d6c40446", "shasum": "" }, "require": { @@ -4331,13 +5093,14 @@ "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "require-dev": { - "yoast/yoastcs": "^2.2.0" + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "yoast/yoastcs": "^3.1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev", - "dev-develop": "1.x-dev" + "dev-main": "2.x-dev" } }, "autoload": { @@ -4369,37 +5132,38 @@ ], "support": { "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", + "security": "https://github.com/Yoast/PHPUnit-Polyfills/security/policy", "source": "https://github.com/Yoast/PHPUnit-Polyfills" }, - "time": "2021-11-23T01:37:03+00:00" + "time": "2024-04-05T16:01:51+00:00" }, { "name": "yoast/wp-test-utils", - "version": "1.0.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/Yoast/wp-test-utils.git", - "reference": "21df3a08974ee62f489f64e34be7f26a32ec872c" + "reference": "2e0f62e0281e4859707c5f13b7da1422aa1c8f7b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/wp-test-utils/zipball/21df3a08974ee62f489f64e34be7f26a32ec872c", - "reference": "21df3a08974ee62f489f64e34be7f26a32ec872c", + "url": "https://api.github.com/repos/Yoast/wp-test-utils/zipball/2e0f62e0281e4859707c5f13b7da1422aa1c8f7b", + "reference": "2e0f62e0281e4859707c5f13b7da1422aa1c8f7b", "shasum": "" }, "require": { - "brain/monkey": "^2.6.0", + "brain/monkey": "^2.6.1", "php": ">=5.6", - "yoast/phpunit-polyfills": "^1.0.1" + "yoast/phpunit-polyfills": "^1.1.0" }, "require-dev": { - "yoast/yoastcs": "^2.2.0" + "yoast/yoastcs": "^2.3.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev", - "dev-develop": "1.x-dev" + "dev-develop": "1.x-dev", + "dev-main": "1.x-dev" } }, "autoload": { @@ -4432,6 +5196,7 @@ "brainmonkey", "integration-testing", "phpunit", + "testing", "unit-testing", "wordpress" ], @@ -4439,7 +5204,7 @@ "issues": "https://github.com/Yoast/wp-test-utils/issues", "source": "https://github.com/Yoast/wp-test-utils" }, - "time": "2021-09-27T05:50:36+00:00" + "time": "2023-09-27T10:25:08+00:00" } ], "aliases": [], @@ -4455,5 +5220,5 @@ "platform-dev": { "php": "^7 || ^8" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } diff --git a/configs/parameters.php b/configs/parameters.php new file mode 100644 index 0000000..d0c8030 --- /dev/null +++ b/configs/parameters.php @@ -0,0 +1,10 @@ + sanitize_key( 'RocketCDN' ), + 'template_basepath' => realpath( plugin_dir_path( __DIR__ ) ) . '/views/' , + 'assets_baseurl' => plugin_dir_url( __DIR__ ) . 'assets/', + 'is_mu_plugin' => false, + 'translation_key' => 'rocketcdn', + 'prefix' => 'rocketcdn_' +]; \ No newline at end of file diff --git a/configs/providers.php b/configs/providers.php new file mode 100644 index 0000000..6de45fc --- /dev/null +++ b/configs/providers.php @@ -0,0 +1,10 @@ +check() ) { - require realpath( plugin_dir_path( __FILE__ ) ) . '/includes/main.php'; + require __DIR__ . '/src/Dependencies/LaunchpadCore/boot.php'; + + boot( __FILE__ ); } unset( $rocketcdn_rq_check ); diff --git a/src/API/Client.php b/src/API/Client.php index 8976c00..2695dcf 100644 --- a/src/API/Client.php +++ b/src/API/Client.php @@ -3,26 +3,13 @@ namespace RocketCDN\API; -use RocketCDN\Options\Options; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; -class Client { - const ROCKETCDN_API = 'https://rocketcdn.me/api/'; - - /** - * Options instance - * - * @var Options - */ - private $options; +class Client implements OptionsAwareInterface { + use OptionsAwareTrait; - /** - * Instantiate the class - * - * @param Options $options Options instance. - */ - public function __construct( Options $options ) { - $this->options = $options; - } + const ROCKETCDN_API = 'https://rocketcdn.me/api/'; /** * Gets the customer data associated with the API key diff --git a/src/API/ServiceProvider.php b/src/API/ServiceProvider.php index 0de9516..9f5862a 100644 --- a/src/API/ServiceProvider.php +++ b/src/API/ServiceProvider.php @@ -3,25 +3,11 @@ namespace RocketCDN\API; -use RocketCDN\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; class ServiceProvider extends AbstractServiceProvider { - /** - * Services provided by this provider - * - * @var array - */ - protected $provides = [ - 'api_client', - ]; - - /** - * Registers the provided classes - * - * @return void - */ - public function register() { - $this->getContainer()->add( 'api_client', 'RocketCDN\API\Client' ) - ->addArgument( $this->getContainer()->get( 'options' ) ); - } + public function define() { + $this->register_service(Client::class); + } } diff --git a/src/Admin/AdminBar/AdminBar.php b/src/Admin/AdminBar/AdminBar.php index 8510908..a24d795 100644 --- a/src/Admin/AdminBar/AdminBar.php +++ b/src/Admin/AdminBar/AdminBar.php @@ -4,15 +4,12 @@ namespace RocketCDN\Admin\AdminBar; use RocketCDN\API\Client; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; use RocketCDN\Options\Options; -class AdminBar { - /** - * Options instance - * - * @var Options - */ - private $options; +class AdminBar implements OptionsAwareInterface { + use OptionsAwareTrait; /** * API client instance @@ -31,12 +28,10 @@ class AdminBar { /** * Instantiate the class * - * @param Options $options Options instance. * @param Client $api_client API client instance. * @param string $assets_baseurl Assets base URL. */ - public function __construct( Options $options, Client $api_client, $assets_baseurl ) { - $this->options = $options; + public function __construct( Client $api_client, $assets_baseurl ) { $this->api_client = $api_client; $this->assets_baseurl = $assets_baseurl; } diff --git a/src/Admin/AdminBar/ServiceProvider.php b/src/Admin/AdminBar/ServiceProvider.php index 45c1fa3..c50000c 100644 --- a/src/Admin/AdminBar/ServiceProvider.php +++ b/src/Admin/AdminBar/ServiceProvider.php @@ -3,39 +3,29 @@ namespace RocketCDN\Admin\AdminBar; -use RocketCDN\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use RocketCDN\API\Client; +use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; +use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - /** - * Services provided by this provider - * - * @var array - */ - protected $provides = [ - 'admin_bar', - 'admin_bar_subscriber', - ]; + public function get_common_subscribers(): array + { + return [ + \RocketCDN\Admin\AdminBar\Subscriber::class + ]; + } - /** - * Subscribers provided by this provider - * - * @var array - */ - public $subscribers = [ - 'admin_bar_subscriber', - ]; + public function define() { + $this->register_service(AdminBar::class)->set_definition(function (DefinitionInterface $definition) { + $definition->addArguments([ + Client::class, + 'assets_baseurl' + ]); + }); - /** - * Registers the provided classes - * - * @return void - */ - public function register() { - $this->getContainer()->add( 'admin_bar', 'RocketCDN\Admin\AdminBar\AdminBar' ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'api_client' ) ) - ->addArgument( $this->getContainer()->get( 'assets_baseurl' ) ); - $this->getContainer()->add( 'admin_bar_subscriber', 'RocketCDN\Admin\AdminBar\Subscriber' ) - ->addArgument( $this->getContainer()->get( 'admin_bar' ) ); - } + $this->register_service(\RocketCDN\Admin\AdminBar\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument(AdminBar::class); + }); + } } diff --git a/src/Admin/Notices/Notices.php b/src/Admin/Notices/Notices.php index 0b24ea2..0fa916e 100644 --- a/src/Admin/Notices/Notices.php +++ b/src/Admin/Notices/Notices.php @@ -4,15 +4,12 @@ namespace RocketCDN\Admin\Notices; use RocketCDN\API\Client; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; use RocketCDN\Options\Options; -class Notices { - /** - * Options instance - * - * @var Options - */ - private $options; +class Notices implements OptionsAwareInterface { + use OptionsAwareTrait; /** * API client instance @@ -24,11 +21,9 @@ class Notices { /** * Instantiate the class * - * @param Options $options Options instance. * @param Client $api_client API client instance. */ - public function __construct( Options $options, Client $api_client ) { - $this->options = $options; + public function __construct( Client $api_client ) { $this->api_client = $api_client; } diff --git a/src/Admin/Notices/ServiceProvider.php b/src/Admin/Notices/ServiceProvider.php index 377baf6..435ab99 100644 --- a/src/Admin/Notices/ServiceProvider.php +++ b/src/Admin/Notices/ServiceProvider.php @@ -3,38 +3,27 @@ namespace RocketCDN\Admin\Notices; -use RocketCDN\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use RocketCDN\API\Client; +use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; +use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - /** - * Services provided by this provider - * - * @var array - */ - protected $provides = [ - 'admin_notices', - 'admin_notices_subscriber', - ]; - /** - * Subscribers provided by this provider - * - * @var array - */ - public $subscribers = [ - 'admin_notices_subscriber', - ]; + public function get_common_subscribers(): array + { + return [ + \RocketCDN\Admin\Notices\Subscriber::class + ]; + } - /** - * Registers the provided classes - * - * @return void - */ - public function register() { - $this->getContainer()->add( 'admin_notices', 'RocketCDN\Admin\Notices\Notices' ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'api_client' ) ); - $this->getContainer()->add( 'admin_notices_subscriber', 'RocketCDN\Admin\Notices\Subscriber' ) - ->addArgument( $this->getContainer()->get( 'admin_notices' ) ); - } + public function define() { + $this->register_service(Notices::class)->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument(Client::class); + }); + + $this->register_service(\RocketCDN\Admin\Notices\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument(Notices::class); + }); + } } diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 1ce0390..ef73642 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -3,16 +3,14 @@ namespace RocketCDN\Admin\Settings; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; use RocketCDN\Options\Options; use RocketCDN\API\Client; -class Page { - /** - * Options instance - * - * @var Options - */ - private $options; +class Page implements OptionsAwareInterface { + + use OptionsAwareTrait; /** * API Client instance @@ -38,13 +36,11 @@ class Page { /** * Instantiates the class * - * @param Options $options Options instance. * @param Client $api_client API Client instance. * @param string $template_basepath Base filepath for the template. * @param string $assets_baseurl Base URL for the assets. */ - public function __construct( Options $options, Client $api_client, $template_basepath, $assets_baseurl ) { - $this->options = $options; + public function __construct( Client $api_client, $template_basepath, $assets_baseurl ) { $this->api_client = $api_client; $this->template_basepath = $template_basepath; $this->assets_baseurl = $assets_baseurl; diff --git a/src/Admin/Settings/ServiceProvider.php b/src/Admin/Settings/ServiceProvider.php index e683af9..bb829c7 100644 --- a/src/Admin/Settings/ServiceProvider.php +++ b/src/Admin/Settings/ServiceProvider.php @@ -3,40 +3,30 @@ namespace RocketCDN\Admin\Settings; -use RocketCDN\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use RocketCDN\API\Client; +use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; +use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - /** - * Services provided by this provider - * - * @var array - */ - protected $provides = [ - 'admin_page', - 'admin_subscriber', - ]; + public function get_common_subscribers(): array + { + return [ + \RocketCDN\Admin\Settings\Subscriber::class + ]; + } - /** - * Subscribers provided by this provider - * - * @var array - */ - public $subscribers = [ - 'admin_subscriber', - ]; + public function define() { + $this->register_service(Page::class)->set_definition(function (DefinitionInterface $definition) { + $definition->addArguments([ + Client::class, + 'template_basepath', + 'assets_baseurl', + ]); + }); - /** - * Registers the provided classes - * - * @return void - */ - public function register() { - $this->getContainer()->add( 'admin_page', 'RocketCDN\Admin\Settings\Page' ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'api_client' ) ) - ->addArgument( $this->getContainer()->get( 'template_basepath' ) ) - ->addArgument( $this->getContainer()->get( 'assets_baseurl' ) ); - $this->getContainer()->add( 'admin_subscriber', 'RocketCDN\Admin\Settings\Subscriber' ) - ->addArgument( $this->getContainer()->get( 'admin_page' ) ); - } + $this->register_service(\RocketCDN\Admin\Settings\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument(Page::class); + }); + } } diff --git a/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php b/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php deleted file mode 100644 index d6cabf4..0000000 --- a/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -getValue(); - } elseif ($argument instanceof ClassNameInterface) { - $id = $argument->getClassName(); - } elseif (!is_string($argument)) { - return $argument; - } else { - $justStringValue = true; - $id = $argument; - } - - $container = null; - - try { - $container = $this->getLeagueContainer(); - } catch (ContainerException $e) { - if ($this instanceof ReflectionContainer) { - $container = $this; - } - } - - if ($container !== null) { - try { - return $container->get($id); - } catch (NotFoundException $exception) { - if ($argument instanceof ClassNameWithOptionalValue) { - return $argument->getOptionalValue(); - } - - if ($justStringValue) { - return $id; - } - - throw $exception; - } - } - - if ($argument instanceof ClassNameWithOptionalValue) { - return $argument->getOptionalValue(); - } - - // Just a string value. - return $id; - }, $arguments); - } - - /** - * {@inheritdoc} - */ - public function reflectArguments(ReflectionFunctionAbstract $method, array $args = []) : array - { - $arguments = array_map(function (ReflectionParameter $param) use ($method, $args) { - $name = $param->getName(); - $type = $param->getType(); - - if (array_key_exists($name, $args)) { - return new RawArgument($args[$name]); - } - - if ($type) { - if (PHP_VERSION_ID >= 70100) { - $typeName = $type->getName(); - } else { - $typeName = (string) $type; - } - - $typeName = ltrim($typeName, '?'); - - if ($param->isDefaultValueAvailable()) { - return new ClassNameWithOptionalValue($typeName, $param->getDefaultValue()); - } - - return new ClassName($typeName); - } - - if ($param->isDefaultValueAvailable()) { - return new RawArgument($param->getDefaultValue()); - } - - throw new NotFoundException(sprintf( - 'Unable to resolve a value for parameter (%s) in the function/method (%s)', - $name, - $method->getName() - )); - }, $method->getParameters()); - - return $this->resolveArguments($arguments); - } - - /** - * @return ContainerInterface - */ - abstract public function getContainer() : ContainerInterface; - - /** - * @return Container - */ - abstract public function getLeagueContainer() : Container; -} diff --git a/src/Dependencies/League/Container/Argument/ClassName.php b/src/Dependencies/League/Container/Argument/ClassName.php deleted file mode 100644 index e283336..0000000 --- a/src/Dependencies/League/Container/Argument/ClassName.php +++ /dev/null @@ -1,29 +0,0 @@ -value = $value; - } - - /** - * {@inheritdoc} - */ - public function getClassName() : string - { - return $this->value; - } -} diff --git a/src/Dependencies/League/Container/Argument/ClassNameInterface.php b/src/Dependencies/League/Container/Argument/ClassNameInterface.php deleted file mode 100644 index 2e26f78..0000000 --- a/src/Dependencies/League/Container/Argument/ClassNameInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -className = $className; - $this->optionalValue = $optionalValue; - } - - /** - * @inheritDoc - */ - public function getClassName(): string - { - return $this->className; - } - - public function getOptionalValue() - { - return $this->optionalValue; - } -} diff --git a/src/Dependencies/League/Container/Argument/RawArgument.php b/src/Dependencies/League/Container/Argument/RawArgument.php deleted file mode 100644 index 6c4a584..0000000 --- a/src/Dependencies/League/Container/Argument/RawArgument.php +++ /dev/null @@ -1,29 +0,0 @@ -value = $value; - } - - /** - * {@inheritdoc} - */ - public function getValue() - { - return $this->value; - } -} diff --git a/src/Dependencies/League/Container/Argument/RawArgumentInterface.php b/src/Dependencies/League/Container/Argument/RawArgumentInterface.php deleted file mode 100644 index d81c312..0000000 --- a/src/Dependencies/League/Container/Argument/RawArgumentInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -definitions = $definitions ?? new DefinitionAggregate; - $this->providers = $providers ?? new ServiceProviderAggregate; - $this->inflectors = $inflectors ?? new InflectorAggregate; - - if ($this->definitions instanceof ContainerAwareInterface) { - $this->definitions->setLeagueContainer($this); - } - - if ($this->providers instanceof ContainerAwareInterface) { - $this->providers->setLeagueContainer($this); - } - - if ($this->inflectors instanceof ContainerAwareInterface) { - $this->inflectors->setLeagueContainer($this); - } - } - - /** - * Add an item to the container. - * - * @param string $id - * @param mixed $concrete - * @param boolean $shared - * - * @return DefinitionInterface - */ - public function add(string $id, $concrete = null, bool $shared = null) : DefinitionInterface - { - $concrete = $concrete ?? $id; - $shared = $shared ?? $this->defaultToShared; - - return $this->definitions->add($id, $concrete, $shared); - } - - /** - * Proxy to add with shared as true. - * - * @param string $id - * @param mixed $concrete - * - * @return DefinitionInterface - */ - public function share(string $id, $concrete = null) : DefinitionInterface - { - return $this->add($id, $concrete, true); - } - - /** - * Whether the container should default to defining shared definitions. - * - * @param boolean $shared - * - * @return self - */ - public function defaultToShared(bool $shared = true) : ContainerInterface - { - $this->defaultToShared = $shared; - - return $this; - } - - /** - * Get a definition to extend. - * - * @param string $id [description] - * - * @return DefinitionInterface - */ - public function extend(string $id) : DefinitionInterface - { - if ($this->providers->provides($id)) { - $this->providers->register($id); - } - - if ($this->definitions->has($id)) { - return $this->definitions->getDefinition($id); - } - - throw new NotFoundException( - sprintf('Unable to extend alias (%s) as it is not being managed as a definition', $id) - ); - } - - /** - * Add a service provider. - * - * @param ServiceProviderInterface|string $provider - * - * @return self - */ - public function addServiceProvider($provider) : self - { - $this->providers->add($provider); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function get($id, bool $new = false) - { - if ($this->definitions->has($id)) { - $resolved = $this->definitions->resolve($id, $new); - return $this->inflectors->inflect($resolved); - } - - if ($this->definitions->hasTag($id)) { - $arrayOf = $this->definitions->resolveTagged($id, $new); - - array_walk($arrayOf, function (&$resolved) { - $resolved = $this->inflectors->inflect($resolved); - }); - - return $arrayOf; - } - - if ($this->providers->provides($id)) { - $this->providers->register($id); - - if (!$this->definitions->has($id) && !$this->definitions->hasTag($id)) { - throw new ContainerException(sprintf('Service provider lied about providing (%s) service', $id)); - } - - return $this->get($id, $new); - } - - foreach ($this->delegates as $delegate) { - if ($delegate->has($id)) { - $resolved = $delegate->get($id); - return $this->inflectors->inflect($resolved); - } - } - - throw new NotFoundException(sprintf('Alias (%s) is not being managed by the container or delegates', $id)); - } - - /** - * {@inheritdoc} - */ - public function has($id) - { - if ($this->definitions->has($id)) { - return true; - } - - if ($this->definitions->hasTag($id)) { - return true; - } - - if ($this->providers->provides($id)) { - return true; - } - - foreach ($this->delegates as $delegate) { - if ($delegate->has($id)) { - return true; - } - } - - return false; - } - - /** - * Allows for manipulation of specific types on resolution. - * - * @param string $type - * @param callable|null $callback - * - * @return InflectorInterface - */ - public function inflector(string $type, callable $callback = null) : InflectorInterface - { - return $this->inflectors->add($type, $callback); - } - - /** - * Delegate a backup container to be checked for services if it - * cannot be resolved via this container. - * - * @param ContainerInterface $container - * - * @return self - */ - public function delegate(ContainerInterface $container) : self - { - $this->delegates[] = $container; - - if ($container instanceof ContainerAwareInterface) { - $container->setLeagueContainer($this); - } - - return $this; - } -} diff --git a/src/Dependencies/League/Container/ContainerAwareInterface.php b/src/Dependencies/League/Container/ContainerAwareInterface.php deleted file mode 100644 index 8a9f8a6..0000000 --- a/src/Dependencies/League/Container/ContainerAwareInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -container = $container; - - return $this; - } - - /** - * Get the container. - * - * @return ContainerInterface - */ - public function getContainer() : ContainerInterface - { - if ($this->container instanceof ContainerInterface) { - return $this->container; - } - - throw new ContainerException('No container implementation has been set.'); - } - - /** - * Set a container. - * - * @param Container $container - * - * @return self - */ - public function setLeagueContainer(Container $container) : ContainerAwareInterface - { - $this->container = $container; - $this->leagueContainer = $container; - - return $this; - } - - /** - * Get the container. - * - * @return Container - */ - public function getLeagueContainer() : Container - { - if ($this->leagueContainer instanceof Container) { - return $this->leagueContainer; - } - - throw new ContainerException('No container implementation has been set.'); - } -} diff --git a/src/Dependencies/League/Container/Definition/Definition.php b/src/Dependencies/League/Container/Definition/Definition.php deleted file mode 100644 index ff5c0c7..0000000 --- a/src/Dependencies/League/Container/Definition/Definition.php +++ /dev/null @@ -1,278 +0,0 @@ -alias = $id; - $this->concrete = $concrete; - } - - /** - * {@inheritdoc} - */ - public function addTag(string $tag) : DefinitionInterface - { - $this->tags[$tag] = true; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasTag(string $tag) : bool - { - return isset($this->tags[$tag]); - } - - /** - * {@inheritdoc} - */ - public function setAlias(string $id) : DefinitionInterface - { - $this->alias = $id; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getAlias() : string - { - return $this->alias; - } - - /** - * {@inheritdoc} - */ - public function setShared(bool $shared = true) : DefinitionInterface - { - $this->shared = $shared; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function isShared() : bool - { - return $this->shared; - } - - /** - * {@inheritdoc} - */ - public function getConcrete() - { - return $this->concrete; - } - - /** - * {@inheritdoc} - */ - public function setConcrete($concrete) : DefinitionInterface - { - $this->concrete = $concrete; - $this->resolved = null; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addArgument($arg) : DefinitionInterface - { - $this->arguments[] = $arg; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addArguments(array $args) : DefinitionInterface - { - foreach ($args as $arg) { - $this->addArgument($arg); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addMethodCall(string $method, array $args = []) : DefinitionInterface - { - $this->methods[] = [ - 'method' => $method, - 'arguments' => $args - ]; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addMethodCalls(array $methods = []) : DefinitionInterface - { - foreach ($methods as $method => $args) { - $this->addMethodCall($method, $args); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function resolve(bool $new = false) - { - $concrete = $this->concrete; - - if ($this->isShared() && $this->resolved !== null && $new === false) { - return $this->resolved; - } - - if (is_callable($concrete)) { - $concrete = $this->resolveCallable($concrete); - } - - if ($concrete instanceof RawArgumentInterface) { - $this->resolved = $concrete->getValue(); - - return $concrete->getValue(); - } - - if ($concrete instanceof ClassNameInterface) { - $concrete = $concrete->getClassName(); - } - - if (is_string($concrete) && class_exists($concrete)) { - $concrete = $this->resolveClass($concrete); - } - - if (is_object($concrete)) { - $concrete = $this->invokeMethods($concrete); - } - - if (is_string($concrete) && $this->getContainer()->has($concrete)) { - $concrete = $this->getContainer()->get($concrete); - } - - $this->resolved = $concrete; - - return $concrete; - } - - /** - * Resolve a callable. - * - * @param callable $concrete - * - * @return mixed - */ - protected function resolveCallable(callable $concrete) - { - $resolved = $this->resolveArguments($this->arguments); - - return call_user_func_array($concrete, $resolved); - } - - /** - * Resolve a class. - * - * @param string $concrete - * - * @return object - * - * @throws ReflectionException - */ - protected function resolveClass(string $concrete) - { - $resolved = $this->resolveArguments($this->arguments); - $reflection = new ReflectionClass($concrete); - - return $reflection->newInstanceArgs($resolved); - } - - /** - * Invoke methods on resolved instance. - * - * @param object $instance - * - * @return object - */ - protected function invokeMethods($instance) - { - foreach ($this->methods as $method) { - $args = $this->resolveArguments($method['arguments']); - - /** @var callable $callable */ - $callable = [$instance, $method['method']]; - call_user_func_array($callable, $args); - } - - return $instance; - } -} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregate.php b/src/Dependencies/League/Container/Definition/DefinitionAggregate.php deleted file mode 100644 index 73e1d4b..0000000 --- a/src/Dependencies/League/Container/Definition/DefinitionAggregate.php +++ /dev/null @@ -1,124 +0,0 @@ -definitions = array_filter($definitions, function ($definition) { - return ($definition instanceof DefinitionInterface); - }); - } - - /** - * {@inheritdoc} - */ - public function add(string $id, $definition, bool $shared = false) : DefinitionInterface - { - if (!$definition instanceof DefinitionInterface) { - $definition = new Definition($id, $definition); - } - - $this->definitions[] = $definition - ->setAlias($id) - ->setShared($shared) - ; - - return $definition; - } - - /** - * {@inheritdoc} - */ - public function has(string $id) : bool - { - foreach ($this->getIterator() as $definition) { - if ($id === $definition->getAlias()) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function hasTag(string $tag) : bool - { - foreach ($this->getIterator() as $definition) { - if ($definition->hasTag($tag)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getDefinition(string $id) : DefinitionInterface - { - foreach ($this->getIterator() as $definition) { - if ($id === $definition->getAlias()) { - return $definition->setLeagueContainer($this->getLeagueContainer()); - } - } - - throw new NotFoundException(sprintf('Alias (%s) is not being handled as a definition.', $id)); - } - - /** - * {@inheritdoc} - */ - public function resolve(string $id, bool $new = false) - { - return $this->getDefinition($id)->resolve($new); - } - - /** - * {@inheritdoc} - */ - public function resolveTagged(string $tag, bool $new = false) : array - { - $arrayOf = []; - - foreach ($this->getIterator() as $definition) { - if ($definition->hasTag($tag)) { - $arrayOf[] = $definition->setLeagueContainer($this->getLeagueContainer())->resolve($new); - } - } - - return $arrayOf; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->definitions); - - for ($i = 0; $i < $count; $i++) { - yield $this->definitions[$i]; - } - } -} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php b/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php deleted file mode 100644 index 7069f2f..0000000 --- a/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php +++ /dev/null @@ -1,67 +0,0 @@ -type = $type; - $this->callback = $callback; - } - - /** - * {@inheritdoc} - */ - public function getType() : string - { - return $this->type; - } - - /** - * {@inheritdoc} - */ - public function invokeMethod(string $name, array $args) : InflectorInterface - { - $this->methods[$name] = $args; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function invokeMethods(array $methods) : InflectorInterface - { - foreach ($methods as $name => $args) { - $this->invokeMethod($name, $args); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setProperty(string $property, $value) : InflectorInterface - { - $this->properties[$property] = $this->resolveArguments([$value])[0]; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setProperties(array $properties) : InflectorInterface - { - foreach ($properties as $property => $value) { - $this->setProperty($property, $value); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function inflect($object) - { - $properties = $this->resolveArguments(array_values($this->properties)); - $properties = array_combine(array_keys($this->properties), $properties); - - // array_combine() can technically return false - foreach ($properties ?: [] as $property => $value) { - $object->{$property} = $value; - } - - foreach ($this->methods as $method => $args) { - $args = $this->resolveArguments($args); - - /** @var callable $callable */ - $callable = [$object, $method]; - call_user_func_array($callable, $args); - } - - if ($this->callback !== null) { - call_user_func($this->callback, $object); - } - } -} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregate.php b/src/Dependencies/League/Container/Inflector/InflectorAggregate.php deleted file mode 100644 index 644668e..0000000 --- a/src/Dependencies/League/Container/Inflector/InflectorAggregate.php +++ /dev/null @@ -1,58 +0,0 @@ -inflectors[] = $inflector; - - return $inflector; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->inflectors); - - for ($i = 0; $i < $count; $i++) { - yield $this->inflectors[$i]; - } - } - - /** - * {@inheritdoc} - */ - public function inflect($object) - { - foreach ($this->getIterator() as $inflector) { - $type = $inflector->getType(); - - if (! $object instanceof $type) { - continue; - } - - $inflector->setLeagueContainer($this->getLeagueContainer()); - $inflector->inflect($object); - } - - return $object; - } -} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php b/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php deleted file mode 100644 index 7309e01..0000000 --- a/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -cacheResolutions === true && array_key_exists($id, $this->cache)) { - return $this->cache[$id]; - } - - if (! $this->has($id)) { - throw new NotFoundException( - sprintf('Alias (%s) is not an existing class and therefore cannot be resolved', $id) - ); - } - - $reflector = new ReflectionClass($id); - $construct = $reflector->getConstructor(); - - if ($construct && !$construct->isPublic()) { - throw new NotFoundException( - sprintf('Alias (%s) has a non-public constructor and therefore cannot be instantiated', $id) - ); - } - - $resolution = $construct === null - ? new $id - : $resolution = $reflector->newInstanceArgs($this->reflectArguments($construct, $args)) - ; - - if ($this->cacheResolutions === true) { - $this->cache[$id] = $resolution; - } - - return $resolution; - } - - /** - * {@inheritdoc} - */ - public function has($id) - { - return class_exists($id); - } - - /** - * Invoke a callable via the container. - * - * @param callable $callable - * @param array $args - * - * @return mixed - * - * @throws ReflectionException - */ - public function call(callable $callable, array $args = []) - { - if (is_string($callable) && strpos($callable, '::') !== false) { - $callable = explode('::', $callable); - } - - if (is_array($callable)) { - if (is_string($callable[0])) { - $callable[0] = $this->getContainer()->get($callable[0]); - } - - $reflection = new ReflectionMethod($callable[0], $callable[1]); - - if ($reflection->isStatic()) { - $callable[0] = null; - } - - return $reflection->invokeArgs($callable[0], $this->reflectArguments($reflection, $args)); - } - - if (is_object($callable)) { - $reflection = new ReflectionMethod($callable, '__invoke'); - - return $reflection->invokeArgs($callable, $this->reflectArguments($reflection, $args)); - } - - $reflection = new ReflectionFunction(\Closure::fromCallable($callable)); - - return $reflection->invokeArgs($this->reflectArguments($reflection, $args)); - } - - /** - * Whether the container should default to caching resolutions and returning - * the cache on following calls. - * - * @param boolean $option - * - * @return self - */ - public function cacheResolutions(bool $option = true) : ContainerInterface - { - $this->cacheResolutions = $option; - - return $this; - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php b/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php deleted file mode 100644 index 1b356af..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php +++ /dev/null @@ -1,46 +0,0 @@ -provides, true); - } - - /** - * {@inheritdoc} - */ - public function setIdentifier(string $id) : ServiceProviderInterface - { - $this->identifier = $id; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getIdentifier() : string - { - return $this->identifier ?? get_class($this); - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php b/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php deleted file mode 100644 index 895f4be..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -getContainer()->has($provider)) { - $provider = $this->getContainer()->get($provider); - } elseif (is_string($provider) && class_exists($provider)) { - $provider = new $provider; - } - - if (in_array($provider, $this->providers, true)) { - return $this; - } - - if ($provider instanceof ContainerAwareInterface) { - $provider->setLeagueContainer($this->getLeagueContainer()); - } - - if ($provider instanceof BootableServiceProviderInterface) { - $provider->boot(); - } - - if ($provider instanceof ServiceProviderInterface) { - $this->providers[] = $provider; - - return $this; - } - - throw new ContainerException( - 'A service provider must be a fully qualified class name or instance ' . - 'of (\RocketCDN\Dependencies\League\Container\ServiceProvider\ServiceProviderInterface)' - ); - } - - /** - * {@inheritdoc} - */ - public function provides(string $service) : bool - { - foreach ($this->getIterator() as $provider) { - if ($provider->provides($service)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->providers); - - for ($i = 0; $i < $count; $i++) { - yield $this->providers[$i]; - } - } - - /** - * {@inheritdoc} - */ - public function register(string $service) - { - if (false === $this->provides($service)) { - throw new ContainerException( - sprintf('(%s) is not provided by a service provider', $service) - ); - } - - foreach ($this->getIterator() as $provider) { - if (in_array($provider->getIdentifier(), $this->registered, true)) { - continue; - } - - if ($provider->provides($service)) { - $this->registered[] = $provider->getIdentifier(); - $provider->register(); - } - } - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php b/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php deleted file mode 100644 index a0eb57e..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php +++ /dev/null @@ -1,36 +0,0 @@ -leagueContainer property or the `getLeagueContainer` method - * from the ContainerAwareTrait. - * - * @return void - */ - public function register(); - - /** - * Set a custom id for the service provider. This enables - * registering the same service provider multiple times. - * - * @param string $id - * - * @return self - */ - public function setIdentifier(string $id) : ServiceProviderInterface; - - /** - * The id of the service provider uniquely identifies it, so - * that we can quickly determine if it has already been registered. - * Defaults to get_class($provider). - * - * @return string - */ - public function getIdentifier() : string; -} diff --git a/src/Dependencies/Psr/Container/ContainerExceptionInterface.php b/src/Dependencies/Psr/Container/ContainerExceptionInterface.php deleted file mode 100644 index 5a622ea..0000000 --- a/src/Dependencies/Psr/Container/ContainerExceptionInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -set_event_manager( $this ); - } - - $events = $subscriber->get_subscribed_events(); - - if ( empty( $events ) ) { - return; - } - - foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { - $this->add_subscriber_callback( $subscriber, $hook_name, $parameters ); - } - } - - /** - * Checks the WordPress plugin API to see if the given hook has - * the given callback. The priority of the callback will be returned - * or false. If no callback is given will return true or false if - * there's any callbacks registered to the hook. - * - * @uses has_filter() - * - * @param string $hook_name Hook name. - * @param mixed $callback Callback. - * - * @return bool|int - */ - public function has_callback( $hook_name, $callback = false ) { - return has_filter( $hook_name, $callback ); - } - - /** - * Removes the given callback from the given hook. The WordPress plugin API only - * removes the hook if the callback and priority match a registered hook. - * - * @uses remove_filter() - * - * @param string $hook_name Hook name. - * @param callable $callback Callback. - * @param int $priority Priority. - * - * @return bool - */ - public function remove_callback( $hook_name, $callback, $priority = 10 ) { - return remove_filter( $hook_name, $callback, $priority ); - } - - /** - * Remove an event subscriber. - * - * The event manager removes all the hooks that the given subscriber - * wants to register with the WordPress Plugin API. - * - * @param SubscriberInterface $subscriber SubscriberInterface implementation. - */ - public function remove_subscriber( SubscriberInterface $subscriber ) { - foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { - $this->remove_subscriber_callback( $subscriber, $hook_name, $parameters ); - } - } - - /** - * Adds the given subscriber's callback to a specific hook - * of the WordPress plugin API. - * - * @param SubscriberInterface $subscriber SubscriberInterface implementation. - * @param string $hook_name Hook name. - * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. - */ - private function add_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { - if ( is_string( $parameters ) ) { - $this->add_callback( $hook_name, [ $subscriber, $parameters ] ); - } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { - foreach ( $parameters as $parameter ) { - $this->add_subscriber_callback( $subscriber, $hook_name, $parameter ); - } - } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { - $this->add_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10, isset( $parameters[2] ) ? $parameters[2] : 1 ); - } - } - - /** - * Removes the given subscriber's callback to a specific hook - * of the WordPress plugin API. - * - * @param SubscriberInterface $subscriber SubscriberInterface implementation. - * @param string $hook_name Hook name. - * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. - */ - private function remove_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { - if ( is_string( $parameters ) ) { - $this->remove_callback( $hook_name, [ $subscriber, $parameters ] ); - } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { - foreach ( $parameters as $parameter ) { - $this->remove_subscriber_callback( $subscriber, $hook_name, $parameter ); - } - } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { - $this->remove_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10 ); - } - } -} diff --git a/src/EventManagement/SubscriberInterface.php b/src/EventManagement/SubscriberInterface.php index 87c700f..a94e251 100644 --- a/src/EventManagement/SubscriberInterface.php +++ b/src/EventManagement/SubscriberInterface.php @@ -3,13 +3,15 @@ namespace RocketCDN\EventManagement; +use RocketCDN\Dependencies\LaunchpadCore\EventManagement\OptimizedSubscriberInterface; + /** * A Subscriber knows what specific WordPress events it wants to listen to. * * When an EventManager adds a Subscriber, it gets all the WordPress events that * it wants to listen to. It then adds the subscriber as a listener for each of them. */ -interface SubscriberInterface { +interface SubscriberInterface extends OptimizedSubscriberInterface { /** * Returns an array of events that this subscriber wants to listen to. * diff --git a/src/Front/CDN.php b/src/Front/CDN.php index 77b5a4a..a4d4e6f 100644 --- a/src/Front/CDN.php +++ b/src/Front/CDN.php @@ -3,16 +3,13 @@ namespace RocketCDN\Front; -use RocketCDN\Options\Options; -class CDN { - /** - * Options instance - * - * @var Options - */ - private $options; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; +class CDN implements OptionsAwareInterface { + use OptionsAwareTrait; /** * Home URL host * @@ -20,15 +17,6 @@ class CDN { */ private $home_host = ''; - /** - * Instantiates the class - * - * @param Options $options Options instance. - */ - public function __construct( Options $options ) { - $this->options = $options; - } - /** * Setup output buffering * diff --git a/src/Front/ServiceProvider.php b/src/Front/ServiceProvider.php index 21d7bce..36a9a96 100644 --- a/src/Front/ServiceProvider.php +++ b/src/Front/ServiceProvider.php @@ -3,37 +3,23 @@ namespace RocketCDN\Front; -use RocketCDN\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; +use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - /** - * Services provided by this provider - * - * @var array - */ - protected $provides = [ - 'cdn', - 'cdn_subscriber', - ]; + public function define() { + $this->register_service(CDN::class); + $this->register_service(\RocketCDN\Front\Subscriber::class)->share() + ->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument(CDN::class); + }); + } - /** - * Subscribers provided by this provider - * - * @var array - */ - public $subscribers = [ - 'cdn_subscriber', - ]; - - /** - * Registers the provided classes - * - * @return void - */ - public function register() { - $this->getContainer()->add( 'cdn', 'RocketCDN\Front\CDN' ) - ->addArgument( $this->getContainer()->get( 'options' ) ); - $this->getContainer()->add( 'cdn_subscriber', 'RocketCDN\Front\Subscriber' ) - ->addArgument( $this->getContainer()->get( 'cdn' ) ); - } + public function get_common_subscribers(): array + { + return [ + \RocketCDN\Front\Subscriber::class + ]; + } } diff --git a/src/Options/AbstractOptions.php b/src/Options/AbstractOptions.php deleted file mode 100644 index 7553cfd..0000000 --- a/src/Options/AbstractOptions.php +++ /dev/null @@ -1,67 +0,0 @@ -prefix . $name; - } - - /** - * Gets the option for the given name. Returns the default value if the value does not exist. - * - * @param string $name Name of the option to get. - * @param mixed $default Default value to return if the value does not exist. - * - * @return mixed - */ - abstract public function get( string $name, $default = null ); - - /** - * Sets the value of an option. Update the value if the option for the given name already exists. - * - * @param string $name Name of the option to set. - * @param mixed $value Value to set for the option. - * - * @return void - */ - abstract public function set( string $name, $value ); - - /** - * Deletes the option with the given name. - * - * @param string $name Name of the option to delete. - * - * @return void - */ - abstract public function delete( string $name ); - - /** - * Checks if the option with the given name exists. - * - * @param string $name Name of the option to check. - * - * @return bool - */ - public function has( string $name ): bool { - return null !== $this->get( $name ); - } -} diff --git a/src/Options/Options.php b/src/Options/Options.php deleted file mode 100644 index c6ba1de..0000000 --- a/src/Options/Options.php +++ /dev/null @@ -1,59 +0,0 @@ -prefix = $prefix; - } - - /** - * Gets the option for the given name. Returns the default value if the value does not exist. - * - * @param string $name Name of the option to get. - * @param mixed $default Default value to return if the value does not exist. - * - * @return mixed - */ - public function get( string $name, $default = null ) { - $option = get_option( $this->get_option_name( $name ), $default ); - - if ( is_array( $default ) && ! is_array( $option ) ) { - $option = (array) $option; - } - - return $option; - } - - /** - * Sets the value of an option. Update the value if the option for the given name already exists. - * - * @param string $name Name of the option to set. - * @param mixed $value Value to set for the option. - * - * @return void - */ - public function set( string $name, $value ) { - update_option( $this->get_option_name( $name ), $value ); - } - - /** - * Deletes the option with the given name. - * - * @param string $name Name of the option to delete. - * - * @return void - */ - public function delete( string $name ) { - delete_option( $this->get_option_name( $name ) ); - } -} diff --git a/src/Options/OptionsInterface.php b/src/Options/OptionsInterface.php deleted file mode 100644 index 5b6305b..0000000 --- a/src/Options/OptionsInterface.php +++ /dev/null @@ -1,56 +0,0 @@ -container = $container; - - add_filter( 'rocketcdn_container', [ $this, 'get_container' ] ); - } - - /** - * Returns the RocketCDN container instance. - * - * @return Container - */ - public function get_container() { - return $this->container; - } - - /** - * Checks if the plugin is loaded - * - * @return boolean - */ - private function is_loaded(): bool { - return $this->loaded; - } - - /** - * Loads the plugin in WordPress - * - * @return void - */ - public function load() { - if ( $this->is_loaded() ) { - return; - } - - $this->container->add( - 'event_manager', - function () { - return new EventManager(); - } - ); - - $this->container->add( 'template_basepath', realpath( plugin_dir_path( __DIR__ ) ) . '/views/' ); - $this->container->add( 'assets_baseurl', plugin_dir_url( __DIR__ ) . 'assets/' ); - $this->container->add( - 'options', - function () { - return new Options( 'rocketcdn_' ); - } - ); - - foreach ( $this->get_service_providers() as $service_provider ) { - $service_provider_instance = new $service_provider(); - $this->container->addServiceProvider( $service_provider_instance ); - - // Load each service provider's subscribers if found. - $this->load_subscribers( $service_provider_instance ); - } - - $this->loaded = true; - } - - /** - * Get list of service providers' classes. - * - * @return array Service providers. - */ - private function get_service_providers() { - return [ - 'RocketCDN\API\ServiceProvider', - 'RocketCDN\Admin\Settings\ServiceProvider', - 'RocketCDN\Admin\Notices\ServiceProvider', - 'RocketCDN\Admin\AdminBar\ServiceProvider', - 'RocketCDN\Front\ServiceProvider', - ]; - } - - /** - * Load list of event subscribers from service provider. - * - * @param ServiceProviderInterface $service_provider_instance Instance of service provider. - * - * @return void - */ - private function load_subscribers( ServiceProviderInterface $service_provider_instance ) { - if ( empty( $service_provider_instance->subscribers ) ) { - return; - } - - foreach ( $service_provider_instance->subscribers as $subscriber ) { - $subscriber_object = $this->container->get( $subscriber ); - - if ( $subscriber_object instanceof SubscriberInterface ) { - $this->container->get( 'event_manager' )->add_subscriber( $subscriber_object ); - } - } - } -} diff --git a/tests/Fixtures/src/Front/CDN/Subscriber/addPreconnectCdn.php b/tests/Fixtures/src/Front/CDN/Subscriber/addPreconnectCdn.php index 261474d..2361be0 100644 --- a/tests/Fixtures/src/Front/CDN/Subscriber/addPreconnectCdn.php +++ b/tests/Fixtures/src/Front/CDN/Subscriber/addPreconnectCdn.php @@ -7,7 +7,6 @@ ], 'expected' => [ 'html' => << HTML, ], diff --git a/tests/Integration/AdminTestCase.php b/tests/Integration/AdminTestCase.php index 4f3b192..8d0beb1 100644 --- a/tests/Integration/AdminTestCase.php +++ b/tests/Integration/AdminTestCase.php @@ -7,6 +7,9 @@ abstract class AdminTestCase extends BaseTestCase { use DBTrait; + + protected $user_id; + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); remove_action( 'admin_init', '_maybe_update_core' ); @@ -18,19 +21,19 @@ public static function setUpBeforeClass() : void { public function setUp() : void { parent::setUp(); - DBTrait::removeDBHooks(); + self::removeDBHooks(); // Suppress warnings from "Cannot modify header information - headers already sent by". $this->error_level = error_reporting(); error_reporting( $this->error_level & ~E_WARNING ); } - public function tearDown() { + public function tear_down() { $_POST = []; $_GET = []; unset( $GLOBALS['post'], $GLOBALS['comment'] ); - parent::tearDown(); + parent::tear_down(); error_reporting( $this->error_level ); set_current_screen( 'front' ); diff --git a/tests/Integration/AjaxTestCase.php b/tests/Integration/AjaxTestCase.php index 9899a37..7abbe17 100644 --- a/tests/Integration/AjaxTestCase.php +++ b/tests/Integration/AjaxTestCase.php @@ -21,10 +21,10 @@ abstract class AjaxTestCase extends WPMediaAjaxTestCase { public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); - CapTrait::hasAdminCapBeforeClass(); + self::hasAdminCapBeforeClass(); - if ( static::$use_settings_trait ) { - SettingsTrait::getOriginalSettings(); + if ( self::$use_settings_trait ) { + self::getOriginalSettings(); } if ( ! empty( self::$transients ) ) { @@ -34,13 +34,13 @@ public static function setUpBeforeClass() : void { } } - public static function tearDownAfterClass() { - parent::setUpBeforeClass(); + public static function tearDownAfterClass(): void { + parent::tearDownAfterClass(); - CapTrait::resetAdminCap(); + self::resetAdminCap(); - if ( static::$use_settings_trait ) { - SettingsTrait::resetOriginalSettings(); + if ( self::$use_settings_trait ) { + self::resetOriginalSettings(); } foreach ( self::$transients as $transient => $value ) { @@ -57,7 +57,7 @@ public function setUp() : void { $this->loadTestDataConfig(); } - DBTrait::removeDBHooks(); + self::removeDBHooks(); parent::setUp(); @@ -66,12 +66,12 @@ public function setUp() : void { } } - public function tearDown() { + public function tear_down() { unset( $_POST['action'], $_POST['nonce'] ); $this->action = null; - CapTrait::resetAdminCap(); + self::resetAdminCap(); - parent::tearDown(); + parent::tear_down(); if ( static::$use_settings_trait ) { $this->tearDownSettings(); diff --git a/tests/Integration/CapTrait.php b/tests/Integration/CapTrait.php index 9c62ecc..aef4eaa 100644 --- a/tests/Integration/CapTrait.php +++ b/tests/Integration/CapTrait.php @@ -7,19 +7,19 @@ trait CapTrait { public static function hasAdminCapBeforeClass() { $admin = get_role( 'administrator' ); - static::$had_cap = $admin->has_cap( 'manage_options' ); + self::$had_cap = $admin->has_cap( 'manage_options' ); } public static function setAdminCap() { $admin = get_role( 'administrator' ); - if ( ! static::$had_cap ) { + if ( ! self::$had_cap ) { $admin->add_cap( 'manage_options' ); } } public static function resetAdminCap() { $admin = get_role( 'administrator' ); - if ( ! static::$had_cap ) { + if ( ! self::$had_cap ) { $admin->remove_cap( 'manage_options' ); } } diff --git a/tests/Integration/src/Admin/AdminBar/Subscriber/addAdminBarMenu.php b/tests/Integration/src/Admin/AdminBar/Subscriber/addAdminBarMenu.php index 9a68f4b..d8572df 100644 --- a/tests/Integration/src/Admin/AdminBar/Subscriber/addAdminBarMenu.php +++ b/tests/Integration/src/Admin/AdminBar/Subscriber/addAdminBarMenu.php @@ -27,8 +27,8 @@ public function setUp() : void { add_filter( 'pre_option_rocketcdn_api_key', [ $this, 'api_key' ] ); } - public function tearDown() { - parent::tearDown(); + public function tear_down() { + parent::tear_down(); remove_filter( 'show_admin_bar', [ $this, 'return_true' ] ); remove_filter( 'pre_option_rocketcdn_api_key', [ $this, 'api_key' ] ); diff --git a/tests/Integration/src/Admin/AdminBar/Subscriber/purgeCache.php b/tests/Integration/src/Admin/AdminBar/Subscriber/purgeCache.php index 10593aa..a89d0dd 100644 --- a/tests/Integration/src/Admin/AdminBar/Subscriber/purgeCache.php +++ b/tests/Integration/src/Admin/AdminBar/Subscriber/purgeCache.php @@ -19,14 +19,14 @@ class Test_PurgeCache extends TestCase public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); - CapTrait::hasAdminCapBeforeClass(); - CapTrait::setAdminCap(); + self::hasAdminCapBeforeClass(); + self::setAdminCap(); } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { parent::tearDownAfterClass(); - CapTrait::resetAdminCap(); + self::resetAdminCap(); } public function setUp() : void { @@ -35,10 +35,10 @@ public function setUp() : void { unset( $_GET['_wpnonce'] ); } - public function tearDown() { + public function tear_down() { unset( $_GET['_wpnonce'] ); - parent::tearDown(); + parent::tear_down(); // Clean up. remove_filter( 'wp_redirect', [ $this, 'return_empty_string' ] ); diff --git a/tests/Integration/src/Admin/Notices/Subscriber/emptyApiKeyNotice.php b/tests/Integration/src/Admin/Notices/Subscriber/emptyApiKeyNotice.php index 533d964..4e5031b 100644 --- a/tests/Integration/src/Admin/Notices/Subscriber/emptyApiKeyNotice.php +++ b/tests/Integration/src/Admin/Notices/Subscriber/emptyApiKeyNotice.php @@ -20,8 +20,8 @@ public function setUp() : void { add_filter( 'pre_option_rocketcdn_api_key', [ $this, 'api_key' ] ); } - public function tearDown() { - parent::tearDown(); + public function tear_down() { + parent::tear_down(); remove_filter( 'pre_option_rocketcdn_api_key', [ $this, 'api_key' ] ); } /** diff --git a/tests/Integration/src/Admin/Notices/Subscriber/wrongApiKeyNotice.php b/tests/Integration/src/Admin/Notices/Subscriber/wrongApiKeyNotice.php index b012fc5..809651a 100644 --- a/tests/Integration/src/Admin/Notices/Subscriber/wrongApiKeyNotice.php +++ b/tests/Integration/src/Admin/Notices/Subscriber/wrongApiKeyNotice.php @@ -25,8 +25,8 @@ public function setUp() : void { add_filter( 'pre_option_rocketcdn_api_key', [ $this, 'api_key' ] ); } - public function tearDown() { - parent::tearDown(); + public function tear_down() { + parent::tear_down(); remove_filter( 'pre_option_rocketcdn_api_key', [ $this, 'api_key' ] ); } /** diff --git a/tests/Integration/src/Admin/Settings/Subscriber/enqueueAssets.php b/tests/Integration/src/Admin/Settings/Subscriber/enqueueAssets.php index 01ca67e..cf030dd 100644 --- a/tests/Integration/src/Admin/Settings/Subscriber/enqueueAssets.php +++ b/tests/Integration/src/Admin/Settings/Subscriber/enqueueAssets.php @@ -16,8 +16,8 @@ public function setUp() : void { $this->setRoleCap( 'administrator', 'rocket_manage_options' ); } - public function tearDown() { - parent::tearDown(); + public function tear_down() { + parent::tear_down(); set_current_screen( 'front' ); diff --git a/tests/Integration/src/Admin/Settings/Subscriber/purgeCache.php b/tests/Integration/src/Admin/Settings/Subscriber/purgeCache.php index 4a49b6d..22a4346 100644 --- a/tests/Integration/src/Admin/Settings/Subscriber/purgeCache.php +++ b/tests/Integration/src/Admin/Settings/Subscriber/purgeCache.php @@ -19,7 +19,7 @@ class Test_PurgeCache extends AjaxTestCase { protected $cdn; public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); - CapTrait::setAdminCap(); + self::setAdminCap(); self::$admin_user_id = static::factory()->user->create( [ 'role' => 'administrator' ] ); } diff --git a/tests/Integration/src/Admin/Settings/Subscriber/updateApiKey.php b/tests/Integration/src/Admin/Settings/Subscriber/updateApiKey.php index 1ea9e5c..b1aa6f7 100644 --- a/tests/Integration/src/Admin/Settings/Subscriber/updateApiKey.php +++ b/tests/Integration/src/Admin/Settings/Subscriber/updateApiKey.php @@ -34,9 +34,9 @@ public function testCallbackIsRegistered() { $this->assertCallbackRegistered( 'wp_ajax_rocketcdn_validate_key', 'validate_api_key' ); } - public function tearDown() { + public function tear_down() { - parent::tearDown(); + parent::tear_down(); delete_transient( 'rocketcdn_customer_data' ); remove_filter( 'pre_option_rocketcdn_api_key', [ $this, 'api_key' ] ); } diff --git a/tests/Integration/src/Admin/Settings/Subscriber/validateApiKey.php b/tests/Integration/src/Admin/Settings/Subscriber/validateApiKey.php index cb95cff..d632cc2 100644 --- a/tests/Integration/src/Admin/Settings/Subscriber/validateApiKey.php +++ b/tests/Integration/src/Admin/Settings/Subscriber/validateApiKey.php @@ -14,12 +14,14 @@ * @group Admin */ class Test_ValidateApiKey extends AjaxTestCase { + use CapTrait; + protected $api_key; private static $admin_user_id = 0; public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); - CapTrait::setAdminCap(); + self::setAdminCap(); self::$admin_user_id = static::factory()->user->create( [ 'role' => 'administrator' ] ); } @@ -34,9 +36,9 @@ public function testCallbackIsRegistered() { $this->assertCallbackRegistered( 'wp_ajax_rocketcdn_validate_key', 'validate_api_key' ); } - public function tearDown() { + public function tear_down() { - parent::tearDown(); + parent::tear_down(); delete_transient( 'rocketcdn_customer_data' ); remove_filter( 'pre_option_rocketcdn_api_key', [ $this, 'api_key' ] ); } diff --git a/tests/Integration/src/Front/CDN/Subscriber/addPreconnectCdn.php b/tests/Integration/src/Front/CDN/Subscriber/addPreconnectCdn.php index ba87bd0..aeb2644 100644 --- a/tests/Integration/src/Front/CDN/Subscriber/addPreconnectCdn.php +++ b/tests/Integration/src/Front/CDN/Subscriber/addPreconnectCdn.php @@ -19,10 +19,10 @@ public function setUp() : void { parent::setUp(); } - public function tearDown() { + public function tear_down() { $this->restoreWpFilter( 'wp_resource_hints' ); - parent::tearDown(); + parent::tear_down(); } /** From da281df3d80e8dd201fe5778dc2fc378cfc04251 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Tue, 2 Jul 2024 18:38:12 +0200 Subject: [PATCH 04/40] Fixes for linter --- configs/parameters.php | 14 +++---- configs/providers.php | 14 +++---- readme.txt | 3 ++ rocketcdn.php | 12 +++--- src/API/Client.php | 2 +- src/API/ServiceProvider.php | 14 ++++--- src/Admin/AdminBar/AdminBar.php | 6 +-- src/Admin/AdminBar/ServiceProvider.php | 50 +++++++++++++++--------- src/Admin/Notices/Notices.php | 2 +- src/Admin/Notices/ServiceProvider.php | 42 ++++++++++++-------- src/Admin/Settings/Page.php | 8 ++-- src/Admin/Settings/ServiceProvider.php | 53 +++++++++++++++++--------- src/Front/CDN.php | 3 +- src/Front/ServiceProvider.php | 38 +++++++++++------- 14 files changed, 159 insertions(+), 102 deletions(-) diff --git a/configs/parameters.php b/configs/parameters.php index d0c8030..008779d 100644 --- a/configs/parameters.php +++ b/configs/parameters.php @@ -1,10 +1,10 @@ sanitize_key( 'RocketCDN' ), - 'template_basepath' => realpath( plugin_dir_path( __DIR__ ) ) . '/views/' , - 'assets_baseurl' => plugin_dir_url( __DIR__ ) . 'assets/', - 'is_mu_plugin' => false, - 'translation_key' => 'rocketcdn', - 'prefix' => 'rocketcdn_' -]; \ No newline at end of file + 'plugin_name' => sanitize_key( 'RocketCDN' ), + 'template_basepath' => realpath( plugin_dir_path( __DIR__ ) ) . '/views/', + 'assets_baseurl' => plugin_dir_url( __DIR__ ) . 'assets/', + 'is_mu_plugin' => false, + 'translation_key' => 'rocketcdn', + 'prefix' => 'rocketcdn_', +]; diff --git a/configs/providers.php b/configs/providers.php index 6de45fc..80045c2 100644 --- a/configs/providers.php +++ b/configs/providers.php @@ -1,10 +1,10 @@ 'RocketCDN', 'plugin_version' => ROCKETCDN_VERSION, 'wp_version' => '5.4', - 'php_version' => '7.0', + 'php_version' => '7.3', ] ); if ( $rocketcdn_rq_check->check() ) { - require __DIR__ . '/src/Dependencies/LaunchpadCore/boot.php'; + require __DIR__ . '/src/Dependencies/LaunchpadCore/boot.php'; - boot( __FILE__ ); + boot( __FILE__ ); } unset( $rocketcdn_rq_check ); diff --git a/src/API/Client.php b/src/API/Client.php index 2695dcf..d4914f6 100644 --- a/src/API/Client.php +++ b/src/API/Client.php @@ -7,7 +7,7 @@ use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; class Client implements OptionsAwareInterface { - use OptionsAwareTrait; + use OptionsAwareTrait; const ROCKETCDN_API = 'https://rocketcdn.me/api/'; diff --git a/src/API/ServiceProvider.php b/src/API/ServiceProvider.php index 9f5862a..7604c4d 100644 --- a/src/API/ServiceProvider.php +++ b/src/API/ServiceProvider.php @@ -4,10 +4,14 @@ namespace RocketCDN\API; use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; -use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; - class ServiceProvider extends AbstractServiceProvider { - public function define() { - $this->register_service(Client::class); - } + + /** + * Register the services. + * + * @return void + */ + public function define() { + $this->register_service( Client::class ); + } } diff --git a/src/Admin/AdminBar/AdminBar.php b/src/Admin/AdminBar/AdminBar.php index a24d795..132044a 100644 --- a/src/Admin/AdminBar/AdminBar.php +++ b/src/Admin/AdminBar/AdminBar.php @@ -9,7 +9,7 @@ use RocketCDN\Options\Options; class AdminBar implements OptionsAwareInterface { - use OptionsAwareTrait; + use OptionsAwareTrait; /** * API client instance @@ -28,8 +28,8 @@ class AdminBar implements OptionsAwareInterface { /** * Instantiate the class * - * @param Client $api_client API client instance. - * @param string $assets_baseurl Assets base URL. + * @param Client $api_client API client instance. + * @param string $assets_baseurl Assets base URL. */ public function __construct( Client $api_client, $assets_baseurl ) { $this->api_client = $api_client; diff --git a/src/Admin/AdminBar/ServiceProvider.php b/src/Admin/AdminBar/ServiceProvider.php index c50000c..77ccf10 100644 --- a/src/Admin/AdminBar/ServiceProvider.php +++ b/src/Admin/AdminBar/ServiceProvider.php @@ -5,27 +5,41 @@ use RocketCDN\API\Client; use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; -use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - public function get_common_subscribers(): array - { - return [ - \RocketCDN\Admin\AdminBar\Subscriber::class - ]; - } + /** + * Returns common subscribers. + * + * @return string[] + */ + public function get_common_subscribers(): array { + return [ + \RocketCDN\Admin\AdminBar\Subscriber::class, + ]; + } - public function define() { - $this->register_service(AdminBar::class)->set_definition(function (DefinitionInterface $definition) { - $definition->addArguments([ - Client::class, - 'assets_baseurl' - ]); - }); + /** + * Register the services. + * + * @return void + */ + public function define() { + $this->register_service( AdminBar::class )->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArguments( + [ + Client::class, + 'assets_baseurl', + ] + ); + } + ); - $this->register_service(\RocketCDN\Admin\AdminBar\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument(AdminBar::class); - }); - } + $this->register_service( \RocketCDN\Admin\AdminBar\Subscriber::class )->share()->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArgument( AdminBar::class ); + } + ); + } } diff --git a/src/Admin/Notices/Notices.php b/src/Admin/Notices/Notices.php index 0fa916e..4eb1101 100644 --- a/src/Admin/Notices/Notices.php +++ b/src/Admin/Notices/Notices.php @@ -21,7 +21,7 @@ class Notices implements OptionsAwareInterface { /** * Instantiate the class * - * @param Client $api_client API client instance. + * @param Client $api_client API client instance. */ public function __construct( Client $api_client ) { $this->api_client = $api_client; diff --git a/src/Admin/Notices/ServiceProvider.php b/src/Admin/Notices/ServiceProvider.php index 435ab99..fce6022 100644 --- a/src/Admin/Notices/ServiceProvider.php +++ b/src/Admin/Notices/ServiceProvider.php @@ -5,25 +5,37 @@ use RocketCDN\API\Client; use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; -use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - public function get_common_subscribers(): array - { - return [ - \RocketCDN\Admin\Notices\Subscriber::class - ]; - } + /** + * Returns common subscribers. + * + * @return string[] + */ + public function get_common_subscribers(): array { + return [ + \RocketCDN\Admin\Notices\Subscriber::class, + ]; + } - public function define() { - $this->register_service(Notices::class)->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument(Client::class); - }); + /** + * Register the services. + * + * @return void + */ + public function define() { + $this->register_service( Notices::class )->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArgument( Client::class ); + } + ); - $this->register_service(\RocketCDN\Admin\Notices\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument(Notices::class); - }); - } + $this->register_service( \RocketCDN\Admin\Notices\Subscriber::class )->share()->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArgument( Notices::class ); + } + ); + } } diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index ef73642..f84fa3f 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -10,7 +10,7 @@ class Page implements OptionsAwareInterface { - use OptionsAwareTrait; + use OptionsAwareTrait; /** * API Client instance @@ -36,9 +36,9 @@ class Page implements OptionsAwareInterface { /** * Instantiates the class * - * @param Client $api_client API Client instance. - * @param string $template_basepath Base filepath for the template. - * @param string $assets_baseurl Base URL for the assets. + * @param Client $api_client API Client instance. + * @param string $template_basepath Base filepath for the template. + * @param string $assets_baseurl Base URL for the assets. */ public function __construct( Client $api_client, $template_basepath, $assets_baseurl ) { $this->api_client = $api_client; diff --git a/src/Admin/Settings/ServiceProvider.php b/src/Admin/Settings/ServiceProvider.php index bb829c7..12c9a6e 100644 --- a/src/Admin/Settings/ServiceProvider.php +++ b/src/Admin/Settings/ServiceProvider.php @@ -5,28 +5,43 @@ use RocketCDN\API\Client; use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; -use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - public function get_common_subscribers(): array - { - return [ - \RocketCDN\Admin\Settings\Subscriber::class - ]; - } - public function define() { - $this->register_service(Page::class)->set_definition(function (DefinitionInterface $definition) { - $definition->addArguments([ - Client::class, - 'template_basepath', - 'assets_baseurl', - ]); - }); + /** + * Returns common subscribers. + * + * @return string[] + */ + public function get_common_subscribers(): array { + return [ + \RocketCDN\Admin\Settings\Subscriber::class, + ]; + } - $this->register_service(\RocketCDN\Admin\Settings\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument(Page::class); - }); - } + /** + * Register the services. + * + * @return void + */ + public function define() { + $this->register_service( Page::class )->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArguments( + [ + Client::class, + 'template_basepath', + 'assets_baseurl', + ] + ); + } + ); + + $this->register_service( \RocketCDN\Admin\Settings\Subscriber::class )->share()->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArgument( Page::class ); + } + ); + } } diff --git a/src/Front/CDN.php b/src/Front/CDN.php index a4d4e6f..f12e51a 100644 --- a/src/Front/CDN.php +++ b/src/Front/CDN.php @@ -3,13 +3,12 @@ namespace RocketCDN\Front; - use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; class CDN implements OptionsAwareInterface { - use OptionsAwareTrait; + use OptionsAwareTrait; /** * Home URL host * diff --git a/src/Front/ServiceProvider.php b/src/Front/ServiceProvider.php index 36a9a96..21bc8e6 100644 --- a/src/Front/ServiceProvider.php +++ b/src/Front/ServiceProvider.php @@ -4,22 +4,32 @@ namespace RocketCDN\Front; use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; -use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - public function define() { - $this->register_service(CDN::class); - $this->register_service(\RocketCDN\Front\Subscriber::class)->share() - ->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument(CDN::class); - }); - } + /** + * Register the services. + * + * @return void + */ + public function define() { + $this->register_service( CDN::class ); + $this->register_service( \RocketCDN\Front\Subscriber::class )->share() + ->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArgument( CDN::class ); + } + ); + } - public function get_common_subscribers(): array - { - return [ - \RocketCDN\Front\Subscriber::class - ]; - } + /** + * Returns common subscribers. + * + * @return string[] + */ + public function get_common_subscribers(): array { + return [ + \RocketCDN\Front\Subscriber::class, + ]; + } } From f5003f196c0f30bf7c9c535a52c775a4884a2fcb Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 15:36:28 +0200 Subject: [PATCH 05/40] Fixed ci for deploying to wordpress.org --- .github/workflows/deploy-tag.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-tag.yml b/.github/workflows/deploy-tag.yml index cf2459e..18b79ee 100644 --- a/.github/workflows/deploy-tag.yml +++ b/.github/workflows/deploy-tag.yml @@ -9,7 +9,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - name: build + - name: normal build + run: composer install + - name: optimized build run: composer install -o --no-dev --no-scripts - name: WordPress Plugin Deploy uses: 10up/action-wordpress-plugin-deploy@stable From 686777d90206f631e38f2c8d83f4fae943b53b6b Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 15:41:43 +0200 Subject: [PATCH 06/40] Updated php on the linter --- .github/workflows/lint_phpcs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_phpcs.yml b/.github/workflows/lint_phpcs.yml index 92597a8..95d1e02 100644 --- a/.github/workflows/lint_phpcs.yml +++ b/.github/workflows/lint_phpcs.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['7.4'] + php-versions: ['8.0'] name: RocketCDN lint with PHPCS. PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}. steps: From c88aa0640a1cae1794e4a23c8eb7ae59101f6955 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 15:45:41 +0200 Subject: [PATCH 07/40] Fix installer issue --- .github/workflows/deploy-tag.yml | 2 ++ composer.json | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-tag.yml b/.github/workflows/deploy-tag.yml index 18b79ee..64fff3b 100644 --- a/.github/workflows/deploy-tag.yml +++ b/.github/workflows/deploy-tag.yml @@ -11,6 +11,8 @@ jobs: - uses: actions/checkout@master - name: normal build run: composer install + - name: remove installers + run: composer remove composer/installers - name: optimized build run: composer install -o --no-dev --no-scripts - name: WordPress Plugin Deploy diff --git a/composer.json b/composer.json index 5a87708..a2acabf 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,11 @@ ], "type": "wordpress-plugin", "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "composer/installers": true + } + }, "support": { "issues": "https://github.com/wp-media/rocketcdn-plugin/issues", From 5d02dfb673f8f3bd8a0c7901ae3c3c45f204564c Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 15:47:33 +0200 Subject: [PATCH 08/40] Fix phpcs issue --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a2acabf..37d7c2a 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "config": { "sort-packages": true, "allow-plugins": { - "composer/installers": true + "composer/installers": true, + "dealerdirect/phpcodesniffer-composer-installer": true } }, From b1d3ccf2d4f159cd22906470a4956d807bf27715 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 15:49:42 +0200 Subject: [PATCH 09/40] Fix script issue --- .github/workflows/lint_phpcs.yml | 2 +- .github/workflows/test_php8.yml | 2 +- .github/workflows/test_rocketcdn.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint_phpcs.yml b/.github/workflows/lint_phpcs.yml index 95d1e02..6126970 100644 --- a/.github/workflows/lint_phpcs.yml +++ b/.github/workflows/lint_phpcs.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['8.0'] + php-versions: ['8.1'] name: RocketCDN lint with PHPCS. PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}. steps: diff --git a/.github/workflows/test_php8.yml b/.github/workflows/test_php8.yml index 2a82dc9..a5cadb1 100644 --- a/.github/workflows/test_php8.yml +++ b/.github/workflows/test_php8.yml @@ -61,7 +61,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-scripts --ignore-platform-reqs + run: composer install --prefer-dist --no-interaction --ignore-platform-reqs - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/.github/workflows/test_rocketcdn.yml b/.github/workflows/test_rocketcdn.yml index 2523778..6642ac5 100644 --- a/.github/workflows/test_rocketcdn.yml +++ b/.github/workflows/test_rocketcdn.yml @@ -62,7 +62,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-scripts + run: composer install --prefer-dist --no-interaction - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} From 9cfdb9dcfa2613c0bd2640fad39b0dc035b57b59 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 16:10:26 +0200 Subject: [PATCH 10/40] Added fixes for unit tests --- .github/workflows/test_rocketcdn.yml | 2 +- tests/Fixtures/src/Options/Options/delete.php | 10 ------ tests/Fixtures/src/Options/Options/get.php | 33 ------------------- .../src/Options/Options/getOptionName.php | 17 ---------- tests/Fixtures/src/Options/Options/set.php | 15 --------- tests/Unit/src/API/Client/getCustomerData.php | 4 +-- .../Unit/src/API/Client/getWebsiteCdnUrl.php | 4 +-- tests/Unit/src/API/Client/isWebsiteSync.php | 4 +-- tests/Unit/src/API/Client/purgeCache.php | 5 +-- .../AdminBar/AdminBar/addAdminBarMenu.php | 5 +-- .../Admin/AdminBar/AdminBar/enqueueStyle.php | 3 +- .../Admin/AdminBar/AdminBar/purgeCache.php | 5 +-- .../Notices/Notices/emptyApiKeyNotice.php | 5 +-- .../Notices/Notices/wrongApiKeyNotice.php | 6 ++-- .../Admin/Settings/Page/configureSettings.php | 4 +-- .../src/Admin/Settings/Page/enqueueAssets.php | 5 +-- .../src/Admin/Settings/Page/purgeCache.php | 5 +-- .../src/Admin/Settings/Page/renderPage.php | 5 +-- .../src/Admin/Settings/Page/saveCdnUrl.php | 5 +-- .../src/Admin/Settings/Page/updateApiKey.php | 5 +-- .../Admin/Settings/Page/validateApiKey.php | 5 +-- tests/Unit/src/Front/CDN/addPreconnectCdn.php | 5 +-- tests/Unit/src/Front/CDN/endBuffering.php | 5 +-- tests/Unit/src/Front/CDN/rewriteUrl.php | 5 +-- tests/Unit/src/Front/CDN/startBuffering.php | 4 +-- tests/Unit/src/Options/Options/delete.php | 25 -------------- tests/Unit/src/Options/Options/get.php | 27 --------------- .../src/Options/Options/getOptionName.php | 22 ------------- tests/Unit/src/Options/Options/set.php | 25 -------------- 29 files changed, 40 insertions(+), 230 deletions(-) delete mode 100644 tests/Fixtures/src/Options/Options/delete.php delete mode 100644 tests/Fixtures/src/Options/Options/get.php delete mode 100644 tests/Fixtures/src/Options/Options/getOptionName.php delete mode 100644 tests/Fixtures/src/Options/Options/set.php delete mode 100644 tests/Unit/src/Options/Options/delete.php delete mode 100644 tests/Unit/src/Options/Options/get.php delete mode 100644 tests/Unit/src/Options/Options/getOptionName.php delete mode 100644 tests/Unit/src/Options/Options/set.php diff --git a/.github/workflows/test_rocketcdn.yml b/.github/workflows/test_rocketcdn.yml index 6642ac5..e51ab38 100644 --- a/.github/workflows/test_rocketcdn.yml +++ b/.github/workflows/test_rocketcdn.yml @@ -62,7 +62,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction + run: composer install --prefer-dist --no-interaction --ignore-platform-reqs - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/tests/Fixtures/src/Options/Options/delete.php b/tests/Fixtures/src/Options/Options/delete.php deleted file mode 100644 index d6fcb4d..0000000 --- a/tests/Fixtures/src/Options/Options/delete.php +++ /dev/null @@ -1,10 +0,0 @@ - [ - 'config' => [ - 'prefix' => 'prefix', - 'name' => 'name', - ], - 'expected' => 'prefixname', - ], -]; diff --git a/tests/Fixtures/src/Options/Options/get.php b/tests/Fixtures/src/Options/Options/get.php deleted file mode 100644 index 82bb3b5..0000000 --- a/tests/Fixtures/src/Options/Options/get.php +++ /dev/null @@ -1,33 +0,0 @@ - [ - 'config' => [ - 'prefix' => 'prefix', - 'option_name' => 'option_name', - 'default' => 'default', - 'name' => 'name', - 'option' => 'option', - ], - 'expected' => 'option', - ], - 'testShouldReturnDefaultWhenNotExisting' => [ - 'config' => [ - 'prefix' => 'prefix', - 'option_name' => 'option_name', - 'default' => 'default', - 'name' => 'name', - 'option' => 'default', - ], - 'expected' => 'default', - ], - 'testShouldReturnConvertedValueWhenNotArray' => [ - 'config' => [ - 'prefix' => 'prefix', - 'option_name' => 'option_name', - 'default' => [], - 'name' => 'name', - 'option' => 'option', - ], - 'expected' => (array) 'option', - ], -]; diff --git a/tests/Fixtures/src/Options/Options/getOptionName.php b/tests/Fixtures/src/Options/Options/getOptionName.php deleted file mode 100644 index 3a5100a..0000000 --- a/tests/Fixtures/src/Options/Options/getOptionName.php +++ /dev/null @@ -1,17 +0,0 @@ - [ - 'config' => [ - 'prefix' => '', - 'name' => 'name', - ], - 'expected' => 'name', - ], - 'testPrefixNonEmptyShouldReturnExpected' => [ - 'config' => [ - 'prefix' => 'prefix', - 'name' => 'name', - ], - 'expected' => 'prefixname', - ], -]; diff --git a/tests/Fixtures/src/Options/Options/set.php b/tests/Fixtures/src/Options/Options/set.php deleted file mode 100644 index f782897..0000000 --- a/tests/Fixtures/src/Options/Options/set.php +++ /dev/null @@ -1,15 +0,0 @@ - [ - 'config' => [ - 'prefix' => 'prefix', - 'name' => 'name', - 'value' => 'value', - ], - 'expected' => [ - 'option_name' => 'prefixname', - 'value' => 'value', - ], - ], -]; diff --git a/tests/Unit/src/API/Client/getCustomerData.php b/tests/Unit/src/API/Client/getCustomerData.php index 3a1d028..e8d65f7 100644 --- a/tests/Unit/src/API/Client/getCustomerData.php +++ b/tests/Unit/src/API/Client/getCustomerData.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -21,8 +20,7 @@ class Test_GetCustomerData extends TestCase { protected function setUp(): void { parent::setUp(); - $options_api = Mockery::mock( Options::class ); - $this->client = new Client( $options_api ); + $this->client = new Client(); } /** diff --git a/tests/Unit/src/API/Client/getWebsiteCdnUrl.php b/tests/Unit/src/API/Client/getWebsiteCdnUrl.php index fd6652d..6af6a02 100644 --- a/tests/Unit/src/API/Client/getWebsiteCdnUrl.php +++ b/tests/Unit/src/API/Client/getWebsiteCdnUrl.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; /** @@ -19,8 +18,7 @@ class Test_GetWebsiteCdnUrl extends TestCase { protected function setUp(): void { parent::setUp(); - $options_api = Mockery::mock( Options::class ); - $this->client = Mockery::mock( Client::class . '[get_customer_data]', [ $options_api ] ); + $this->client = Mockery::mock( Client::class . '[get_customer_data]' ); } /** diff --git a/tests/Unit/src/API/Client/isWebsiteSync.php b/tests/Unit/src/API/Client/isWebsiteSync.php index 432a4d5..9fa8378 100644 --- a/tests/Unit/src/API/Client/isWebsiteSync.php +++ b/tests/Unit/src/API/Client/isWebsiteSync.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; /** @@ -18,8 +17,7 @@ class Test_IsWebsiteSync extends TestCase { protected function setUp(): void { parent::setUp(); - $options_api = Mockery::mock( Options::class ); - $this->client = Mockery::mock( Client::class . '[get_customer_data]', [ $options_api ] ); + $this->client = Mockery::mock( Client::class . '[get_customer_data]' ); } /** diff --git a/tests/Unit/src/API/Client/purgeCache.php b/tests/Unit/src/API/Client/purgeCache.php index a3af076..1712e97 100644 --- a/tests/Unit/src/API/Client/purgeCache.php +++ b/tests/Unit/src/API/Client/purgeCache.php @@ -4,8 +4,8 @@ use Mockery; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use Brain\Monkey\Functions; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -27,7 +27,8 @@ public function testShouldReturnAsExcepted( $config, $expected ) { } else { $options_api->expects()->get( 'cdn_url' )->never(); } - $client = new Client( $options_api ); + $client = new Client(); + $client->set_options($options_api); Functions\expect( '__' )->zeroOrMoreTimes() ->andReturnFirstArg(); if ( $config['api'] && $config['cdn'] ) { diff --git a/tests/Unit/src/Admin/AdminBar/AdminBar/addAdminBarMenu.php b/tests/Unit/src/Admin/AdminBar/AdminBar/addAdminBarMenu.php index fc95a5e..da83e49 100644 --- a/tests/Unit/src/Admin/AdminBar/AdminBar/addAdminBarMenu.php +++ b/tests/Unit/src/Admin/AdminBar/AdminBar/addAdminBarMenu.php @@ -5,7 +5,7 @@ use Mockery; use RocketCDN\Admin\AdminBar\AdminBar; use RocketCDN\API\Client; -use RocketCDN\Options\Options; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; use WP_Admin_Bar; @@ -25,7 +25,8 @@ protected function setUp(): void { $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); $this->admin_bar = Mockery::mock( WP_Admin_Bar::class ); - $this->admin_bar_menu = new AdminBar( $this->options, $this->client, '/' ); + $this->admin_bar_menu = new AdminBar( $this->client, '/' ); + $this->admin_bar_menu->set_options($this->options); parent::setUp(); } diff --git a/tests/Unit/src/Admin/AdminBar/AdminBar/enqueueStyle.php b/tests/Unit/src/Admin/AdminBar/AdminBar/enqueueStyle.php index aa6310d..7360779 100644 --- a/tests/Unit/src/Admin/AdminBar/AdminBar/enqueueStyle.php +++ b/tests/Unit/src/Admin/AdminBar/AdminBar/enqueueStyle.php @@ -5,7 +5,6 @@ use Mockery; use RocketCDN\Admin\AdminBar\AdminBar; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -20,7 +19,7 @@ class Test_EnqueueStyle extends TestCase { * @dataProvider configTestData */ public function testShouldReturnExpected( $config, $expected ) { - $admin_bar = new AdminBar( Mockery::mock( Options::class ), Mockery::mock( Client::class ), $config['base'] ); + $admin_bar = new AdminBar( Mockery::mock( Client::class ), $config['base'] ); Functions\expect( 'wp_enqueue_style' ) ->with( $expected['id'], $expected['path'], $expected['options'], $expected['version'] ); $admin_bar->enqueue_style(); diff --git a/tests/Unit/src/Admin/AdminBar/AdminBar/purgeCache.php b/tests/Unit/src/Admin/AdminBar/AdminBar/purgeCache.php index 3f721b1..18c4340 100644 --- a/tests/Unit/src/Admin/AdminBar/AdminBar/purgeCache.php +++ b/tests/Unit/src/Admin/AdminBar/AdminBar/purgeCache.php @@ -5,7 +5,6 @@ use Mockery; use RocketCDN\Admin\AdminBar\AdminBar; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -16,14 +15,12 @@ */ class Test_PurgeCache extends TestCase { - protected $options; protected $client; protected $admin_bar_menu; protected function setUp(): void { - $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->admin_bar_menu = Mockery::mock( AdminBar::class . '[exit]', [ $this->options, $this->client, '/' ] ) + $this->admin_bar_menu = Mockery::mock( AdminBar::class . '[exit]', [ $this->client, '/' ] ) ->shouldAllowMockingProtectedMethods(); parent::setUp(); } diff --git a/tests/Unit/src/Admin/Notices/Notices/emptyApiKeyNotice.php b/tests/Unit/src/Admin/Notices/Notices/emptyApiKeyNotice.php index 831b659..fb5341c 100644 --- a/tests/Unit/src/Admin/Notices/Notices/emptyApiKeyNotice.php +++ b/tests/Unit/src/Admin/Notices/Notices/emptyApiKeyNotice.php @@ -5,7 +5,7 @@ use Mockery; use RocketCDN\Admin\Notices\Notices; use RocketCDN\API\Client; -use RocketCDN\Options\Options; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -23,7 +23,8 @@ class Test_EmptyApiKeyNotice extends TestCase { protected function setUp(): void { $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->notices = new Notices( $this->options, $this->client ); + $this->notices = new Notices( $this->client ); + $this->notices->set_options($this->options); parent::setUp(); } diff --git a/tests/Unit/src/Admin/Notices/Notices/wrongApiKeyNotice.php b/tests/Unit/src/Admin/Notices/Notices/wrongApiKeyNotice.php index eb59206..675cab4 100644 --- a/tests/Unit/src/Admin/Notices/Notices/wrongApiKeyNotice.php +++ b/tests/Unit/src/Admin/Notices/Notices/wrongApiKeyNotice.php @@ -4,6 +4,7 @@ use Mockery; use RocketCDN\Admin\Notices\Notices; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -19,9 +20,10 @@ class Test_WrongApiKeyNotice extends TestCase { protected $notices; protected function setUp(): void { - $this->options = Mockery::mock( \RocketCDN\Options\Options::class ); + $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( \RocketCDN\API\Client::class ); - $this->notices = new Notices( $this->options, $this->client ); + $this->notices = new Notices( $this->client ); + $this->notices->set_options($this->options); parent::setUp(); } diff --git a/tests/Unit/src/Admin/Settings/Page/configureSettings.php b/tests/Unit/src/Admin/Settings/Page/configureSettings.php index 9bbfad5..9c66934 100644 --- a/tests/Unit/src/Admin/Settings/Page/configureSettings.php +++ b/tests/Unit/src/Admin/Settings/Page/configureSettings.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use WPMedia\PHPUnit\Unit\TestCase; use Brain\Monkey\Functions; @@ -20,9 +19,8 @@ class Test_ConfigureSettings extends TestCase { protected function setUp(): void { parent::setUp(); - $options_api = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $options_api, $this->client, '/', '/' ); + $this->page = new Page( $this->client, '/', '/' ); } public function testShouldRegister() { diff --git a/tests/Unit/src/Admin/Settings/Page/enqueueAssets.php b/tests/Unit/src/Admin/Settings/Page/enqueueAssets.php index 67e78de..e372d62 100644 --- a/tests/Unit/src/Admin/Settings/Page/enqueueAssets.php +++ b/tests/Unit/src/Admin/Settings/Page/enqueueAssets.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -14,15 +13,13 @@ * @group Settings */ class Test_EnqueueAssets extends TestCase { - protected $options; protected $client; protected $page; protected function setUp(): void { parent::setUp(); - $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); } /** * @dataProvider configTestData diff --git a/tests/Unit/src/Admin/Settings/Page/purgeCache.php b/tests/Unit/src/Admin/Settings/Page/purgeCache.php index 2335366..eeafe64 100644 --- a/tests/Unit/src/Admin/Settings/Page/purgeCache.php +++ b/tests/Unit/src/Admin/Settings/Page/purgeCache.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -14,15 +13,13 @@ * @group Settings */ class Test_PurgeCache extends TestCase { - protected $options; protected $client; protected $page; protected function setUp(): void { parent::setUp(); - $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); } /** diff --git a/tests/Unit/src/Admin/Settings/Page/renderPage.php b/tests/Unit/src/Admin/Settings/Page/renderPage.php index a91d5a9..3cb714f 100644 --- a/tests/Unit/src/Admin/Settings/Page/renderPage.php +++ b/tests/Unit/src/Admin/Settings/Page/renderPage.php @@ -4,8 +4,8 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use Brain\Monkey\Functions; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -23,7 +23,8 @@ protected function setUp(): void { parent::setUp(); $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page->set_options($this->options); } /** diff --git a/tests/Unit/src/Admin/Settings/Page/saveCdnUrl.php b/tests/Unit/src/Admin/Settings/Page/saveCdnUrl.php index edccdca..59219fe 100644 --- a/tests/Unit/src/Admin/Settings/Page/saveCdnUrl.php +++ b/tests/Unit/src/Admin/Settings/Page/saveCdnUrl.php @@ -4,7 +4,7 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -21,7 +21,8 @@ protected function setUp(): void { parent::setUp(); $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page->set_options($this->options); } /** diff --git a/tests/Unit/src/Admin/Settings/Page/updateApiKey.php b/tests/Unit/src/Admin/Settings/Page/updateApiKey.php index 9d2e3fa..3a62e4d 100644 --- a/tests/Unit/src/Admin/Settings/Page/updateApiKey.php +++ b/tests/Unit/src/Admin/Settings/Page/updateApiKey.php @@ -4,8 +4,8 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use Brain\Monkey\Functions; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -23,7 +23,8 @@ protected function setUp(): void { parent::setUp(); $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page->set_options($this->options); } /** diff --git a/tests/Unit/src/Admin/Settings/Page/validateApiKey.php b/tests/Unit/src/Admin/Settings/Page/validateApiKey.php index 5932d17..2c5d72d 100644 --- a/tests/Unit/src/Admin/Settings/Page/validateApiKey.php +++ b/tests/Unit/src/Admin/Settings/Page/validateApiKey.php @@ -5,7 +5,6 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -15,15 +14,13 @@ */ class Test_ValidateApiKey extends TestCase { - protected $options; protected $client; protected $page; protected function setUp(): void { parent::setUp(); - $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); } /** diff --git a/tests/Unit/src/Front/CDN/addPreconnectCdn.php b/tests/Unit/src/Front/CDN/addPreconnectCdn.php index 650e904..360718a 100644 --- a/tests/Unit/src/Front/CDN/addPreconnectCdn.php +++ b/tests/Unit/src/Front/CDN/addPreconnectCdn.php @@ -3,8 +3,8 @@ namespace RocketCDN\Tests\Unit\src\Front\CDN; use Mockery; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Front\CDN; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -20,7 +20,8 @@ class Test_AddPreconnectCdn extends TestCase { protected function setUp(): void { parent::setUp(); $this->options = Mockery::mock( Options::class ); - $this->cdn = Mockery::mock( CDN::class . '[should_rewrite]', [ $this->options ] )->shouldAllowMockingProtectedMethods(); + $this->cdn = Mockery::mock( CDN::class . '[should_rewrite]' )->shouldAllowMockingProtectedMethods(); + $this->cdn->set_options($this->options); } /** * @dataProvider configTestData diff --git a/tests/Unit/src/Front/CDN/endBuffering.php b/tests/Unit/src/Front/CDN/endBuffering.php index 9e54aa9..b3c5bf1 100644 --- a/tests/Unit/src/Front/CDN/endBuffering.php +++ b/tests/Unit/src/Front/CDN/endBuffering.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\Front\CDN; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -21,13 +20,11 @@ */ class Test_EndBuffering extends TestCase { - protected $options; protected $cdn; protected function setUp(): void { parent::setUp(); - $this->options = Mockery::mock( Options::class ); - $this->cdn = Mockery::mock( CDN::class . '[rewrite_url]', [ $this->options ] ); + $this->cdn = Mockery::mock( CDN::class . '[rewrite_url]' ); } /** * @dataProvider configTestData diff --git a/tests/Unit/src/Front/CDN/rewriteUrl.php b/tests/Unit/src/Front/CDN/rewriteUrl.php index 5ee4284..8b50313 100644 --- a/tests/Unit/src/Front/CDN/rewriteUrl.php +++ b/tests/Unit/src/Front/CDN/rewriteUrl.php @@ -3,8 +3,8 @@ namespace RocketCDN\Tests\Unit\src\Front\CDN; use Mockery; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Front\CDN; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -22,7 +22,8 @@ class Test_RewriteUrl extends TestCase { protected function setUp(): void { parent::setUp(); $this->options = Mockery::mock( Options::class ); - $this->cdn = new CDN( $this->options ); + $this->cdn = new CDN(); + $this->cdn->set_options($this->options); } /** diff --git a/tests/Unit/src/Front/CDN/startBuffering.php b/tests/Unit/src/Front/CDN/startBuffering.php index 8b372b3..8ce91e4 100644 --- a/tests/Unit/src/Front/CDN/startBuffering.php +++ b/tests/Unit/src/Front/CDN/startBuffering.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\Front\CDN; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -20,8 +19,7 @@ class Test_StartBuffering extends TestCase { protected function setUp(): void { parent::setUp(); - $options = Mockery::mock( Options::class ); - $this->cdn = new CDN( $options ); + $this->cdn = new CDN(); } /** * @dataProvider configTestData diff --git a/tests/Unit/src/Options/Options/delete.php b/tests/Unit/src/Options/Options/delete.php deleted file mode 100644 index 7015677..0000000 --- a/tests/Unit/src/Options/Options/delete.php +++ /dev/null @@ -1,25 +0,0 @@ -with( $expected ); - $option->delete( $config['name'] ); - } -} diff --git a/tests/Unit/src/Options/Options/get.php b/tests/Unit/src/Options/Options/get.php deleted file mode 100644 index bf30126..0000000 --- a/tests/Unit/src/Options/Options/get.php +++ /dev/null @@ -1,27 +0,0 @@ -with( $config['option_name'], $config['default'] ) - ->andReturn( $config['option'] ); - $this->assertEquals( $expected, $option->get( $config['name'], $config['default'] ) ); - } -} diff --git a/tests/Unit/src/Options/Options/getOptionName.php b/tests/Unit/src/Options/Options/getOptionName.php deleted file mode 100644 index c82fc8e..0000000 --- a/tests/Unit/src/Options/Options/getOptionName.php +++ /dev/null @@ -1,22 +0,0 @@ -assertEquals( $expected, $option->get_option_name( $config['name'] ) ); - } -} diff --git a/tests/Unit/src/Options/Options/set.php b/tests/Unit/src/Options/Options/set.php deleted file mode 100644 index 7f3c588..0000000 --- a/tests/Unit/src/Options/Options/set.php +++ /dev/null @@ -1,25 +0,0 @@ -with( $expected['option_name'], $expected['value'] ); - $option->set( $config['name'], $config['value'] ); - } -} From 0f6b0cde06852596a967ad874966778a8015415d Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 16:19:35 +0200 Subject: [PATCH 11/40] Retrograde mozart --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 37d7c2a..fceff48 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "require-dev": { "php": "^7 || ^8", "brain/monkey": "^2.0", - "coenjacobs/mozart": "^0.7", + "coenjacobs/mozart": "^0.5.1", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "league/container": "^3.3", "phpcompatibility/phpcompatibility-wp": "^2.0", From 1c40c34f03f66cdd86f9eaa4f76a072677d913d0 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 16:23:02 +0200 Subject: [PATCH 12/40] Retrograde mozart --- composer.lock | 299 +++++++++++++++++++++++++------------------------- 1 file changed, 152 insertions(+), 147 deletions(-) diff --git a/composer.lock b/composer.lock index 054312b..c680817 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "05d14a7ac2d918dedecab2a7125d6243", + "content-hash": "22246a4fde2b733124fb799855ae6182", "packages": [ { "name": "composer/installers", @@ -279,29 +279,26 @@ }, { "name": "coenjacobs/mozart", - "version": "0.7.1", + "version": "0.5.1", "source": { "type": "git", "url": "https://github.com/coenjacobs/mozart.git", - "reference": "dbcdeb992d20d9c8914eef090f9a0d684bb1102c" + "reference": "4bdde231f3309d9299c87b2246166e87acc93653" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/coenjacobs/mozart/zipball/dbcdeb992d20d9c8914eef090f9a0d684bb1102c", - "reference": "dbcdeb992d20d9c8914eef090f9a0d684bb1102c", + "url": "https://api.github.com/repos/coenjacobs/mozart/zipball/4bdde231f3309d9299c87b2246166e87acc93653", + "reference": "4bdde231f3309d9299c87b2246166e87acc93653", "shasum": "" }, "require": { "league/flysystem": "^1.0", - "php": "^7.3|^8.0", + "php": "^7.2", "symfony/console": "^4|^5", "symfony/finder": "^4|^5" }, "require-dev": { - "mheap/phpunit-github-actions-printer": "^1.4", - "phpunit/phpunit": "^8.5", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.4" + "phpunit/phpunit": "^8.5" }, "bin": [ "bin/mozart" @@ -325,15 +322,9 @@ "description": "Composes all dependencies as a package inside a WordPress plugin", "support": { "issues": "https://github.com/coenjacobs/mozart/issues", - "source": "https://github.com/coenjacobs/mozart/tree/0.7.1" + "source": "https://github.com/coenjacobs/mozart/tree/0.5.1" }, - "funding": [ - { - "url": "https://github.com/coenjacobs", - "type": "github" - } - ], - "time": "2021-02-02T21:37:03+00:00" + "time": "2019-12-23T12:24:56+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -860,16 +851,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.11", + "version": "1.6.12", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "81a161d0b135df89951abd52296adf97deb0723d" + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/81a161d0b135df89951abd52296adf97deb0723d", - "reference": "81a161d0b135df89951abd52296adf97deb0723d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699", "shasum": "" }, "require": { @@ -939,20 +930,20 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2024-03-21T18:34:15+00:00" + "time": "2024-05-16T03:13:13+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -960,11 +951,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -990,7 +982,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -998,7 +990,7 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "phar-io/manifest", @@ -1424,16 +1416,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", "shasum": "" }, "require": { @@ -1482,9 +1474,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" }, - "time": "2024-04-09T21:13:58+00:00" + "time": "2024-05-21T05:55:05+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -1615,16 +1607,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.0", + "version": "1.29.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", "shasum": "" }, "require": { @@ -1656,9 +1648,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" }, - "time": "2024-05-06T12:04:23+00:00" + "time": "2024-05-31T08:52:43+00:00" }, { "name": "phpstan/phpstan", @@ -2168,12 +2160,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "8eea9afb8060c8ef05c89f02b123329f43e9ba4e" + "reference": "fed98f59fae0ca97a0753263270f4a8680d09f03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/8eea9afb8060c8ef05c89f02b123329f43e9ba4e", - "reference": "8eea9afb8060c8ef05c89f02b123329f43e9ba4e", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/fed98f59fae0ca97a0753263270f4a8680d09f03", + "reference": "fed98f59fae0ca97a0753263270f4a8680d09f03", "shasum": "" }, "conflict": { @@ -2181,6 +2173,10 @@ "admidio/admidio": "<4.2.13", "adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3", "aheinze/cockpit": "<2.2", + "aimeos/ai-admin-graphql": ">=2022.04.1,<2022.10.10|>=2023.04.1,<2023.10.6|>=2024.04.1,<2024.04.6", + "aimeos/ai-admin-jsonadm": "<2020.10.13|>=2021.04.1,<2021.10.6|>=2022.04.1,<2022.10.3|>=2023.04.1,<2023.10.4|==2024.04.1", + "aimeos/ai-client-html": ">=2020.04.1,<2020.10.27|>=2021.04.1,<2021.10.22|>=2022.04.1,<2022.10.13|>=2023.04.1,<2023.10.15|>=2024.04.1,<2024.04.7", + "aimeos/aimeos-core": ">=2022.04.1,<2022.10.17|>=2023.04.1,<2023.10.17|>=2024.04.1,<2024.04.7", "aimeos/aimeos-typo3": "<19.10.12|>=20,<20.10.5", "airesvsg/acf-to-rest-api": "<=3.1", "akaunting/akaunting": "<2.1.13", @@ -2231,6 +2227,7 @@ "bmarshall511/wordpress_zero_spam": "<5.2.13", "bolt/bolt": "<3.7.2", "bolt/core": "<=4.2", + "born05/craft-twofactorauthentication": "<3.3.4", "bottelet/flarepoint": "<2.2.1", "bref/bref": "<2.1.17", "brightlocal/phpwhois": "<=4.2.5", @@ -2246,6 +2243,7 @@ "cardgate/magento2": "<2.0.33", "cardgate/woocommerce": "<=3.1.15", "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", + "cart2quote/module-quotation-encoded": ">=4.1.6,<=4.4.5|>=5,<5.4.4", "cartalyst/sentry": "<=2.1.6", "catfan/medoo": "<1.7.5", "causal/oidc": "<2.1", @@ -2261,7 +2259,7 @@ "codeigniter4/framework": "<4.4.7", "codeigniter4/shield": "<1.0.0.0-beta8", "codiad/codiad": "<=2.8.4", - "composer/composer": "<1.10.27|>=2,<2.2.23|>=2.3,<2.7", + "composer/composer": "<1.10.27|>=2,<2.2.24|>=2.3,<2.7.7", "concrete5/concrete5": "<9.2.8", "concrete5/core": "<8.5.8|>=9,<9.1", "contao-components/mediaelement": ">=2.14.2,<2.21.1", @@ -2294,11 +2292,11 @@ "doctrine/common": "<2.4.3|>=2.5,<2.5.1", "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2|>=3,<3.1.4", "doctrine/doctrine-bundle": "<1.5.2", - "doctrine/doctrine-module": "<=0.7.1", + "doctrine/doctrine-module": "<0.7.2", "doctrine/mongodb-odm": "<1.0.2", "doctrine/mongodb-odm-bundle": "<3.0.1", - "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", - "dolibarr/dolibarr": "<=19", + "doctrine/orm": ">=1,<1.2.4|>=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", + "dolibarr/dolibarr": "<19.0.2", "dompdf/dompdf": "<2.0.4", "doublethreedigital/guest-entries": "<3.1.2", "drupal/core": ">=6,<6.38|>=7,<7.96|>=8,<10.1.8|>=10.2,<10.2.2", @@ -2335,7 +2333,7 @@ "ezsystems/ezplatform-solr-search-engine": ">=1.7,<1.7.12|>=2,<2.0.2|>=3.3,<3.3.15", "ezsystems/ezplatform-user": ">=1,<1.0.1", "ezsystems/ezpublish-kernel": "<6.13.8.2-dev|>=7,<7.5.31", - "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.06,<=2019.03.5.1", + "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.03.5.1", "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", "ezsystems/repository-forms": ">=2.3,<2.3.2.1-dev|>=2.5,<2.5.15", "ezyang/htmlpurifier": "<4.1.1", @@ -2369,7 +2367,7 @@ "frappant/frp-form-answers": "<3.1.2|>=4,<4.0.2", "friendsofsymfony/oauth2-php": "<1.3", "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", - "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", + "friendsofsymfony/user-bundle": ">=1,<1.3.5", "friendsofsymfony1/swiftmailer": ">=4,<5.4.13|>=6,<6.2.5", "friendsofsymfony1/symfony1": ">=1.1,<1.15.19", "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", @@ -2381,7 +2379,8 @@ "funadmin/funadmin": "<=3.2|>=3.3.2,<=3.3.3", "gaoming13/wechat-php-sdk": "<=1.10.2", "genix/cms": "<=1.1.11", - "getgrav/grav": "<1.7.45", + "getformwork/formwork": "<1.13.1|==2.0.0.0-beta1", + "getgrav/grav": "<1.7.46", "getkirby/cms": "<4.1.1", "getkirby/kirby": "<=2.5.12", "getkirby/panel": "<2.5.14", @@ -2394,7 +2393,7 @@ "gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3", "gree/jose": "<2.2.1", "gregwar/rst": "<1.0.3", - "grumpydictator/firefly-iii": "<6.1.7", + "grumpydictator/firefly-iii": "<6.1.17", "gugoan/economizzer": "<=0.9.0.0-beta1", "guzzlehttp/guzzle": "<6.5.8|>=7,<7.4.5", "guzzlehttp/psr7": "<1.9.1|>=2,<2.4.5", @@ -2418,7 +2417,7 @@ "idno/known": "<=1.3.1", "ilicmiljan/secure-props": ">=1.2,<1.2.2", "illuminate/auth": "<5.5.10", - "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.99999|>=4.2,<=4.2.99999|>=5,<=5.0.99999|>=5.1,<=5.1.99999|>=5.2,<=5.2.99999|>=5.3,<=5.3.99999|>=5.4,<=5.4.99999|>=5.5,<=5.5.49|>=5.6,<=5.6.99999|>=5.7,<=5.7.99999|>=5.8,<=5.8.99999|>=6,<6.18.31|>=7,<7.22.4", + "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<6.18.31|>=7,<7.22.4", "illuminate/database": "<6.20.26|>=7,<7.30.5|>=8,<8.40", "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", "illuminate/view": "<6.20.42|>=7,<7.30.6|>=8,<8.75", @@ -2451,6 +2450,7 @@ "jsdecena/laracom": "<2.0.9", "jsmitty12/phpwhois": "<5.1", "juzaweb/cms": "<=3.4", + "jweiland/events2": "<8.3.8|>=9,<9.0.6", "kazist/phpwhois": "<=4.2.6", "kelvinmo/simplexrd": "<3.1.1", "kevinpapst/kimai2": "<1.16.7", @@ -2470,7 +2470,7 @@ "laravel/fortify": "<1.11.1", "laravel/framework": "<6.20.44|>=7,<7.30.6|>=8,<8.75", "laravel/laravel": ">=5.4,<5.4.22", - "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", + "laravel/socialite": ">=1,<2.0.10", "latte/latte": "<2.10.8", "lavalite/cms": "<=9|==10.1", "lcobucci/jwt": ">=3.4,<3.4.6|>=4,<4.0.4|>=4.1,<4.1.5", @@ -2488,7 +2488,7 @@ "lms/routes": "<2.1.1", "localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2", "luyadev/yii-helpers": "<1.2.1", - "magento/community-edition": "<2.4.3.0-patch3|>=2.4.4,<2.4.5", + "magento/community-edition": "<2.4.5|==2.4.5|>=2.4.5.0-patch1,<2.4.5.0-patch8|==2.4.6|>=2.4.6.0-patch1,<2.4.6.0-patch6|==2.4.7", "magento/core": "<=1.9.4.5", "magento/magento1ce": "<1.9.4.3-dev", "magento/magento1ee": ">=1,<1.14.4.3-dev", @@ -2521,7 +2521,7 @@ "mojo42/jirafeau": "<4.4", "mongodb/mongodb": ">=1,<1.9.2", "monolog/monolog": ">=1.8,<1.12", - "moodle/moodle": "<=4.3.3", + "moodle/moodle": "<4.3.5|>=4.4.0.0-beta,<4.4.1", "mos/cimage": "<0.7.19", "movim/moxl": ">=0.8,<=0.10", "movingbytes/social-network": "<=1.2.1", @@ -2539,8 +2539,8 @@ "neos/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", "neos/form": ">=1.2,<4.3.3|>=5,<5.0.9|>=5.1,<5.1.3", "neos/media-browser": "<7.3.19|>=8,<8.0.16|>=8.1,<8.1.11|>=8.2,<8.2.11|>=8.3,<8.3.9", - "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<5.3.10|>=7,<7.0.9|>=7.1,<7.1.7|>=7.2,<7.2.6|>=7.3,<7.3.4|>=8,<8.0.2", - "neos/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", + "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<5.3.10|>=7,<7.0.9|>=7.1,<7.1.7|>=7.2,<7.2.6|>=7.3,<7.3.4|>=8,<8.0.2", + "neos/swiftmailer": "<5.4.5", "netgen/tagsbundle": ">=3.4,<3.4.11|>=4,<4.0.15", "nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6", "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", @@ -2558,12 +2558,12 @@ "october/cms": "<1.0.469|==1.0.469|==1.0.471|==1.1.1", "october/october": "<=3.4.4", "october/rain": "<1.0.472|>=1.1,<1.1.2", - "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.34|>=3,<3.5.2", + "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.34|>=3,<3.5.15", "omeka/omeka-s": "<4.0.3", "onelogin/php-saml": "<2.10.4", "oneup/uploader-bundle": ">=1,<1.9.3|>=2,<2.1.5", "open-web-analytics/open-web-analytics": "<1.7.4", - "opencart/opencart": "<=3.0.3.7|>=4,<4.0.2.3-dev", + "opencart/opencart": "<=3.0.3.9|>=4", "openid/php-openid": "<2.3", "openmage/magento-lts": "<20.5", "opensolutions/vimbadmin": "<=3.0.15", @@ -2616,13 +2616,13 @@ "phpxmlrpc/extras": "<0.6.1", "phpxmlrpc/phpxmlrpc": "<4.9.2", "pi/pi": "<=2.5", - "pimcore/admin-ui-classic-bundle": "<1.3.4", + "pimcore/admin-ui-classic-bundle": "<=1.4.2", "pimcore/customer-management-framework-bundle": "<4.0.6", "pimcore/data-hub": "<1.2.4", "pimcore/demo": "<10.3", "pimcore/ecommerce-framework-bundle": "<1.0.10", "pimcore/perspective-editor": "<1.5.1", - "pimcore/pimcore": "<11.1.6.5-dev|>=11.2,<11.2.3", + "pimcore/pimcore": "<11.2.4", "pixelfed/pixelfed": "<0.11.11", "plotly/plotly.js": "<2.25.2", "pocketmine/bedrock-protocol": "<8.0.2", @@ -2687,7 +2687,7 @@ "silverstripe/admin": "<1.13.19|>=2,<2.1.8", "silverstripe/assets": ">=1,<1.11.1", "silverstripe/cms": "<4.11.3", - "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1", + "silverstripe/comments": ">=1.3,<3.1.1", "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", "silverstripe/framework": "<4.13.39|>=5,<5.1.11", "silverstripe/graphql": ">=2,<2.0.5|>=3,<3.8.2|>=4,<4.3.7|>=5,<5.1.3", @@ -2713,8 +2713,8 @@ "slim/psr7": "<1.4.1|>=1.5,<1.5.1|>=1.6,<1.6.1", "slim/slim": "<2.6", "slub/slub-events": "<3.0.3", - "smarty/smarty": "<3.1.48|>=4,<4.3.1", - "snipe/snipe-it": "<=6.2.2", + "smarty/smarty": "<4.5.3|>=5,<5.1.1", + "snipe/snipe-it": "<6.4.2", "socalnick/scn-social-auth": "<1.15.2", "socialiteproviders/steam": "<1.1", "spatie/browsershot": "<3.57.4", @@ -2724,11 +2724,13 @@ "spoonity/tcpdf": "<6.2.22", "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1", "ssddanbrown/bookstack": "<22.02.3", - "statamic/cms": "<4.46", + "statamic/cms": "<4.46|>=5.3,<5.6.2", "stormpath/sdk": "<9.9.99", "studio-42/elfinder": "<2.1.62", + "studiomitte/friendlycaptcha": "<0.1.4", "subhh/libconnect": "<7.0.8|>=8,<8.1", "sukohi/surpass": "<1", + "sulu/form-bundle": ">=2,<2.5.3", "sulu/sulu": "<1.6.44|>=2,<2.4.17|>=2.5,<2.5.13", "sumocoders/framework-user-bundle": "<1.4", "superbig/craft-audit": "<3.0.2", @@ -2740,8 +2742,8 @@ "sylius/grid-bundle": "<1.10.1", "sylius/paypal-plugin": ">=1,<1.2.4|>=1.3,<1.3.1", "sylius/resource-bundle": ">=1,<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", - "sylius/sylius": "<1.12.16|>=1.13.0.0-alpha1,<1.13.1", - "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", + "sylius/sylius": "<1.9.10|>=1.10,<1.10.11|>=1.11,<1.11.2|>=1.12.0.0-alpha1,<1.12.16|>=1.13.0.0-alpha1,<1.13.1", + "symbiote/silverstripe-multivaluefield": ">=3,<3.1", "symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4", "symbiote/silverstripe-seed": "<6.0.3", "symbiote/silverstripe-versionedfiles": "<=2.0.3", @@ -2792,7 +2794,7 @@ "thorsten/phpmyfaq": "<3.2.2", "tikiwiki/tiki-manager": "<=17.1", "timber/timber": ">=0.16.6,<1.23.1|>=1.24,<1.24.1|>=2,<2.1", - "tinymce/tinymce": "<7", + "tinymce/tinymce": "<7.2", "tinymighty/wiki-seo": "<1.2.2", "titon/framework": "<9.9.99", "tobiasbg/tablepress": "<=2.0.0.0-RC1", @@ -2829,12 +2831,14 @@ "uvdesk/core-framework": "<=1.1.1", "vanilla/safecurl": "<0.9.2", "verbb/comments": "<1.5.5", + "verbb/formie": "<2.1.6", "verbb/image-resizer": "<2.0.9", "verbb/knock-knock": "<1.2.8", "verot/class.upload.php": "<=2.1.6", "villagedefrance/opencart-overclocked": "<=1.11.1", "vova07/yii2-fileapi-widget": "<0.1.9", "vrana/adminer": "<4.8.1", + "vufind/vufind": ">=2,<9.1.1", "waldhacker/hcaptcha": "<2.1.2", "wallabag/tcpdf": "<6.2.22", "wallabag/wallabag": "<2.6.7", @@ -2853,14 +2857,14 @@ "winter/wn-dusk-plugin": "<2.1", "winter/wn-system-module": "<1.2.4", "wintercms/winter": "<=1.2.3", - "woocommerce/woocommerce": "<6.6", + "woocommerce/woocommerce": "<6.6|>=8.8,<8.8.5|>=8.9,<8.9.3", "wp-cli/wp-cli": ">=0.12,<2.5", "wp-graphql/wp-graphql": "<=1.14.5", "wp-premium/gravityforms": "<2.4.21", "wpanel/wpanel4-cms": "<=4.3.1", "wpcloud/wp-stateless": "<3.2", "wpglobus/wpglobus": "<=1.9.6", - "wwbn/avideo": "<=12.4", + "wwbn/avideo": "<14.3", "xataface/xataface": "<3", "xpressengine/xpressengine": "<3.0.15", "yab/quarx": "<2.4.5", @@ -2869,7 +2873,7 @@ "yidashi/yii2cmf": "<=2", "yii2mod/yii2-cms": "<1.9.2", "yiisoft/yii": "<1.1.29", - "yiisoft/yii2": "<2.0.38", + "yiisoft/yii2": "<2.0.50", "yiisoft/yii2-authclient": "<2.2.15", "yiisoft/yii2-bootstrap": "<2.0.4", "yiisoft/yii2-dev": "<2.0.43", @@ -2896,7 +2900,7 @@ "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", "zendframework/zend-mail": "<2.4.11|>=2.5,<2.7.2", "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1", - "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4", + "zendframework/zend-session": ">=2,<2.2.9|>=2.3,<2.3.4", "zendframework/zend-validator": ">=2.3,<2.3.6", "zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1", "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6", @@ -2954,7 +2958,7 @@ "type": "tidelift" } ], - "time": "2024-05-14T22:04:50+00:00" + "time": "2024-07-02T22:05:16+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -3686,16 +3690,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.2", + "version": "3.10.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", "shasum": "" }, "require": { @@ -3762,20 +3766,20 @@ "type": "open_collective" } ], - "time": "2024-04-23T20:25:34+00:00" + "time": "2024-05-22T21:24:41+00:00" }, { "name": "symfony/console", - "version": "v5.4.39", + "version": "v5.4.41", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f3e591c48688a0cfa1a3296205926c05e84b22b1" + "reference": "6473d441a913cb997123b59ff2dbe3d1cf9e11ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f3e591c48688a0cfa1a3296205926c05e84b22b1", - "reference": "f3e591c48688a0cfa1a3296205926c05e84b22b1", + "url": "https://api.github.com/repos/symfony/console/zipball/6473d441a913cb997123b59ff2dbe3d1cf9e11ba", + "reference": "6473d441a913cb997123b59ff2dbe3d1cf9e11ba", "shasum": "" }, "require": { @@ -3845,7 +3849,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.39" + "source": "https://github.com/symfony/console/tree/v5.4.41" }, "funding": [ { @@ -3861,7 +3865,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T08:26:06+00:00" + "time": "2024-06-28T07:48:55+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3932,16 +3936,16 @@ }, { "name": "symfony/finder", - "version": "v5.4.39", + "version": "v5.4.40", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "f6a96e4fcd468a25fede16ee665f50ced856bd0a" + "reference": "f51cff4687547641c7d8180d74932ab40b2205ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/f6a96e4fcd468a25fede16ee665f50ced856bd0a", - "reference": "f6a96e4fcd468a25fede16ee665f50ced856bd0a", + "url": "https://api.github.com/repos/symfony/finder/zipball/f51cff4687547641c7d8180d74932ab40b2205ce", + "reference": "f51cff4687547641c7d8180d74932ab40b2205ce", "shasum": "" }, "require": { @@ -3975,7 +3979,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.39" + "source": "https://github.com/symfony/finder/tree/v5.4.40" }, "funding": [ { @@ -3991,20 +3995,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T08:26:06+00:00" + "time": "2024-05-31T14:33:22+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "0424dff1c58f028c451efff2045f5d92410bd540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540", "shasum": "" }, "require": { @@ -4054,7 +4058,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" }, "funding": [ { @@ -4070,20 +4074,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", "shasum": "" }, "require": { @@ -4132,7 +4136,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" }, "funding": [ { @@ -4148,20 +4152,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", "shasum": "" }, "require": { @@ -4213,7 +4217,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" }, "funding": [ { @@ -4229,20 +4233,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", "shasum": "" }, "require": { @@ -4293,7 +4297,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" }, "funding": [ { @@ -4309,20 +4313,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" + "reference": "ec444d3f3f6505bb28d11afa41e75faadebc10a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", - "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/ec444d3f3f6505bb28d11afa41e75faadebc10a1", + "reference": "ec444d3f3f6505bb28d11afa41e75faadebc10a1", "shasum": "" }, "require": { @@ -4369,7 +4373,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.30.0" }, "funding": [ { @@ -4385,20 +4389,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", "shasum": "" }, "require": { @@ -4449,7 +4453,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" }, "funding": [ { @@ -4465,7 +4469,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/service-contracts", @@ -4552,16 +4556,16 @@ }, { "name": "symfony/string", - "version": "v6.4.7", + "version": "v6.4.9", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69" + "reference": "76792dbd99690a5ebef8050d9206c60c59e681d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ffeb9591c61f65a68d47f77d12b83fa530227a69", - "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69", + "url": "https://api.github.com/repos/symfony/string/zipball/76792dbd99690a5ebef8050d9206c60c59e681d7", + "reference": "76792dbd99690a5ebef8050d9206c60c59e681d7", "shasum": "" }, "require": { @@ -4618,7 +4622,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.7" + "source": "https://github.com/symfony/string/tree/v6.4.9" }, "funding": [ { @@ -4634,7 +4638,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-06-28T09:25:38+00:00" }, { "name": "szepeviktor/phpstan-wordpress", @@ -4962,16 +4966,16 @@ }, { "name": "wp-launchpad/framework-options", - "version": "v0.1.2", + "version": "v0.1.3", "source": { "type": "git", "url": "https://github.com/wp-launchpad/framework-options.git", - "reference": "0941149bc7ba628a1c4fdf380eeef69969ed5ced" + "reference": "2484621a54734c8f0e07fc78cde84fb74faae3fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-launchpad/framework-options/zipball/0941149bc7ba628a1c4fdf380eeef69969ed5ced", - "reference": "0941149bc7ba628a1c4fdf380eeef69969ed5ced", + "url": "https://api.github.com/repos/wp-launchpad/framework-options/zipball/2484621a54734c8f0e07fc78cde84fb74faae3fd", + "reference": "2484621a54734c8f0e07fc78cde84fb74faae3fd", "shasum": "" }, "require": { @@ -4980,6 +4984,7 @@ "wp-launchpad/options": "^0.1" }, "require-dev": { + "wp-launchpad/phpunit-wp-hooks": "^1.0", "wp-media/phpunit": "^3.0" }, "type": "library", @@ -4992,22 +4997,22 @@ "description": "Options library for the framework Launchpad", "support": { "issues": "https://github.com/wp-launchpad/framework-options/issues", - "source": "https://github.com/wp-launchpad/framework-options/tree/v0.1.2" + "source": "https://github.com/wp-launchpad/framework-options/tree/v0.1.3" }, - "time": "2024-05-09T13:30:49+00:00" + "time": "2024-07-03T09:48:16+00:00" }, { "name": "wp-launchpad/options", - "version": "v0.1.2", + "version": "v0.1.3", "source": { "type": "git", "url": "https://github.com/wp-launchpad/options.git", - "reference": "fd55e0a440e819a1bb77d9140491b1c5faf648f6" + "reference": "22a6c3c5c73feac79be61fa6cd6f7ca3e034623a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-launchpad/options/zipball/fd55e0a440e819a1bb77d9140491b1c5faf648f6", - "reference": "fd55e0a440e819a1bb77d9140491b1c5faf648f6", + "url": "https://api.github.com/repos/wp-launchpad/options/zipball/22a6c3c5c73feac79be61fa6cd6f7ca3e034623a", + "reference": "22a6c3c5c73feac79be61fa6cd6f7ca3e034623a", "shasum": "" }, "require": { @@ -5023,9 +5028,9 @@ "description": "Options library for Launchpad", "support": { "issues": "https://github.com/wp-launchpad/options/issues", - "source": "https://github.com/wp-launchpad/options/tree/v0.1.2" + "source": "https://github.com/wp-launchpad/options/tree/v0.1.3" }, - "time": "2024-05-09T13:05:37+00:00" + "time": "2024-05-21T18:28:15+00:00" }, { "name": "wp-media/phpunit", @@ -5220,5 +5225,5 @@ "platform-dev": { "php": "^7 || ^8" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } From 21ff72304192247c7f5e6800fb159f2e2e6215e0 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 17:09:53 +0200 Subject: [PATCH 13/40] Added back dependencies --- .github/workflows/deploy-tag.yml | 2 - .github/workflows/test_php8.yml | 2 +- .github/workflows/test_rocketcdn.yml | 2 +- .gitignore | 1 - composer.json | 2 +- composer.lock | 27 +- .../LaunchpadCore/Activation/Activation.php | 158 ++++++++++ .../Activation/ActivationInterface.php | 14 + .../ActivationServiceProviderInterface.php | 8 + .../HasActivatorServiceProviderInterface.php | 13 + .../Container/AbstractServiceProvider.php | 136 +++++++++ .../Container/HasInflectorInterface.php | 20 ++ .../InflectorServiceProviderTrait.php | 46 +++ .../IsOptimizableServiceProvider.php | 8 + .../LaunchpadCore/Container/PrefixAware.php | 23 ++ .../Container/PrefixAwareInterface.php | 13 + .../LaunchpadCore/Container/Registration.php | 95 ++++++ .../Container/ServiceProviderInterface.php | 44 +++ .../Deactivation/Deactivation.php | 158 ++++++++++ .../Deactivation/DeactivationInterface.php | 13 + .../DeactivationServiceProviderInterface.php | 8 + ...HasDeactivatorServiceProviderInterface.php | 13 + .../Dispatcher/DispatcherAwareInterface.php | 17 ++ .../Dispatcher/DispatcherAwareTrait.php | 26 ++ .../SubscriberSignaturesSanitizer.php | 55 ++++ .../ClassicSubscriberInterface.php | 24 ++ .../EventManagement/EventManager.php | 135 +++++++++ .../EventManagerAwareSubscriberInterface.php | 13 + .../OptimizedSubscriberInterface.php | 28 ++ .../EventManagement/SubscriberInterface.php | 8 + .../Wrapper/SubscriberWrapper.php | 71 +++++ .../Wrapper/WrappedSubscriber.php | 72 +++++ src/Dependencies/LaunchpadCore/Plugin.php | 267 +++++++++++++++++ src/Dependencies/LaunchpadCore/boot.php | 99 +++++++ .../LaunchpadDispatcher/Dispatcher.php | 102 +++++++ .../Interfaces/SanitizerInterface.php | 10 + .../Sanitizers/BoolSanitizer.php | 16 + .../Sanitizers/FloatSanitizer.php | 16 + .../Sanitizers/IntSanitizer.php | 15 + .../Sanitizers/StringSanitizer.php | 24 ++ .../LaunchpadDispatcher/Traits/IsDefault.php | 11 + .../Interfaces/OptionsAwareInterface.php | 16 + .../Interfaces/SettingsAwareInterface.php | 16 + .../Interfaces/TransientsAwareInterface.php | 16 + .../ServiceProvider.php | 77 +++++ .../Traits/OptionsAwareTrait.php | 26 ++ .../Traits/SettingsAwareTrait.php | 26 ++ .../Traits/TransientsAwareTrait.php | 26 ++ .../Interfaces/Actions/DeleteInterface.php | 15 + .../Interfaces/Actions/FetchInterface.php | 26 ++ .../Actions/FetchPrefixInterface.php | 15 + .../Interfaces/Actions/SetInterface.php | 17 ++ .../Interfaces/OptionsInterface.php | 14 + .../Interfaces/SettingsInterface.php | 26 ++ .../Interfaces/TransientsInterface.php | 25 ++ src/Dependencies/LaunchpadOptions/Options.php | 64 ++++ .../LaunchpadOptions/Settings.php | 142 +++++++++ .../Traits/PrefixedKeyTrait.php | 45 +++ .../LaunchpadOptions/Transients.php | 64 ++++ .../Argument/ArgumentResolverInterface.php | 28 ++ .../Argument/ArgumentResolverTrait.php | 120 ++++++++ .../League/Container/Argument/ClassName.php | 29 ++ .../Container/Argument/ClassNameInterface.php | 13 + .../Argument/ClassNameWithOptionalValue.php | 39 +++ .../League/Container/Argument/RawArgument.php | 29 ++ .../Argument/RawArgumentInterface.php | 13 + .../League/Container/Container.php | 248 ++++++++++++++++ .../Container/ContainerAwareInterface.php | 40 +++ .../League/Container/ContainerAwareTrait.php | 76 +++++ .../Container/Definition/Definition.php | 278 ++++++++++++++++++ .../Definition/DefinitionAggregate.php | 124 ++++++++ .../DefinitionAggregateInterface.php | 67 +++++ .../Definition/DefinitionInterface.php | 120 ++++++++ .../Exception/ContainerException.php | 10 + .../Container/Exception/NotFoundException.php | 10 + .../League/Container/Inflector/Inflector.php | 123 ++++++++ .../Inflector/InflectorAggregate.php | 58 ++++ .../Inflector/InflectorAggregateInterface.php | 27 ++ .../Inflector/InflectorInterface.php | 60 ++++ .../League/Container/ReflectionContainer.php | 131 +++++++++ .../AbstractServiceProvider.php | 46 +++ .../BootableServiceProviderInterface.php | 14 + .../ServiceProviderAggregate.php | 106 +++++++ .../ServiceProviderAggregateInterface.php | 36 +++ .../ServiceProviderInterface.php | 46 +++ .../Container/ContainerExceptionInterface.php | 12 + .../Psr/Container/ContainerInterface.php | 36 +++ .../Container/NotFoundExceptionInterface.php | 10 + 88 files changed, 4405 insertions(+), 15 deletions(-) create mode 100644 src/Dependencies/LaunchpadCore/Activation/Activation.php create mode 100644 src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Activation/ActivationServiceProviderInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Activation/HasActivatorServiceProviderInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Container/AbstractServiceProvider.php create mode 100644 src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php create mode 100644 src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php create mode 100644 src/Dependencies/LaunchpadCore/Container/PrefixAware.php create mode 100644 src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Container/Registration.php create mode 100644 src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Deactivation/Deactivation.php create mode 100644 src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Deactivation/DeactivationServiceProviderInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Deactivation/HasDeactivatorServiceProviderInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/DispatcherAwareInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/DispatcherAwareTrait.php create mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/EventManager.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/OptimizedSubscriberInterface.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/Wrapper/SubscriberWrapper.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php create mode 100644 src/Dependencies/LaunchpadCore/Plugin.php create mode 100644 src/Dependencies/LaunchpadCore/boot.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Dispatcher.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/BoolSanitizer.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/FloatSanitizer.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/IntSanitizer.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/StringSanitizer.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Traits/IsDefault.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/OptionsAwareInterface.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/SettingsAwareInterface.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/TransientsAwareInterface.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/ServiceProvider.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/FetchInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/FetchPrefixInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/SetInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/OptionsInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/SettingsInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Options.php create mode 100644 src/Dependencies/LaunchpadOptions/Settings.php create mode 100644 src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php create mode 100644 src/Dependencies/LaunchpadOptions/Transients.php create mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php create mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverTrait.php create mode 100644 src/Dependencies/League/Container/Argument/ClassName.php create mode 100644 src/Dependencies/League/Container/Argument/ClassNameInterface.php create mode 100644 src/Dependencies/League/Container/Argument/ClassNameWithOptionalValue.php create mode 100644 src/Dependencies/League/Container/Argument/RawArgument.php create mode 100644 src/Dependencies/League/Container/Argument/RawArgumentInterface.php create mode 100644 src/Dependencies/League/Container/Container.php create mode 100644 src/Dependencies/League/Container/ContainerAwareInterface.php create mode 100644 src/Dependencies/League/Container/ContainerAwareTrait.php create mode 100644 src/Dependencies/League/Container/Definition/Definition.php create mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregate.php create mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php create mode 100644 src/Dependencies/League/Container/Definition/DefinitionInterface.php create mode 100644 src/Dependencies/League/Container/Exception/ContainerException.php create mode 100644 src/Dependencies/League/Container/Exception/NotFoundException.php create mode 100644 src/Dependencies/League/Container/Inflector/Inflector.php create mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregate.php create mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php create mode 100644 src/Dependencies/League/Container/Inflector/InflectorInterface.php create mode 100644 src/Dependencies/League/Container/ReflectionContainer.php create mode 100644 src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php create mode 100644 src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php create mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregate.php create mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php create mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderInterface.php create mode 100644 src/Dependencies/Psr/Container/ContainerExceptionInterface.php create mode 100644 src/Dependencies/Psr/Container/ContainerInterface.php create mode 100644 src/Dependencies/Psr/Container/NotFoundExceptionInterface.php diff --git a/.github/workflows/deploy-tag.yml b/.github/workflows/deploy-tag.yml index 64fff3b..1ceeb23 100644 --- a/.github/workflows/deploy-tag.yml +++ b/.github/workflows/deploy-tag.yml @@ -9,8 +9,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - name: normal build - run: composer install - name: remove installers run: composer remove composer/installers - name: optimized build diff --git a/.github/workflows/test_php8.yml b/.github/workflows/test_php8.yml index a5cadb1..2a82dc9 100644 --- a/.github/workflows/test_php8.yml +++ b/.github/workflows/test_php8.yml @@ -61,7 +61,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --ignore-platform-reqs + run: composer install --prefer-dist --no-interaction --no-scripts --ignore-platform-reqs - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/.github/workflows/test_rocketcdn.yml b/.github/workflows/test_rocketcdn.yml index e51ab38..2523778 100644 --- a/.github/workflows/test_rocketcdn.yml +++ b/.github/workflows/test_rocketcdn.yml @@ -62,7 +62,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --ignore-platform-reqs + run: composer install --prefer-dist --no-interaction --no-scripts - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/.gitignore b/.gitignore index 8b92a69..0fd16bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ composer.phar /vendor/ -src/Dependencies # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file # composer.lock diff --git a/composer.json b/composer.json index fceff48..37d7c2a 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "require-dev": { "php": "^7 || ^8", "brain/monkey": "^2.0", - "coenjacobs/mozart": "^0.5.1", + "coenjacobs/mozart": "^0.7", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "league/container": "^3.3", "phpcompatibility/phpcompatibility-wp": "^2.0", diff --git a/composer.lock b/composer.lock index c680817..1470814 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "22246a4fde2b733124fb799855ae6182", + "content-hash": "05d14a7ac2d918dedecab2a7125d6243", "packages": [ { "name": "composer/installers", @@ -279,26 +279,29 @@ }, { "name": "coenjacobs/mozart", - "version": "0.5.1", + "version": "0.7.1", "source": { "type": "git", "url": "https://github.com/coenjacobs/mozart.git", - "reference": "4bdde231f3309d9299c87b2246166e87acc93653" + "reference": "dbcdeb992d20d9c8914eef090f9a0d684bb1102c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/coenjacobs/mozart/zipball/4bdde231f3309d9299c87b2246166e87acc93653", - "reference": "4bdde231f3309d9299c87b2246166e87acc93653", + "url": "https://api.github.com/repos/coenjacobs/mozart/zipball/dbcdeb992d20d9c8914eef090f9a0d684bb1102c", + "reference": "dbcdeb992d20d9c8914eef090f9a0d684bb1102c", "shasum": "" }, "require": { "league/flysystem": "^1.0", - "php": "^7.2", + "php": "^7.3|^8.0", "symfony/console": "^4|^5", "symfony/finder": "^4|^5" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "mheap/phpunit-github-actions-printer": "^1.4", + "phpunit/phpunit": "^8.5", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.4" }, "bin": [ "bin/mozart" @@ -322,9 +325,15 @@ "description": "Composes all dependencies as a package inside a WordPress plugin", "support": { "issues": "https://github.com/coenjacobs/mozart/issues", - "source": "https://github.com/coenjacobs/mozart/tree/0.5.1" + "source": "https://github.com/coenjacobs/mozart/tree/0.7.1" }, - "time": "2019-12-23T12:24:56+00:00" + "funding": [ + { + "url": "https://github.com/coenjacobs", + "type": "github" + } + ], + "time": "2021-02-02T21:37:03+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", diff --git a/src/Dependencies/LaunchpadCore/Activation/Activation.php b/src/Dependencies/LaunchpadCore/Activation/Activation.php new file mode 100644 index 0000000..47be36c --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Activation/Activation.php @@ -0,0 +1,158 @@ + $value ) { + self::$container->add( $key, $value ); + } + + $container->share( 'dispatcher', self::$dispatcher ); + + $container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ key_exists( 'prefix', self::$params ) ? self::$params['prefix'] : '' ] ); + $container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $container->get( 'dispatcher' ) ] ); + + $providers = array_filter( + self::$providers, + function ( $provider ) { + if ( is_string( $provider ) ) { + $provider = new $provider(); + } + + if ( ! $provider instanceof ActivationServiceProviderInterface && ( ! $provider instanceof HasInflectorInterface || count( $provider->get_inflectors() ) === 0 ) ) { + return false; + } + + return $provider; + } + ); + + /** + * Activation providers. + * + * @param AbstractServiceProvider[] $providers Providers. + * @return AbstractServiceProvider[] + */ + $providers = apply_filters( "{$container->get('prefix')}deactivate_providers", $providers ); + + $providers = array_map( + function ( $provider ) { + if ( is_string( $provider ) ) { + return new $provider(); + } + return $provider; + }, + $providers + ); + + foreach ( $providers as $provider ) { + self::$container->addServiceProvider( $provider ); + } + + foreach ( $providers as $service_provider ) { + if ( ! $service_provider instanceof HasInflectorInterface ) { + continue; + } + $service_provider->register_inflectors(); + } + + foreach ( $providers as $provider ) { + if ( ! $provider instanceof HasActivatorServiceProviderInterface ) { + continue; + } + + foreach ( $provider->get_activators() as $activator ) { + $activator_instance = self::$container->get( $activator ); + if ( ! $activator_instance instanceof ActivationInterface ) { + continue; + } + $activator_instance->activate(); + } + } + } +} diff --git a/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php b/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php new file mode 100644 index 0000000..784145d --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php @@ -0,0 +1,14 @@ +provides; + } + + /** + * Returns a boolean if checking whether this provider provides a specific + * service or returns an array of provided services if no argument passed. + * + * @param string $alias Class searched. + * + * @return boolean + */ + public function provides( string $alias ): bool { + if ( ! $this->loaded ) { + $this->loaded = true; + $this->define(); + } + + return parent::provides( $alias ); + } + + /** + * Return IDs from front subscribers. + * + * @return string[] + */ + public function get_front_subscribers(): array { + return []; + } + + /** + * Return IDs from admin subscribers. + * + * @return string[] + */ + public function get_admin_subscribers(): array { + return []; + } + + /** + * Return IDs from common subscribers. + * + * @return string[] + */ + public function get_common_subscribers(): array { + return []; + } + + /** + * Return IDs from init subscribers. + * + * @return string[] + */ + public function get_init_subscribers(): array { + return []; + } + + /** + * Register service into the provider. + * + * @param string $classname Class to register. + * @param callable|null $method Method called when registering. + * @param string $concrete Concrete class when necessary. + * @return Registration + */ + public function register_service( string $classname, callable $method = null, string $concrete = '' ): Registration { + + $registration = new Registration( $classname ); + + if( $method ) { + $registration->set_definition( $method ); + } + + + + if ( $concrete ) { + $registration->set_concrete( $concrete ); + } + + $this->services_to_load[] = $registration; + + if ( ! in_array( $classname, $this->provides, true ) ) { + $this->provides[] = $classname; + } + + return $registration; + } + + /** + * Define classes. + * + * @return mixed + */ + abstract protected function define(); + + /** + * Register classes provided by the service provider. + * + * @return void + */ + public function register() { + foreach ( $this->services_to_load as $registration ) { + $registration->register( $this->getLeagueContainer() ); + } + } +} diff --git a/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php b/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php new file mode 100644 index 0000000..90d2269 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php @@ -0,0 +1,20 @@ + + */ + public function get_inflectors(): array; + + /** + * Register inflectors. + * + * @return void + */ + public function register_inflectors(): void; +} diff --git a/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php b/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php new file mode 100644 index 0000000..2e20159 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php @@ -0,0 +1,46 @@ + + */ + public function get_inflectors(): array { + return []; + } + + /** + * Register inflectors. + * + * @return void + */ + public function register_inflectors(): void { + foreach ( $this->get_inflectors() as $class => $data ) { + if ( ! is_array( $data ) || ! key_exists( 'method', $data ) ) { + continue; + } + $method = $data['method']; + + if ( ! key_exists( 'args', $data ) || ! is_array( $data['args'] ) ) { + $this->getLeagueContainer()->inflector( $class )->invokeMethod( $method, [] ); + continue; + } + + $this->getLeagueContainer()->inflector( $class )->invokeMethod( $method, $data['args'] ); + } + } + + /** + * Get the container. + * + * @return Container + */ + abstract public function getLeagueContainer(): Container; // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid +} diff --git a/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php b/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php new file mode 100644 index 0000000..0fae980 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php @@ -0,0 +1,8 @@ +prefix = $prefix; + } +} diff --git a/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php b/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php new file mode 100644 index 0000000..78c6d4c --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php @@ -0,0 +1,13 @@ +id = $id; + $this->value = $id; + } + + /** + * Define a callback definition for the class. + * + * @param callable $definition Callback definition for the class. + * @return $this + */ + public function set_definition( callable $definition ): Registration { + $this->definition = $definition; + return $this; + } + + /** + * Set a concrete class. + * + * @param mixed $concrete Concrete class. + * @return $this + */ + public function set_concrete( $concrete ): Registration { + $this->value = $concrete; + return $this; + } + + /** + * Make a definition shared. + * + * @return $this + */ + public function share(): Registration { + $this->shared = true; + return $this; + } + + /** + * Register a definition on a container. + * + * @param Container $container Container to register on. + * @return void + */ + public function register( Container $container ) { + $class_registration = $container->add( $this->id, $this->value, $this->shared ); + + if ( ! $this->definition ) { + return; + } + + ( $this->definition )( $class_registration ); + } +} diff --git a/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php b/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php new file mode 100644 index 0000000..a5c1eee --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php @@ -0,0 +1,44 @@ + $value ) { + $container->add( $key, $value ); + } + + $container->share( 'dispatcher', self::$dispatcher ); + + $container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ key_exists( 'prefix', self::$params ) ? self::$params['prefix'] : '' ] ); + $container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $container->get( 'dispatcher' ) ] ); + + $providers = array_filter( + self::$providers, + function ( $provider ) { + if ( is_string( $provider ) ) { + $provider = new $provider(); + } + + if ( ! $provider instanceof DeactivationServiceProviderInterface && ( ! $provider instanceof HasInflectorInterface || count( $provider->get_inflectors() ) === 0 ) ) { + return false; + } + + return $provider; + } + ); + + $providers = array_map( + function ( $provider ) { + if ( is_string( $provider ) ) { + return new $provider(); + } + return $provider; + }, + $providers + ); + + foreach ( $providers as $provider ) { + $container->addServiceProvider( $provider ); + } + + foreach ( $providers as $service_provider ) { + if ( ! $service_provider instanceof HasInflectorInterface ) { + continue; + } + $service_provider->register_inflectors(); + } + + /** + * Deactivation providers. + * + * @param AbstractServiceProvider[] $providers Providers. + * @return AbstractServiceProvider[] + */ + $providers = apply_filters( "{$container->get('prefix')}deactivate_providers", $providers ); + + foreach ( $providers as $provider ) { + if ( ! $provider instanceof HasDeactivatorServiceProviderInterface ) { + continue; + } + + foreach ( $provider->get_deactivators() as $deactivator ) { + $deactivator_instance = self::$container->get( $deactivator ); + if ( ! $deactivator_instance instanceof DeactivationInterface ) { + continue; + } + $deactivator_instance->deactivate(); + } + } + } +} diff --git a/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php b/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php new file mode 100644 index 0000000..27cbb47 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php @@ -0,0 +1,13 @@ +dispatcher = $dispatcher; + } +} diff --git a/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php b/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php new file mode 100644 index 0000000..0cc03fa --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php @@ -0,0 +1,55 @@ +is_default = false; + + if ( ! is_array( $value ) ) { + $this->is_default = true; + return false; + } + + $output = []; + + foreach ( $value as $subscriber ) { + if ( ! is_string( $subscriber ) && ! is_object( $subscriber ) ) { + continue; + } + + $output [] = $subscriber; + } + + return $output; + } + + /** + * Should return default value. + * + * @param mixed $value Current value. + * @param mixed $original Original value. + * + * @return bool + */ + public function is_default( $value, $original ): bool { + return $this->is_default; + } +} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php new file mode 100644 index 0000000..c40d558 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php @@ -0,0 +1,24 @@ + 'method_name') + * * array('hook_name' => array('method_name', $priority)) + * * array('hook_name' => array('method_name', $priority, $accepted_args)) + * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) + * + * @return array + */ + public function get_subscribed_events(); +} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php b/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php new file mode 100644 index 0000000..f95a001 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php @@ -0,0 +1,135 @@ + + */ +class EventManager { + /** + * Adds a callback to a specific hook of the WordPress plugin API. + * + * @uses add_filter() + * + * @param string $hook_name Name of the hook. + * @param callable $callback Callback function. + * @param int $priority Priority. + * @param int $accepted_args Number of arguments. + */ + public function add_callback( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) { + add_filter( $hook_name, $callback, $priority, $accepted_args ); + } + + /** + * Add an event subscriber. + * + * The event manager registers all the hooks that the given subscriber + * wants to register with the WordPress Plugin API. + * + * @param ClassicSubscriberInterface $subscriber Subscriber_Interface implementation. + */ + public function add_subscriber( ClassicSubscriberInterface $subscriber ) { + if ( $subscriber instanceof EventManagerAwareSubscriberInterface ) { + $subscriber->set_event_manager( $this ); + } + + $events = $subscriber->get_subscribed_events(); + + if ( empty( $events ) ) { + return; + } + + foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { + $this->add_subscriber_callback( $subscriber, $hook_name, $parameters ); + } + } + + /** + * Checks the WordPress plugin API to see if the given hook has + * the given callback. The priority of the callback will be returned + * or false. If no callback is given will return true or false if + * there's any callbacks registered to the hook. + * + * @uses has_filter() + * + * @param string $hook_name Hook name. + * @param mixed $callback Callback. + * + * @return bool|int + */ + public function has_callback( $hook_name, $callback = false ) { + return has_filter( $hook_name, $callback ); + } + + /** + * Removes the given callback from the given hook. The WordPress plugin API only + * removes the hook if the callback and priority match a registered hook. + * + * @uses remove_filter() + * + * @param string $hook_name Hook name. + * @param callable $callback Callback. + * @param int $priority Priority. + * + * @return bool + */ + public function remove_callback( $hook_name, $callback, $priority = 10 ) { + return remove_filter( $hook_name, $callback, $priority ); + } + + /** + * Remove an event subscriber. + * + * The event manager removes all the hooks that the given subscriber + * wants to register with the WordPress Plugin API. + * + * @param SubscriberInterface $subscriber Subscriber_Interface implementation. + */ + public function remove_subscriber( SubscriberInterface $subscriber ) { + foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { + $this->remove_subscriber_callback( $subscriber, $hook_name, $parameters ); + } + } + + /** + * Adds the given subscriber's callback to a specific hook + * of the WordPress plugin API. + * + * @param SubscriberInterface $subscriber Subscriber_Interface implementation. + * @param string $hook_name Hook name. + * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. + */ + private function add_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { + if ( is_string( $parameters ) ) { + $this->add_callback( $hook_name, [ $subscriber, $parameters ] ); + } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { + foreach ( $parameters as $parameter ) { + $this->add_subscriber_callback( $subscriber, $hook_name, $parameter ); + } + } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { + $this->add_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10, isset( $parameters[2] ) ? $parameters[2] : 1 ); + } + } + + /** + * Removes the given subscriber's callback to a specific hook + * of the WordPress plugin API. + * + * @param SubscriberInterface $subscriber Subscriber_Interface implementation. + * @param string $hook_name Hook name. + * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. + */ + private function remove_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { + if ( is_string( $parameters ) ) { + $this->remove_callback( $hook_name, [ $subscriber, $parameters ] ); + } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { + foreach ( $parameters as $parameter ) { + $this->remove_subscriber_callback( $subscriber, $hook_name, $parameter ); + } + } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { + $this->remove_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10 ); + } + } +} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php new file mode 100644 index 0000000..1a6af03 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php @@ -0,0 +1,13 @@ + 'method_name') + * * array('hook_name' => array('method_name', $priority)) + * * array('hook_name' => array('method_name', $priority, $accepted_args)) + * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) + * + * @return array + */ + public static function get_subscribed_events(); +} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php new file mode 100644 index 0000000..9263f3c --- /dev/null +++ b/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php @@ -0,0 +1,8 @@ +prefix = $prefix; + } + + /** + * Wrap a subscriber will the common interface for subscribers. + * + * @param object $instance Any class subscriber. + * + * @return SubscriberInterface + * @throws ReflectionException Error is the class name is not valid. + */ + public function wrap( $instance ): SubscriberInterface { + if ( $instance instanceof OptimizedSubscriberInterface ) { + return new WrappedSubscriber( $instance, $instance->get_subscribed_events() ); + } + + $methods = get_class_methods( $instance ); + $reflection_class = new ReflectionClass( get_class( $instance ) ); + $events = []; + foreach ( $methods as $method ) { + $method_reflection = $reflection_class->getMethod( $method ); + $doc_comment = $method_reflection->getDocComment(); + if ( ! $doc_comment ) { + continue; + } + $pattern = '#@hook\s(?[a-zA-Z\\\-_$/]+)(\s(?[0-9]+))?#'; + + preg_match_all( $pattern, $doc_comment, $matches, PREG_PATTERN_ORDER ); + if ( ! $matches ) { + continue; + } + + foreach ( $matches[0] as $index => $match ) { + $hook = str_replace( '$prefix', $this->prefix, $matches['name'][ $index ] ); + + $events[ $hook ][] = [ + $method, + key_exists( 'priority', $matches ) && key_exists( $index, $matches['priority'] ) && '' !== $matches['priority'][ $index ] ? (int) $matches['priority'][ $index ] : 10, + $method_reflection->getNumberOfParameters(), + ]; + } + } + + return new WrappedSubscriber( $instance, $events ); + } +} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php b/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php new file mode 100644 index 0000000..cb953e4 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php @@ -0,0 +1,72 @@ +instance = $instance; + $this->events = $events; + } + + /** + * Returns an array of events that this subscriber wants to listen to. + * + * The array key is the event name. The value can be: + * + * * The method name + * * An array with the method name and priority + * * An array with the method name, priority and number of accepted arguments + * + * For instance: + * + * * array('hook_name' => 'method_name') + * * array('hook_name' => array('method_name', $priority)) + * * array('hook_name' => array('method_name', $priority, $accepted_args)) + * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) + * + * @return array + */ + public function get_subscribed_events(): array { + return $this->events; + } + + /** + * Delegate callbacks to the actual subscriber. + * + * @param string $name Name from the method. + * @param array $arguments Parameters from the method. + * + * @return mixed + */ + public function __call( $name, $arguments ) { + + if ( method_exists( $this, $name ) ) { + return $this->{$name}( ...$arguments ); + } + + return $this->instance->{$name}( ...$arguments ); + } +} diff --git a/src/Dependencies/LaunchpadCore/Plugin.php b/src/Dependencies/LaunchpadCore/Plugin.php new file mode 100644 index 0000000..94d5a6e --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Plugin.php @@ -0,0 +1,267 @@ +container = $container; + $this->event_manager = $event_manager; + $this->subscriber_wrapper = $subscriber_wrapper; + $this->dispatcher = $dispatcher; + } + + /** + * Returns the Rocket container instance. + * + * @return ContainerInterface + */ + public function get_container() { + return $this->container; + } + + /** + * Loads the plugin into WordPress. + * + * @param array $params Parameters to pass to the container. + * @param array $providers List of providers from the plugin. + * + * @return void + * + * @throws ContainerExceptionInterface Error from the container. + * @throws NotFoundExceptionInterface Error when a class is not found on the container. + * @throws ReflectionException Error when a classname is invalid. + */ + public function load( array $params, array $providers = [] ) { + + foreach ( $params as $key => $value ) { + $this->container->share( $key, $value ); + } + + /** + * Runs before the plugin is loaded. + */ + $this->dispatcher->do_action( "{$this->container->get('prefix')}before_load" ); + + add_filter( "{$this->container->get('prefix')}container", [ $this, 'get_container' ] ); + + $this->container->share( 'event_manager', $this->event_manager ); + $this->container->share( 'dispatcher', $this->dispatcher ); + + $this->container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ $this->container->get( 'prefix' ) ] ); + $this->container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $this->container->get( 'dispatcher' ) ] ); + + $providers = array_map( + function ( $classname ) { + if ( is_string( $classname ) ) { + return new $classname(); + } + + return $classname; + }, + $providers + ); + + $providers = $this->optimize_service_providers( $providers ); + + foreach ( $providers as $service_provider ) { + $this->container->addServiceProvider( $service_provider ); + } + + foreach ( $providers as $service_provider ) { + if ( ! $service_provider instanceof HasInflectorInterface ) { + continue; + } + $service_provider->register_inflectors(); + } + + foreach ( $providers as $service_provider ) { + $this->load_init_subscribers( $service_provider ); + } + + foreach ( $providers as $service_provider ) { + $this->load_subscribers( $service_provider ); + } + + /** + * Runs after the plugin is loaded. + */ + $this->dispatcher->do_action( "{$this->container->get('prefix')}after_load" ); + } + + /** + * Optimize service providers to keep only the ones we need to load. + * + * @param ServiceProviderInterface[] $providers Providers given to the plugin. + * + * @return ServiceProviderInterface[] + * + * @throws ContainerExceptionInterface Error from the container. + * @throws NotFoundExceptionInterface Error when a class is not found on the container. + */ + protected function optimize_service_providers( array $providers ): array { + $optimized_providers = []; + + foreach ( $providers as $provider ) { + if ( ! $provider instanceof IsOptimizableServiceProvider ) { + $optimized_providers[] = $provider; + continue; + } + $subscribers = array_merge( $provider->get_common_subscribers(), $provider->get_init_subscribers(), is_admin() ? $provider->get_admin_subscribers() : $provider->get_front_subscribers() ); + + /** + * Plugin Subscribers from a provider. + * + * @param SubscriberInterface[] $subscribers Subscribers. + * @param AbstractServiceProvider $provider Provider. + * + * @return SubscriberInterface[] + */ + $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_provider_subscribers", new SubscriberSignaturesSanitizer(), $subscribers, $provider ); + + if ( count( $subscribers ) === 0 ) { + continue; + } + + $optimized_providers[] = $provider; + } + + return $optimized_providers; + } + + /** + * Load list of event subscribers from service provider. + * + * @param ServiceProviderInterface $service_provider_instance Instance of service provider. + * + * @return void + * + * @throws ContainerExceptionInterface Error from the container. + * @throws NotFoundExceptionInterface Error when a class is not found on the container. + * @throws ReflectionException Error when a classname is invalid. + */ + private function load_init_subscribers( ServiceProviderInterface $service_provider_instance ) { + $subscribers = $service_provider_instance->get_init_subscribers(); + + /** + * Plugin Init Subscribers. + * + * @param SubscriberInterface[] $subscribers Subscribers. + * + * @return SubscriberInterface[] + */ + $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_init_subscribers", new SubscriberSignaturesSanitizer(), $subscribers ); + + if ( empty( $subscribers ) ) { + return; + } + + foreach ( $subscribers as $subscriber ) { + $subscriber_object = $this->container->get( $subscriber ); + if ( ! $subscriber_object instanceof ClassicSubscriberInterface ) { + $subscriber_object = $this->subscriber_wrapper->wrap( $subscriber_object ); + } + + $this->event_manager->add_subscriber( $subscriber_object ); + } + } + + /** + * Load list of event subscribers from service provider. + * + * @param ServiceProviderInterface $service_provider_instance Instance of service provider. + * + * @return void + * + * @throws ContainerExceptionInterface Error from the container. + * @throws NotFoundExceptionInterface Error when a class is not found on the container. + * @throws ReflectionException Error when a classname is invalid. + */ + private function load_subscribers( ServiceProviderInterface $service_provider_instance ) { + + $subscribers = $service_provider_instance->get_common_subscribers(); + + if ( ! is_admin() ) { + $subscribers = array_merge( $subscribers, $service_provider_instance->get_front_subscribers() ); + } else { + $subscribers = array_merge( $subscribers, $service_provider_instance->get_admin_subscribers() ); + } + + /** + * Plugin Subscribers. + * + * @param SubscriberInterface[] $subscribers Subscribers. + * @param AbstractServiceProvider $service_provider_instance Provider. + * + * @return SubscriberInterface[] + */ + $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_subscribers", new SubscriberSignaturesSanitizer(), $subscribers, $service_provider_instance ); + + if ( empty( $subscribers ) ) { + return; + } + + foreach ( $subscribers as $subscriber ) { + $subscriber_object = $this->container->get( $subscriber ); + if ( ! $subscriber_object instanceof ClassicSubscriberInterface ) { + $subscriber_object = $this->subscriber_wrapper->wrap( $subscriber_object ); + } + + $this->event_manager->add_subscriber( $subscriber_object ); + } + } +} diff --git a/src/Dependencies/LaunchpadCore/boot.php b/src/Dependencies/LaunchpadCore/boot.php new file mode 100644 index 0000000..d17f37a --- /dev/null +++ b/src/Dependencies/LaunchpadCore/boot.php @@ -0,0 +1,99 @@ +load( $params, $providers ); + } + ); + + Deactivation::set_container( new Container() ); + Deactivation::set_dispatcher( new Dispatcher() ); + Deactivation::set_params( $params ); + Deactivation::set_providers( $providers ); + + register_deactivation_hook( $plugin_launcher_file, [ Deactivation::class, 'deactivate_plugin' ] ); + + Activation::set_container( new Container() ); + Activation::set_dispatcher( new Dispatcher() ); + Activation::set_params( $params ); + Activation::set_providers( $providers ); + + register_activation_hook( $plugin_launcher_file, [ Activation::class, 'activate_plugin' ] ); +} diff --git a/src/Dependencies/LaunchpadDispatcher/Dispatcher.php b/src/Dependencies/LaunchpadDispatcher/Dispatcher.php new file mode 100644 index 0000000..d155f3f --- /dev/null +++ b/src/Dependencies/LaunchpadDispatcher/Dispatcher.php @@ -0,0 +1,102 @@ +call_deprecated_actions($name, ...$parameters); + do_action($name, ...$parameters); + } + + public function apply_filters(string $name, SanitizerInterface $sanitizer, $default, ...$parameters) + { + $result_deprecated = $this->call_deprecated_filters($name, $default, ...$parameters); + + $result = apply_filters($name, $result_deprecated, ...$parameters); + + $sanitized_result = $sanitizer->sanitize($result); + + if( false === $sanitized_result && $sanitizer->is_default($sanitized_result, $result) ) { + return $default; + } + + return $sanitized_result; + } + + public function apply_string_filters(string $name, string $default, ...$parameters): string + { + return $this->apply_filters($name, new StringSanitizer(), $default, ...$parameters); + } + + public function apply_bool_filters(string $name, bool $default, ...$parameters): bool + { + return $this->apply_filters($name, new BoolSanitizer(), $default, ...$parameters); + } + + public function apply_int_filters(string $name, int $default, ...$parameters): int + { + return $this->apply_filters($name, new IntSanitizer(), $default, ...$parameters); + } + + public function apply_float_filters(string $name, float $default, ...$parameters): float + { + return $this->apply_filters($name, new FloatSanitizer(), $default, ...$parameters); + } + + public function add_deprecated_action(string $name, string $deprecated_name, string $version, string $message = '') + { + $this->deprecated_actions[$name][] = [ + 'name' => $deprecated_name, + 'version' => $version, + 'message' => $message + ]; + } + + public function add_deprecated_filter(string $name, string $deprecated_name, string $version, string $message = '') + { + $this->deprecated_filters[$name][] = [ + 'name' => $deprecated_name, + 'version' => $version, + 'message' => $message + ]; + } + + protected function call_deprecated_actions(string $name, ...$parameters) + { + if( ! key_exists($name, $this->deprecated_actions)) { + return; + } + + foreach ($this->deprecated_actions[$name] as $action) { + do_action_deprecated($action['name'], $parameters, $action['version'], $name, $action['message']); + $this->call_deprecated_actions($action['name'], ...$parameters); + } + } + + protected function call_deprecated_filters(string $name, $default, ...$parameters) + { + if( ! key_exists($name, $this->deprecated_filters)) { + return $default; + } + + foreach ($this->deprecated_filters[$name] as $filter) { + $filter_parameters = array_merge([$default], $parameters); + $default = apply_filters_deprecated($filter['name'], $filter_parameters, $filter['version'], $name, $filter['message']); + $default = $this->call_deprecated_filters($filter['name'], $default, ...$parameters); + } + + return $default; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php b/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php new file mode 100644 index 0000000..b784264 --- /dev/null +++ b/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php @@ -0,0 +1,10 @@ +register_service(OptionsInterface::class) + ->share() + ->set_concrete(Options::class) + ->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument('prefix'); + }); + + $this->register_service(TransientsInterface::class) + ->share() + ->set_concrete(Transients::class) + ->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument('prefix'); + }); + + $this->register_service(SettingsInterface::class) + ->share() + ->set_concrete(Settings::class) + ->set_definition(function (DefinitionInterface $definition) { + $prefix = $this->container->get('prefix'); + $definition->addArguments([OptionsInterface::class, "{$prefix}settings"]); + }); + } + + /** + * Returns inflectors. + * + * @return array[] + */ + public function get_inflectors(): array + { + return [ + OptionsAwareInterface::class => [ + 'method' => 'set_options', + 'args' => [ + OptionsInterface::class, + ], + ], + TransientsAwareInterface::class => [ + 'method' => 'set_transients', + 'args' => [ + TransientsInterface::class, + ], + ], + SettingsAwareInterface::class => [ + 'method' => 'set_settings', + 'args' => [ + SettingsInterface::class, + ], + ], + ]; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php new file mode 100644 index 0000000..2ac1d50 --- /dev/null +++ b/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php @@ -0,0 +1,26 @@ +options = $options; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php new file mode 100644 index 0000000..33e407e --- /dev/null +++ b/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php @@ -0,0 +1,26 @@ +settings = $settings; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php new file mode 100644 index 0000000..0f10433 --- /dev/null +++ b/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php @@ -0,0 +1,26 @@ +transients = $transients; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php b/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php new file mode 100644 index 0000000..714f360 --- /dev/null +++ b/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php @@ -0,0 +1,15 @@ + $values Values to import. + * + * @return void + */ + public function import(array $values); + + /** + * Export settings values. + * + * @return array + */ + public function dumps(): array; +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php b/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php new file mode 100644 index 0000000..756dc2f --- /dev/null +++ b/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php @@ -0,0 +1,25 @@ +prefix = $prefix; + } + + /** + * Gets the option for the given name. Returns the default value if the value does not exist. + * + * @param string $name Name of the option to get. + * @param mixed $default Default value to return if the value does not exist. + * + * @return mixed + */ + public function get( string $name, $default = null ) { + $option = get_option( $this->get_full_key( $name ), $default ); + + if ( is_array( $default ) && ! is_array( $option ) ) { + $option = (array) $option; + } + + return $option; + } + + /** + * Sets the value of an option. Update the value if the option for the given name already exists. + * + * @param string $name Name of the option to set. + * @param mixed $value Value to set for the option. + * + * @return void + */ + public function set( string $name, $value ) { + update_option( $this->get_full_key( $name ), $value ); + } + + /** + * Deletes the option with the given name. + * + * @param string $name Name of the option to delete. + * + * @return void + */ + public function delete( string $name ) { + delete_option( $this->get_full_key( $name ) ); + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Settings.php b/src/Dependencies/LaunchpadOptions/Settings.php new file mode 100644 index 0000000..b3eb57a --- /dev/null +++ b/src/Dependencies/LaunchpadOptions/Settings.php @@ -0,0 +1,142 @@ +options = $options; + $this->settings_key = $settings_key; + $this->settings = (array) $this->options->get($settings_key, []); + } + + /** + * @inheritDoc + */ + public function get(string $name, $default = null) + { + /** + * Pre-filter any setting before read + * + * @param mixed $default The default value. + */ + $value = apply_filters( "pre_get_{$this->settings_key}_" . $name, null, $default ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound + + if ( null !== $value ) { + return $value; + } + + if( ! $this->has($name)) { + return $default; + } + + /** + * Filter any setting after read + * + * @param mixed $default The default value. + */ + return apply_filters( "get_{$this->settings_key}" . $name, $this->settings[$name], $default ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound + } + + /** + * @inheritDoc + */ + public function set(string $name, $value) + { + $this->settings[$name] = $value; + + $this->persist(); + } + + /** + * @inheritDoc + */ + public function delete(string $name) + { + unset($this->settings[$name]); + + $this->persist(); + } + + /** + * @inheritDoc + */ + public function has(string $name): bool + { + return key_exists($name, $this->settings); + } + + /** + * Persist the settings into the database. + * @return void + */ + protected function persist() + { + do_action("pre_persist_{$this->settings_key}", $this->settings); + + $this->options->set($this->settings_key, $this->settings); + + do_action("persist_{$this->settings_key}", $this->settings); + } + + /** + * Import multiple values at once. + * + * @param array $values Values to import. + * + * @return void + */ + public function import(array $values) + { + foreach ($values as $name => $value) { + $this->settings[$name] = $value; + } + + $this->persist(); + } + + /** + * Export settings values. + * + * @return array + */ + public function dumps(): array + { + $output = []; + + foreach ($this->settings as $name => $value) { + $output[$name] = $this->get($name); + } + + return $output; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php b/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php new file mode 100644 index 0000000..89b6133 --- /dev/null +++ b/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php @@ -0,0 +1,45 @@ +prefix . $name; + } + + /** + * Checks if the option with the given name exists. + * + * @param string $name Name of the option to check. + * + * @return bool + */ + public function has( string $name ): bool { + return null !== $this->get( $name ); + } + + /** + * Gets the option for the given name. Returns the default value if the value does not exist. + * + * @param string $name Name of the option to get. + * @param mixed $default Default value to return if the value does not exist. + * + * @return mixed + */ + abstract public function get( string $name, $default = null ); +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Transients.php b/src/Dependencies/LaunchpadOptions/Transients.php new file mode 100644 index 0000000..1baf132 --- /dev/null +++ b/src/Dependencies/LaunchpadOptions/Transients.php @@ -0,0 +1,64 @@ +prefix = $prefix; + } + + /** + * Gets the transient for the given name. Returns the default value if the value does not exist. + * + * @param string $name Name of the transient to get. + * @param mixed $default Default value to return if the value does not exist. + * + * @return mixed + */ + public function get(string $name, $default = null) + { + $transient = get_transient( $this->get_full_key( $name ), $default ); + + if ( is_array( $default ) && ! is_array( $transient ) ) { + $option = (array) $transient; + } + + return $transient; + } + + /** + * Sets the value of an transient. Update the value if the transient for the given name already exists. + * + * @param string $name Name of the transient to set. + * @param mixed $value Value to set for the transient. + * @param int $expiration Time until expiration in seconds. Default 0 (no expiration). + * + * @return void + */ + public function set(string $name, $value, int $expiration = 0) + { + set_transient( $this->get_full_key( $name ), $value, $expiration ); + } + + /** + * Deletes the transient with the given name. + * + * @param string $name Name of the transient to delete. + * + * @return void + */ + public function delete(string $name) + { + delete_transient( $this->get_full_key( $name ) ); + } +} \ No newline at end of file diff --git a/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php b/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php new file mode 100644 index 0000000..d6cabf4 --- /dev/null +++ b/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php @@ -0,0 +1,28 @@ +getValue(); + } elseif ($argument instanceof ClassNameInterface) { + $id = $argument->getClassName(); + } elseif (!is_string($argument)) { + return $argument; + } else { + $justStringValue = true; + $id = $argument; + } + + $container = null; + + try { + $container = $this->getLeagueContainer(); + } catch (ContainerException $e) { + if ($this instanceof ReflectionContainer) { + $container = $this; + } + } + + if ($container !== null) { + try { + return $container->get($id); + } catch (NotFoundException $exception) { + if ($argument instanceof ClassNameWithOptionalValue) { + return $argument->getOptionalValue(); + } + + if ($justStringValue) { + return $id; + } + + throw $exception; + } + } + + if ($argument instanceof ClassNameWithOptionalValue) { + return $argument->getOptionalValue(); + } + + // Just a string value. + return $id; + }, $arguments); + } + + /** + * {@inheritdoc} + */ + public function reflectArguments(ReflectionFunctionAbstract $method, array $args = []) : array + { + $arguments = array_map(function (ReflectionParameter $param) use ($method, $args) { + $name = $param->getName(); + $type = $param->getType(); + + if (array_key_exists($name, $args)) { + return new RawArgument($args[$name]); + } + + if ($type) { + if (PHP_VERSION_ID >= 70100) { + $typeName = $type->getName(); + } else { + $typeName = (string) $type; + } + + $typeName = ltrim($typeName, '?'); + + if ($param->isDefaultValueAvailable()) { + return new ClassNameWithOptionalValue($typeName, $param->getDefaultValue()); + } + + return new ClassName($typeName); + } + + if ($param->isDefaultValueAvailable()) { + return new RawArgument($param->getDefaultValue()); + } + + throw new NotFoundException(sprintf( + 'Unable to resolve a value for parameter (%s) in the function/method (%s)', + $name, + $method->getName() + )); + }, $method->getParameters()); + + return $this->resolveArguments($arguments); + } + + /** + * @return ContainerInterface + */ + abstract public function getContainer() : ContainerInterface; + + /** + * @return Container + */ + abstract public function getLeagueContainer() : Container; +} diff --git a/src/Dependencies/League/Container/Argument/ClassName.php b/src/Dependencies/League/Container/Argument/ClassName.php new file mode 100644 index 0000000..e283336 --- /dev/null +++ b/src/Dependencies/League/Container/Argument/ClassName.php @@ -0,0 +1,29 @@ +value = $value; + } + + /** + * {@inheritdoc} + */ + public function getClassName() : string + { + return $this->value; + } +} diff --git a/src/Dependencies/League/Container/Argument/ClassNameInterface.php b/src/Dependencies/League/Container/Argument/ClassNameInterface.php new file mode 100644 index 0000000..2e26f78 --- /dev/null +++ b/src/Dependencies/League/Container/Argument/ClassNameInterface.php @@ -0,0 +1,13 @@ +className = $className; + $this->optionalValue = $optionalValue; + } + + /** + * @inheritDoc + */ + public function getClassName(): string + { + return $this->className; + } + + public function getOptionalValue() + { + return $this->optionalValue; + } +} diff --git a/src/Dependencies/League/Container/Argument/RawArgument.php b/src/Dependencies/League/Container/Argument/RawArgument.php new file mode 100644 index 0000000..6c4a584 --- /dev/null +++ b/src/Dependencies/League/Container/Argument/RawArgument.php @@ -0,0 +1,29 @@ +value = $value; + } + + /** + * {@inheritdoc} + */ + public function getValue() + { + return $this->value; + } +} diff --git a/src/Dependencies/League/Container/Argument/RawArgumentInterface.php b/src/Dependencies/League/Container/Argument/RawArgumentInterface.php new file mode 100644 index 0000000..d81c312 --- /dev/null +++ b/src/Dependencies/League/Container/Argument/RawArgumentInterface.php @@ -0,0 +1,13 @@ +definitions = $definitions ?? new DefinitionAggregate; + $this->providers = $providers ?? new ServiceProviderAggregate; + $this->inflectors = $inflectors ?? new InflectorAggregate; + + if ($this->definitions instanceof ContainerAwareInterface) { + $this->definitions->setLeagueContainer($this); + } + + if ($this->providers instanceof ContainerAwareInterface) { + $this->providers->setLeagueContainer($this); + } + + if ($this->inflectors instanceof ContainerAwareInterface) { + $this->inflectors->setLeagueContainer($this); + } + } + + /** + * Add an item to the container. + * + * @param string $id + * @param mixed $concrete + * @param boolean $shared + * + * @return DefinitionInterface + */ + public function add(string $id, $concrete = null, bool $shared = null) : DefinitionInterface + { + $concrete = $concrete ?? $id; + $shared = $shared ?? $this->defaultToShared; + + return $this->definitions->add($id, $concrete, $shared); + } + + /** + * Proxy to add with shared as true. + * + * @param string $id + * @param mixed $concrete + * + * @return DefinitionInterface + */ + public function share(string $id, $concrete = null) : DefinitionInterface + { + return $this->add($id, $concrete, true); + } + + /** + * Whether the container should default to defining shared definitions. + * + * @param boolean $shared + * + * @return self + */ + public function defaultToShared(bool $shared = true) : ContainerInterface + { + $this->defaultToShared = $shared; + + return $this; + } + + /** + * Get a definition to extend. + * + * @param string $id [description] + * + * @return DefinitionInterface + */ + public function extend(string $id) : DefinitionInterface + { + if ($this->providers->provides($id)) { + $this->providers->register($id); + } + + if ($this->definitions->has($id)) { + return $this->definitions->getDefinition($id); + } + + throw new NotFoundException( + sprintf('Unable to extend alias (%s) as it is not being managed as a definition', $id) + ); + } + + /** + * Add a service provider. + * + * @param ServiceProviderInterface|string $provider + * + * @return self + */ + public function addServiceProvider($provider) : self + { + $this->providers->add($provider); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function get($id, bool $new = false) + { + if ($this->definitions->has($id)) { + $resolved = $this->definitions->resolve($id, $new); + return $this->inflectors->inflect($resolved); + } + + if ($this->definitions->hasTag($id)) { + $arrayOf = $this->definitions->resolveTagged($id, $new); + + array_walk($arrayOf, function (&$resolved) { + $resolved = $this->inflectors->inflect($resolved); + }); + + return $arrayOf; + } + + if ($this->providers->provides($id)) { + $this->providers->register($id); + + if (!$this->definitions->has($id) && !$this->definitions->hasTag($id)) { + throw new ContainerException(sprintf('Service provider lied about providing (%s) service', $id)); + } + + return $this->get($id, $new); + } + + foreach ($this->delegates as $delegate) { + if ($delegate->has($id)) { + $resolved = $delegate->get($id); + return $this->inflectors->inflect($resolved); + } + } + + throw new NotFoundException(sprintf('Alias (%s) is not being managed by the container or delegates', $id)); + } + + /** + * {@inheritdoc} + */ + public function has($id) + { + if ($this->definitions->has($id)) { + return true; + } + + if ($this->definitions->hasTag($id)) { + return true; + } + + if ($this->providers->provides($id)) { + return true; + } + + foreach ($this->delegates as $delegate) { + if ($delegate->has($id)) { + return true; + } + } + + return false; + } + + /** + * Allows for manipulation of specific types on resolution. + * + * @param string $type + * @param callable|null $callback + * + * @return InflectorInterface + */ + public function inflector(string $type, callable $callback = null) : InflectorInterface + { + return $this->inflectors->add($type, $callback); + } + + /** + * Delegate a backup container to be checked for services if it + * cannot be resolved via this container. + * + * @param ContainerInterface $container + * + * @return self + */ + public function delegate(ContainerInterface $container) : self + { + $this->delegates[] = $container; + + if ($container instanceof ContainerAwareInterface) { + $container->setLeagueContainer($this); + } + + return $this; + } +} diff --git a/src/Dependencies/League/Container/ContainerAwareInterface.php b/src/Dependencies/League/Container/ContainerAwareInterface.php new file mode 100644 index 0000000..8a9f8a6 --- /dev/null +++ b/src/Dependencies/League/Container/ContainerAwareInterface.php @@ -0,0 +1,40 @@ +container = $container; + + return $this; + } + + /** + * Get the container. + * + * @return ContainerInterface + */ + public function getContainer() : ContainerInterface + { + if ($this->container instanceof ContainerInterface) { + return $this->container; + } + + throw new ContainerException('No container implementation has been set.'); + } + + /** + * Set a container. + * + * @param Container $container + * + * @return self + */ + public function setLeagueContainer(Container $container) : ContainerAwareInterface + { + $this->container = $container; + $this->leagueContainer = $container; + + return $this; + } + + /** + * Get the container. + * + * @return Container + */ + public function getLeagueContainer() : Container + { + if ($this->leagueContainer instanceof Container) { + return $this->leagueContainer; + } + + throw new ContainerException('No container implementation has been set.'); + } +} diff --git a/src/Dependencies/League/Container/Definition/Definition.php b/src/Dependencies/League/Container/Definition/Definition.php new file mode 100644 index 0000000..ff5c0c7 --- /dev/null +++ b/src/Dependencies/League/Container/Definition/Definition.php @@ -0,0 +1,278 @@ +alias = $id; + $this->concrete = $concrete; + } + + /** + * {@inheritdoc} + */ + public function addTag(string $tag) : DefinitionInterface + { + $this->tags[$tag] = true; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function hasTag(string $tag) : bool + { + return isset($this->tags[$tag]); + } + + /** + * {@inheritdoc} + */ + public function setAlias(string $id) : DefinitionInterface + { + $this->alias = $id; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getAlias() : string + { + return $this->alias; + } + + /** + * {@inheritdoc} + */ + public function setShared(bool $shared = true) : DefinitionInterface + { + $this->shared = $shared; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isShared() : bool + { + return $this->shared; + } + + /** + * {@inheritdoc} + */ + public function getConcrete() + { + return $this->concrete; + } + + /** + * {@inheritdoc} + */ + public function setConcrete($concrete) : DefinitionInterface + { + $this->concrete = $concrete; + $this->resolved = null; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addArgument($arg) : DefinitionInterface + { + $this->arguments[] = $arg; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addArguments(array $args) : DefinitionInterface + { + foreach ($args as $arg) { + $this->addArgument($arg); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addMethodCall(string $method, array $args = []) : DefinitionInterface + { + $this->methods[] = [ + 'method' => $method, + 'arguments' => $args + ]; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addMethodCalls(array $methods = []) : DefinitionInterface + { + foreach ($methods as $method => $args) { + $this->addMethodCall($method, $args); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function resolve(bool $new = false) + { + $concrete = $this->concrete; + + if ($this->isShared() && $this->resolved !== null && $new === false) { + return $this->resolved; + } + + if (is_callable($concrete)) { + $concrete = $this->resolveCallable($concrete); + } + + if ($concrete instanceof RawArgumentInterface) { + $this->resolved = $concrete->getValue(); + + return $concrete->getValue(); + } + + if ($concrete instanceof ClassNameInterface) { + $concrete = $concrete->getClassName(); + } + + if (is_string($concrete) && class_exists($concrete)) { + $concrete = $this->resolveClass($concrete); + } + + if (is_object($concrete)) { + $concrete = $this->invokeMethods($concrete); + } + + if (is_string($concrete) && $this->getContainer()->has($concrete)) { + $concrete = $this->getContainer()->get($concrete); + } + + $this->resolved = $concrete; + + return $concrete; + } + + /** + * Resolve a callable. + * + * @param callable $concrete + * + * @return mixed + */ + protected function resolveCallable(callable $concrete) + { + $resolved = $this->resolveArguments($this->arguments); + + return call_user_func_array($concrete, $resolved); + } + + /** + * Resolve a class. + * + * @param string $concrete + * + * @return object + * + * @throws ReflectionException + */ + protected function resolveClass(string $concrete) + { + $resolved = $this->resolveArguments($this->arguments); + $reflection = new ReflectionClass($concrete); + + return $reflection->newInstanceArgs($resolved); + } + + /** + * Invoke methods on resolved instance. + * + * @param object $instance + * + * @return object + */ + protected function invokeMethods($instance) + { + foreach ($this->methods as $method) { + $args = $this->resolveArguments($method['arguments']); + + /** @var callable $callable */ + $callable = [$instance, $method['method']]; + call_user_func_array($callable, $args); + } + + return $instance; + } +} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregate.php b/src/Dependencies/League/Container/Definition/DefinitionAggregate.php new file mode 100644 index 0000000..73e1d4b --- /dev/null +++ b/src/Dependencies/League/Container/Definition/DefinitionAggregate.php @@ -0,0 +1,124 @@ +definitions = array_filter($definitions, function ($definition) { + return ($definition instanceof DefinitionInterface); + }); + } + + /** + * {@inheritdoc} + */ + public function add(string $id, $definition, bool $shared = false) : DefinitionInterface + { + if (!$definition instanceof DefinitionInterface) { + $definition = new Definition($id, $definition); + } + + $this->definitions[] = $definition + ->setAlias($id) + ->setShared($shared) + ; + + return $definition; + } + + /** + * {@inheritdoc} + */ + public function has(string $id) : bool + { + foreach ($this->getIterator() as $definition) { + if ($id === $definition->getAlias()) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function hasTag(string $tag) : bool + { + foreach ($this->getIterator() as $definition) { + if ($definition->hasTag($tag)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getDefinition(string $id) : DefinitionInterface + { + foreach ($this->getIterator() as $definition) { + if ($id === $definition->getAlias()) { + return $definition->setLeagueContainer($this->getLeagueContainer()); + } + } + + throw new NotFoundException(sprintf('Alias (%s) is not being handled as a definition.', $id)); + } + + /** + * {@inheritdoc} + */ + public function resolve(string $id, bool $new = false) + { + return $this->getDefinition($id)->resolve($new); + } + + /** + * {@inheritdoc} + */ + public function resolveTagged(string $tag, bool $new = false) : array + { + $arrayOf = []; + + foreach ($this->getIterator() as $definition) { + if ($definition->hasTag($tag)) { + $arrayOf[] = $definition->setLeagueContainer($this->getLeagueContainer())->resolve($new); + } + } + + return $arrayOf; + } + + /** + * {@inheritdoc} + */ + public function getIterator() : Generator + { + $count = count($this->definitions); + + for ($i = 0; $i < $count; $i++) { + yield $this->definitions[$i]; + } + } +} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php b/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php new file mode 100644 index 0000000..7069f2f --- /dev/null +++ b/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php @@ -0,0 +1,67 @@ +type = $type; + $this->callback = $callback; + } + + /** + * {@inheritdoc} + */ + public function getType() : string + { + return $this->type; + } + + /** + * {@inheritdoc} + */ + public function invokeMethod(string $name, array $args) : InflectorInterface + { + $this->methods[$name] = $args; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function invokeMethods(array $methods) : InflectorInterface + { + foreach ($methods as $name => $args) { + $this->invokeMethod($name, $args); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setProperty(string $property, $value) : InflectorInterface + { + $this->properties[$property] = $this->resolveArguments([$value])[0]; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setProperties(array $properties) : InflectorInterface + { + foreach ($properties as $property => $value) { + $this->setProperty($property, $value); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function inflect($object) + { + $properties = $this->resolveArguments(array_values($this->properties)); + $properties = array_combine(array_keys($this->properties), $properties); + + // array_combine() can technically return false + foreach ($properties ?: [] as $property => $value) { + $object->{$property} = $value; + } + + foreach ($this->methods as $method => $args) { + $args = $this->resolveArguments($args); + + /** @var callable $callable */ + $callable = [$object, $method]; + call_user_func_array($callable, $args); + } + + if ($this->callback !== null) { + call_user_func($this->callback, $object); + } + } +} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregate.php b/src/Dependencies/League/Container/Inflector/InflectorAggregate.php new file mode 100644 index 0000000..644668e --- /dev/null +++ b/src/Dependencies/League/Container/Inflector/InflectorAggregate.php @@ -0,0 +1,58 @@ +inflectors[] = $inflector; + + return $inflector; + } + + /** + * {@inheritdoc} + */ + public function getIterator() : Generator + { + $count = count($this->inflectors); + + for ($i = 0; $i < $count; $i++) { + yield $this->inflectors[$i]; + } + } + + /** + * {@inheritdoc} + */ + public function inflect($object) + { + foreach ($this->getIterator() as $inflector) { + $type = $inflector->getType(); + + if (! $object instanceof $type) { + continue; + } + + $inflector->setLeagueContainer($this->getLeagueContainer()); + $inflector->inflect($object); + } + + return $object; + } +} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php b/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php new file mode 100644 index 0000000..7309e01 --- /dev/null +++ b/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php @@ -0,0 +1,27 @@ +cacheResolutions === true && array_key_exists($id, $this->cache)) { + return $this->cache[$id]; + } + + if (! $this->has($id)) { + throw new NotFoundException( + sprintf('Alias (%s) is not an existing class and therefore cannot be resolved', $id) + ); + } + + $reflector = new ReflectionClass($id); + $construct = $reflector->getConstructor(); + + if ($construct && !$construct->isPublic()) { + throw new NotFoundException( + sprintf('Alias (%s) has a non-public constructor and therefore cannot be instantiated', $id) + ); + } + + $resolution = $construct === null + ? new $id + : $resolution = $reflector->newInstanceArgs($this->reflectArguments($construct, $args)) + ; + + if ($this->cacheResolutions === true) { + $this->cache[$id] = $resolution; + } + + return $resolution; + } + + /** + * {@inheritdoc} + */ + public function has($id) + { + return class_exists($id); + } + + /** + * Invoke a callable via the container. + * + * @param callable $callable + * @param array $args + * + * @return mixed + * + * @throws ReflectionException + */ + public function call(callable $callable, array $args = []) + { + if (is_string($callable) && strpos($callable, '::') !== false) { + $callable = explode('::', $callable); + } + + if (is_array($callable)) { + if (is_string($callable[0])) { + $callable[0] = $this->getContainer()->get($callable[0]); + } + + $reflection = new ReflectionMethod($callable[0], $callable[1]); + + if ($reflection->isStatic()) { + $callable[0] = null; + } + + return $reflection->invokeArgs($callable[0], $this->reflectArguments($reflection, $args)); + } + + if (is_object($callable)) { + $reflection = new ReflectionMethod($callable, '__invoke'); + + return $reflection->invokeArgs($callable, $this->reflectArguments($reflection, $args)); + } + + $reflection = new ReflectionFunction(\Closure::fromCallable($callable)); + + return $reflection->invokeArgs($this->reflectArguments($reflection, $args)); + } + + /** + * Whether the container should default to caching resolutions and returning + * the cache on following calls. + * + * @param boolean $option + * + * @return self + */ + public function cacheResolutions(bool $option = true) : ContainerInterface + { + $this->cacheResolutions = $option; + + return $this; + } +} diff --git a/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php b/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php new file mode 100644 index 0000000..1b356af --- /dev/null +++ b/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php @@ -0,0 +1,46 @@ +provides, true); + } + + /** + * {@inheritdoc} + */ + public function setIdentifier(string $id) : ServiceProviderInterface + { + $this->identifier = $id; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getIdentifier() : string + { + return $this->identifier ?? get_class($this); + } +} diff --git a/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php b/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php new file mode 100644 index 0000000..895f4be --- /dev/null +++ b/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php @@ -0,0 +1,14 @@ +getContainer()->has($provider)) { + $provider = $this->getContainer()->get($provider); + } elseif (is_string($provider) && class_exists($provider)) { + $provider = new $provider; + } + + if (in_array($provider, $this->providers, true)) { + return $this; + } + + if ($provider instanceof ContainerAwareInterface) { + $provider->setLeagueContainer($this->getLeagueContainer()); + } + + if ($provider instanceof BootableServiceProviderInterface) { + $provider->boot(); + } + + if ($provider instanceof ServiceProviderInterface) { + $this->providers[] = $provider; + + return $this; + } + + throw new ContainerException( + 'A service provider must be a fully qualified class name or instance ' . + 'of (\RocketCDN\Dependencies\League\Container\ServiceProvider\ServiceProviderInterface)' + ); + } + + /** + * {@inheritdoc} + */ + public function provides(string $service) : bool + { + foreach ($this->getIterator() as $provider) { + if ($provider->provides($service)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getIterator() : Generator + { + $count = count($this->providers); + + for ($i = 0; $i < $count; $i++) { + yield $this->providers[$i]; + } + } + + /** + * {@inheritdoc} + */ + public function register(string $service) + { + if (false === $this->provides($service)) { + throw new ContainerException( + sprintf('(%s) is not provided by a service provider', $service) + ); + } + + foreach ($this->getIterator() as $provider) { + if (in_array($provider->getIdentifier(), $this->registered, true)) { + continue; + } + + if ($provider->provides($service)) { + $this->registered[] = $provider->getIdentifier(); + $provider->register(); + } + } + } +} diff --git a/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php b/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php new file mode 100644 index 0000000..a0eb57e --- /dev/null +++ b/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php @@ -0,0 +1,36 @@ +leagueContainer property or the `getLeagueContainer` method + * from the ContainerAwareTrait. + * + * @return void + */ + public function register(); + + /** + * Set a custom id for the service provider. This enables + * registering the same service provider multiple times. + * + * @param string $id + * + * @return self + */ + public function setIdentifier(string $id) : ServiceProviderInterface; + + /** + * The id of the service provider uniquely identifies it, so + * that we can quickly determine if it has already been registered. + * Defaults to get_class($provider). + * + * @return string + */ + public function getIdentifier() : string; +} diff --git a/src/Dependencies/Psr/Container/ContainerExceptionInterface.php b/src/Dependencies/Psr/Container/ContainerExceptionInterface.php new file mode 100644 index 0000000..c0ddbc0 --- /dev/null +++ b/src/Dependencies/Psr/Container/ContainerExceptionInterface.php @@ -0,0 +1,12 @@ + Date: Thu, 4 Jul 2024 09:40:40 +0200 Subject: [PATCH 14/40] Updated lock file with 7.4 --- composer.lock | 133 ++++++++++++++++++++++++-------------------------- 1 file changed, 63 insertions(+), 70 deletions(-) diff --git a/composer.lock b/composer.lock index 1470814..cc31de4 100644 --- a/composer.lock +++ b/composer.lock @@ -753,26 +753,26 @@ }, { "name": "league/mime-type-detection", - "version": "1.15.0", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301" + "reference": "c7f2872fb273bf493811473dafc88d60ae829f48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", - "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/c7f2872fb273bf493811473dafc88d60ae829f48", + "reference": "c7f2872fb273bf493811473dafc88d60ae829f48", "shasum": "" }, "require": { "ext-fileinfo": "*", - "php": "^7.4 || ^8.0" + "php": "^7.2 || ^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.2", "phpstan/phpstan": "^0.12.68", - "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" + "phpunit/phpunit": "^8.5.8 || ^9.3" }, "type": "library", "autoload": { @@ -793,7 +793,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.15.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.12.0" }, "funding": [ { @@ -805,7 +805,7 @@ "type": "tidelift" } ], - "time": "2024-01-28T23:22:08+00:00" + "time": "2023-08-03T07:14:11+00:00" }, { "name": "mikey179/vfsstream", @@ -1425,35 +1425,28 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.1", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", - "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { - "doctrine/deprecations": "^1.1", "ext-filter": "*", - "php": "^7.4 || ^8.0", + "php": "^7.2 || ^8.0", "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.7", + "phpdocumentor/type-resolver": "^1.3", "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.5", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-webmozart-assert": "^1.2", - "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^5.13" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -1477,15 +1470,15 @@ }, { "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "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.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2024-05-21T05:55:05+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -2117,20 +2110,20 @@ }, { "name": "psr/container", - "version": "1.1.2", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", "shasum": "" }, "require": { - "php": ">=7.4.0" + "php": ">=7.2.0" }, "type": "library", "autoload": { @@ -2159,9 +2152,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/1.1.1" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-03-05T17:36:06+00:00" }, { "name": "roave/security-advisories", @@ -3878,25 +3871,25 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.5.0", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + "reference": "80d075412b557d41002320b96a096ca65aa2c98d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3925,7 +3918,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" }, "funding": [ { @@ -3941,7 +3934,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2023-01-24T14:02:46+00:00" }, { "name": "symfony/finder", @@ -4482,30 +4475,33 @@ }, { "name": "symfony/service-contracts", - "version": "v3.5.0", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" + "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a2329596ddc8fd568900e3fc76cba42489ecc7f3", + "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3", "shasum": "" }, "require": { - "php": ">=8.1", - "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.5|^3" + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" }, "conflict": { "ext-psr": "<1.1|>=2" }, + "suggest": { + "symfony/service-implementation": "" + }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -4515,10 +4511,7 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4545,7 +4538,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.3" }, "funding": [ { @@ -4561,38 +4554,38 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2023-04-21T15:04:16+00:00" }, { "name": "symfony/string", - "version": "v6.4.9", + "version": "v5.4.41", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "76792dbd99690a5ebef8050d9206c60c59e681d7" + "reference": "065a9611e0b1fd2197a867e1fb7f2238191b7096" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/76792dbd99690a5ebef8050d9206c60c59e681d7", - "reference": "76792dbd99690a5ebef8050d9206c60c59e681d7", + "url": "https://api.github.com/repos/symfony/string/zipball/065a9611e0b1fd2197a867e1fb7f2238191b7096", + "reference": "065a9611e0b1fd2197a867e1fb7f2238191b7096", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=7.2.5", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" }, "conflict": { - "symfony/translation-contracts": "<2.5" + "symfony/translation-contracts": ">=3.0" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0|^7.0", - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/intl": "^6.2|^7.0", - "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0|^7.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|^6.0" }, "type": "library", "autoload": { @@ -4631,7 +4624,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.9" + "source": "https://github.com/symfony/string/tree/v5.4.41" }, "funding": [ { @@ -4647,7 +4640,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:25:38+00:00" + "time": "2024-06-28T09:20:55+00:00" }, { "name": "szepeviktor/phpstan-wordpress", @@ -5234,5 +5227,5 @@ "platform-dev": { "php": "^7 || ^8" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.6.0" } From 4f81f8a6575cf4e4dc1630435d69316926cc598c Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Thu, 4 Jul 2024 09:45:23 +0200 Subject: [PATCH 15/40] Removed dependencies --- .github/workflows/test_php8.yml | 2 +- .github/workflows/test_rocketcdn.yml | 2 +- .gitignore | 1 + .../LaunchpadCore/Activation/Activation.php | 158 ---------- .../Activation/ActivationInterface.php | 14 - .../ActivationServiceProviderInterface.php | 8 - .../HasActivatorServiceProviderInterface.php | 13 - .../Container/AbstractServiceProvider.php | 136 --------- .../Container/HasInflectorInterface.php | 20 -- .../InflectorServiceProviderTrait.php | 46 --- .../IsOptimizableServiceProvider.php | 8 - .../LaunchpadCore/Container/PrefixAware.php | 23 -- .../Container/PrefixAwareInterface.php | 13 - .../LaunchpadCore/Container/Registration.php | 95 ------ .../Container/ServiceProviderInterface.php | 44 --- .../Deactivation/Deactivation.php | 158 ---------- .../Deactivation/DeactivationInterface.php | 13 - .../DeactivationServiceProviderInterface.php | 8 - ...HasDeactivatorServiceProviderInterface.php | 13 - .../Dispatcher/DispatcherAwareInterface.php | 17 -- .../Dispatcher/DispatcherAwareTrait.php | 26 -- .../SubscriberSignaturesSanitizer.php | 55 ---- .../ClassicSubscriberInterface.php | 24 -- .../EventManagement/EventManager.php | 135 --------- .../EventManagerAwareSubscriberInterface.php | 13 - .../OptimizedSubscriberInterface.php | 28 -- .../EventManagement/SubscriberInterface.php | 8 - .../Wrapper/SubscriberWrapper.php | 71 ----- .../Wrapper/WrappedSubscriber.php | 72 ----- src/Dependencies/LaunchpadCore/Plugin.php | 267 ----------------- src/Dependencies/LaunchpadCore/boot.php | 99 ------- .../LaunchpadDispatcher/Dispatcher.php | 102 ------- .../Interfaces/SanitizerInterface.php | 10 - .../Sanitizers/BoolSanitizer.php | 16 - .../Sanitizers/FloatSanitizer.php | 16 - .../Sanitizers/IntSanitizer.php | 15 - .../Sanitizers/StringSanitizer.php | 24 -- .../LaunchpadDispatcher/Traits/IsDefault.php | 11 - .../Interfaces/OptionsAwareInterface.php | 16 - .../Interfaces/SettingsAwareInterface.php | 16 - .../Interfaces/TransientsAwareInterface.php | 16 - .../ServiceProvider.php | 77 ----- .../Traits/OptionsAwareTrait.php | 26 -- .../Traits/SettingsAwareTrait.php | 26 -- .../Traits/TransientsAwareTrait.php | 26 -- .../Interfaces/Actions/DeleteInterface.php | 15 - .../Interfaces/Actions/FetchInterface.php | 26 -- .../Actions/FetchPrefixInterface.php | 15 - .../Interfaces/Actions/SetInterface.php | 17 -- .../Interfaces/OptionsInterface.php | 14 - .../Interfaces/SettingsInterface.php | 26 -- .../Interfaces/TransientsInterface.php | 25 -- src/Dependencies/LaunchpadOptions/Options.php | 64 ---- .../LaunchpadOptions/Settings.php | 142 --------- .../Traits/PrefixedKeyTrait.php | 45 --- .../LaunchpadOptions/Transients.php | 64 ---- .../Argument/ArgumentResolverInterface.php | 28 -- .../Argument/ArgumentResolverTrait.php | 120 -------- .../League/Container/Argument/ClassName.php | 29 -- .../Container/Argument/ClassNameInterface.php | 13 - .../Argument/ClassNameWithOptionalValue.php | 39 --- .../League/Container/Argument/RawArgument.php | 29 -- .../Argument/RawArgumentInterface.php | 13 - .../League/Container/Container.php | 248 ---------------- .../Container/ContainerAwareInterface.php | 40 --- .../League/Container/ContainerAwareTrait.php | 76 ----- .../Container/Definition/Definition.php | 278 ------------------ .../Definition/DefinitionAggregate.php | 124 -------- .../DefinitionAggregateInterface.php | 67 ----- .../Definition/DefinitionInterface.php | 120 -------- .../Exception/ContainerException.php | 10 - .../Container/Exception/NotFoundException.php | 10 - .../League/Container/Inflector/Inflector.php | 123 -------- .../Inflector/InflectorAggregate.php | 58 ---- .../Inflector/InflectorAggregateInterface.php | 27 -- .../Inflector/InflectorInterface.php | 60 ---- .../League/Container/ReflectionContainer.php | 131 --------- .../AbstractServiceProvider.php | 46 --- .../BootableServiceProviderInterface.php | 14 - .../ServiceProviderAggregate.php | 106 ------- .../ServiceProviderAggregateInterface.php | 36 --- .../ServiceProviderInterface.php | 46 --- .../Container/ContainerExceptionInterface.php | 12 - .../Psr/Container/ContainerInterface.php | 36 --- .../Container/NotFoundExceptionInterface.php | 10 - 85 files changed, 3 insertions(+), 4386 deletions(-) delete mode 100644 src/Dependencies/LaunchpadCore/Activation/Activation.php delete mode 100644 src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Activation/ActivationServiceProviderInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Activation/HasActivatorServiceProviderInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/AbstractServiceProvider.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/PrefixAware.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/Registration.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Deactivation/Deactivation.php delete mode 100644 src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Deactivation/DeactivationServiceProviderInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Deactivation/HasDeactivatorServiceProviderInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/DispatcherAwareInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/DispatcherAwareTrait.php delete mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/EventManager.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/OptimizedSubscriberInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/Wrapper/SubscriberWrapper.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php delete mode 100644 src/Dependencies/LaunchpadCore/Plugin.php delete mode 100644 src/Dependencies/LaunchpadCore/boot.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Dispatcher.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/BoolSanitizer.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/FloatSanitizer.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/IntSanitizer.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/StringSanitizer.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Traits/IsDefault.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/OptionsAwareInterface.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/SettingsAwareInterface.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/TransientsAwareInterface.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/ServiceProvider.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/FetchInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/FetchPrefixInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/SetInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/OptionsInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/SettingsInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Options.php delete mode 100644 src/Dependencies/LaunchpadOptions/Settings.php delete mode 100644 src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php delete mode 100644 src/Dependencies/LaunchpadOptions/Transients.php delete mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php delete mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverTrait.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassName.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassNameInterface.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassNameWithOptionalValue.php delete mode 100644 src/Dependencies/League/Container/Argument/RawArgument.php delete mode 100644 src/Dependencies/League/Container/Argument/RawArgumentInterface.php delete mode 100644 src/Dependencies/League/Container/Container.php delete mode 100644 src/Dependencies/League/Container/ContainerAwareInterface.php delete mode 100644 src/Dependencies/League/Container/ContainerAwareTrait.php delete mode 100644 src/Dependencies/League/Container/Definition/Definition.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregate.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionInterface.php delete mode 100644 src/Dependencies/League/Container/Exception/ContainerException.php delete mode 100644 src/Dependencies/League/Container/Exception/NotFoundException.php delete mode 100644 src/Dependencies/League/Container/Inflector/Inflector.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregate.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorInterface.php delete mode 100644 src/Dependencies/League/Container/ReflectionContainer.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregate.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderInterface.php delete mode 100644 src/Dependencies/Psr/Container/ContainerExceptionInterface.php delete mode 100644 src/Dependencies/Psr/Container/ContainerInterface.php delete mode 100644 src/Dependencies/Psr/Container/NotFoundExceptionInterface.php diff --git a/.github/workflows/test_php8.yml b/.github/workflows/test_php8.yml index 2a82dc9..a5cadb1 100644 --- a/.github/workflows/test_php8.yml +++ b/.github/workflows/test_php8.yml @@ -61,7 +61,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-scripts --ignore-platform-reqs + run: composer install --prefer-dist --no-interaction --ignore-platform-reqs - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/.github/workflows/test_rocketcdn.yml b/.github/workflows/test_rocketcdn.yml index 2523778..6642ac5 100644 --- a/.github/workflows/test_rocketcdn.yml +++ b/.github/workflows/test_rocketcdn.yml @@ -62,7 +62,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-scripts + run: composer install --prefer-dist --no-interaction - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/.gitignore b/.gitignore index 0fd16bc..c167f3b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ composer.phar /vendor/ +/src/Dependencies # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file # composer.lock diff --git a/src/Dependencies/LaunchpadCore/Activation/Activation.php b/src/Dependencies/LaunchpadCore/Activation/Activation.php deleted file mode 100644 index 47be36c..0000000 --- a/src/Dependencies/LaunchpadCore/Activation/Activation.php +++ /dev/null @@ -1,158 +0,0 @@ - $value ) { - self::$container->add( $key, $value ); - } - - $container->share( 'dispatcher', self::$dispatcher ); - - $container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ key_exists( 'prefix', self::$params ) ? self::$params['prefix'] : '' ] ); - $container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $container->get( 'dispatcher' ) ] ); - - $providers = array_filter( - self::$providers, - function ( $provider ) { - if ( is_string( $provider ) ) { - $provider = new $provider(); - } - - if ( ! $provider instanceof ActivationServiceProviderInterface && ( ! $provider instanceof HasInflectorInterface || count( $provider->get_inflectors() ) === 0 ) ) { - return false; - } - - return $provider; - } - ); - - /** - * Activation providers. - * - * @param AbstractServiceProvider[] $providers Providers. - * @return AbstractServiceProvider[] - */ - $providers = apply_filters( "{$container->get('prefix')}deactivate_providers", $providers ); - - $providers = array_map( - function ( $provider ) { - if ( is_string( $provider ) ) { - return new $provider(); - } - return $provider; - }, - $providers - ); - - foreach ( $providers as $provider ) { - self::$container->addServiceProvider( $provider ); - } - - foreach ( $providers as $service_provider ) { - if ( ! $service_provider instanceof HasInflectorInterface ) { - continue; - } - $service_provider->register_inflectors(); - } - - foreach ( $providers as $provider ) { - if ( ! $provider instanceof HasActivatorServiceProviderInterface ) { - continue; - } - - foreach ( $provider->get_activators() as $activator ) { - $activator_instance = self::$container->get( $activator ); - if ( ! $activator_instance instanceof ActivationInterface ) { - continue; - } - $activator_instance->activate(); - } - } - } -} diff --git a/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php b/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php deleted file mode 100644 index 784145d..0000000 --- a/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -provides; - } - - /** - * Returns a boolean if checking whether this provider provides a specific - * service or returns an array of provided services if no argument passed. - * - * @param string $alias Class searched. - * - * @return boolean - */ - public function provides( string $alias ): bool { - if ( ! $this->loaded ) { - $this->loaded = true; - $this->define(); - } - - return parent::provides( $alias ); - } - - /** - * Return IDs from front subscribers. - * - * @return string[] - */ - public function get_front_subscribers(): array { - return []; - } - - /** - * Return IDs from admin subscribers. - * - * @return string[] - */ - public function get_admin_subscribers(): array { - return []; - } - - /** - * Return IDs from common subscribers. - * - * @return string[] - */ - public function get_common_subscribers(): array { - return []; - } - - /** - * Return IDs from init subscribers. - * - * @return string[] - */ - public function get_init_subscribers(): array { - return []; - } - - /** - * Register service into the provider. - * - * @param string $classname Class to register. - * @param callable|null $method Method called when registering. - * @param string $concrete Concrete class when necessary. - * @return Registration - */ - public function register_service( string $classname, callable $method = null, string $concrete = '' ): Registration { - - $registration = new Registration( $classname ); - - if( $method ) { - $registration->set_definition( $method ); - } - - - - if ( $concrete ) { - $registration->set_concrete( $concrete ); - } - - $this->services_to_load[] = $registration; - - if ( ! in_array( $classname, $this->provides, true ) ) { - $this->provides[] = $classname; - } - - return $registration; - } - - /** - * Define classes. - * - * @return mixed - */ - abstract protected function define(); - - /** - * Register classes provided by the service provider. - * - * @return void - */ - public function register() { - foreach ( $this->services_to_load as $registration ) { - $registration->register( $this->getLeagueContainer() ); - } - } -} diff --git a/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php b/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php deleted file mode 100644 index 90d2269..0000000 --- a/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ - public function get_inflectors(): array; - - /** - * Register inflectors. - * - * @return void - */ - public function register_inflectors(): void; -} diff --git a/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php b/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php deleted file mode 100644 index 2e20159..0000000 --- a/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php +++ /dev/null @@ -1,46 +0,0 @@ - - */ - public function get_inflectors(): array { - return []; - } - - /** - * Register inflectors. - * - * @return void - */ - public function register_inflectors(): void { - foreach ( $this->get_inflectors() as $class => $data ) { - if ( ! is_array( $data ) || ! key_exists( 'method', $data ) ) { - continue; - } - $method = $data['method']; - - if ( ! key_exists( 'args', $data ) || ! is_array( $data['args'] ) ) { - $this->getLeagueContainer()->inflector( $class )->invokeMethod( $method, [] ); - continue; - } - - $this->getLeagueContainer()->inflector( $class )->invokeMethod( $method, $data['args'] ); - } - } - - /** - * Get the container. - * - * @return Container - */ - abstract public function getLeagueContainer(): Container; // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid -} diff --git a/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php b/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php deleted file mode 100644 index 0fae980..0000000 --- a/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php +++ /dev/null @@ -1,8 +0,0 @@ -prefix = $prefix; - } -} diff --git a/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php b/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php deleted file mode 100644 index 78c6d4c..0000000 --- a/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -id = $id; - $this->value = $id; - } - - /** - * Define a callback definition for the class. - * - * @param callable $definition Callback definition for the class. - * @return $this - */ - public function set_definition( callable $definition ): Registration { - $this->definition = $definition; - return $this; - } - - /** - * Set a concrete class. - * - * @param mixed $concrete Concrete class. - * @return $this - */ - public function set_concrete( $concrete ): Registration { - $this->value = $concrete; - return $this; - } - - /** - * Make a definition shared. - * - * @return $this - */ - public function share(): Registration { - $this->shared = true; - return $this; - } - - /** - * Register a definition on a container. - * - * @param Container $container Container to register on. - * @return void - */ - public function register( Container $container ) { - $class_registration = $container->add( $this->id, $this->value, $this->shared ); - - if ( ! $this->definition ) { - return; - } - - ( $this->definition )( $class_registration ); - } -} diff --git a/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php b/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php deleted file mode 100644 index a5c1eee..0000000 --- a/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php +++ /dev/null @@ -1,44 +0,0 @@ - $value ) { - $container->add( $key, $value ); - } - - $container->share( 'dispatcher', self::$dispatcher ); - - $container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ key_exists( 'prefix', self::$params ) ? self::$params['prefix'] : '' ] ); - $container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $container->get( 'dispatcher' ) ] ); - - $providers = array_filter( - self::$providers, - function ( $provider ) { - if ( is_string( $provider ) ) { - $provider = new $provider(); - } - - if ( ! $provider instanceof DeactivationServiceProviderInterface && ( ! $provider instanceof HasInflectorInterface || count( $provider->get_inflectors() ) === 0 ) ) { - return false; - } - - return $provider; - } - ); - - $providers = array_map( - function ( $provider ) { - if ( is_string( $provider ) ) { - return new $provider(); - } - return $provider; - }, - $providers - ); - - foreach ( $providers as $provider ) { - $container->addServiceProvider( $provider ); - } - - foreach ( $providers as $service_provider ) { - if ( ! $service_provider instanceof HasInflectorInterface ) { - continue; - } - $service_provider->register_inflectors(); - } - - /** - * Deactivation providers. - * - * @param AbstractServiceProvider[] $providers Providers. - * @return AbstractServiceProvider[] - */ - $providers = apply_filters( "{$container->get('prefix')}deactivate_providers", $providers ); - - foreach ( $providers as $provider ) { - if ( ! $provider instanceof HasDeactivatorServiceProviderInterface ) { - continue; - } - - foreach ( $provider->get_deactivators() as $deactivator ) { - $deactivator_instance = self::$container->get( $deactivator ); - if ( ! $deactivator_instance instanceof DeactivationInterface ) { - continue; - } - $deactivator_instance->deactivate(); - } - } - } -} diff --git a/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php b/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php deleted file mode 100644 index 27cbb47..0000000 --- a/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -dispatcher = $dispatcher; - } -} diff --git a/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php b/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php deleted file mode 100644 index 0cc03fa..0000000 --- a/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php +++ /dev/null @@ -1,55 +0,0 @@ -is_default = false; - - if ( ! is_array( $value ) ) { - $this->is_default = true; - return false; - } - - $output = []; - - foreach ( $value as $subscriber ) { - if ( ! is_string( $subscriber ) && ! is_object( $subscriber ) ) { - continue; - } - - $output [] = $subscriber; - } - - return $output; - } - - /** - * Should return default value. - * - * @param mixed $value Current value. - * @param mixed $original Original value. - * - * @return bool - */ - public function is_default( $value, $original ): bool { - return $this->is_default; - } -} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php deleted file mode 100644 index c40d558..0000000 --- a/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - 'method_name') - * * array('hook_name' => array('method_name', $priority)) - * * array('hook_name' => array('method_name', $priority, $accepted_args)) - * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) - * - * @return array - */ - public function get_subscribed_events(); -} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php b/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php deleted file mode 100644 index f95a001..0000000 --- a/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php +++ /dev/null @@ -1,135 +0,0 @@ - - */ -class EventManager { - /** - * Adds a callback to a specific hook of the WordPress plugin API. - * - * @uses add_filter() - * - * @param string $hook_name Name of the hook. - * @param callable $callback Callback function. - * @param int $priority Priority. - * @param int $accepted_args Number of arguments. - */ - public function add_callback( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) { - add_filter( $hook_name, $callback, $priority, $accepted_args ); - } - - /** - * Add an event subscriber. - * - * The event manager registers all the hooks that the given subscriber - * wants to register with the WordPress Plugin API. - * - * @param ClassicSubscriberInterface $subscriber Subscriber_Interface implementation. - */ - public function add_subscriber( ClassicSubscriberInterface $subscriber ) { - if ( $subscriber instanceof EventManagerAwareSubscriberInterface ) { - $subscriber->set_event_manager( $this ); - } - - $events = $subscriber->get_subscribed_events(); - - if ( empty( $events ) ) { - return; - } - - foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { - $this->add_subscriber_callback( $subscriber, $hook_name, $parameters ); - } - } - - /** - * Checks the WordPress plugin API to see if the given hook has - * the given callback. The priority of the callback will be returned - * or false. If no callback is given will return true or false if - * there's any callbacks registered to the hook. - * - * @uses has_filter() - * - * @param string $hook_name Hook name. - * @param mixed $callback Callback. - * - * @return bool|int - */ - public function has_callback( $hook_name, $callback = false ) { - return has_filter( $hook_name, $callback ); - } - - /** - * Removes the given callback from the given hook. The WordPress plugin API only - * removes the hook if the callback and priority match a registered hook. - * - * @uses remove_filter() - * - * @param string $hook_name Hook name. - * @param callable $callback Callback. - * @param int $priority Priority. - * - * @return bool - */ - public function remove_callback( $hook_name, $callback, $priority = 10 ) { - return remove_filter( $hook_name, $callback, $priority ); - } - - /** - * Remove an event subscriber. - * - * The event manager removes all the hooks that the given subscriber - * wants to register with the WordPress Plugin API. - * - * @param SubscriberInterface $subscriber Subscriber_Interface implementation. - */ - public function remove_subscriber( SubscriberInterface $subscriber ) { - foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { - $this->remove_subscriber_callback( $subscriber, $hook_name, $parameters ); - } - } - - /** - * Adds the given subscriber's callback to a specific hook - * of the WordPress plugin API. - * - * @param SubscriberInterface $subscriber Subscriber_Interface implementation. - * @param string $hook_name Hook name. - * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. - */ - private function add_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { - if ( is_string( $parameters ) ) { - $this->add_callback( $hook_name, [ $subscriber, $parameters ] ); - } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { - foreach ( $parameters as $parameter ) { - $this->add_subscriber_callback( $subscriber, $hook_name, $parameter ); - } - } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { - $this->add_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10, isset( $parameters[2] ) ? $parameters[2] : 1 ); - } - } - - /** - * Removes the given subscriber's callback to a specific hook - * of the WordPress plugin API. - * - * @param SubscriberInterface $subscriber Subscriber_Interface implementation. - * @param string $hook_name Hook name. - * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. - */ - private function remove_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { - if ( is_string( $parameters ) ) { - $this->remove_callback( $hook_name, [ $subscriber, $parameters ] ); - } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { - foreach ( $parameters as $parameter ) { - $this->remove_subscriber_callback( $subscriber, $hook_name, $parameter ); - } - } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { - $this->remove_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10 ); - } - } -} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php deleted file mode 100644 index 1a6af03..0000000 --- a/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php +++ /dev/null @@ -1,13 +0,0 @@ - 'method_name') - * * array('hook_name' => array('method_name', $priority)) - * * array('hook_name' => array('method_name', $priority, $accepted_args)) - * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) - * - * @return array - */ - public static function get_subscribed_events(); -} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php deleted file mode 100644 index 9263f3c..0000000 --- a/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php +++ /dev/null @@ -1,8 +0,0 @@ -prefix = $prefix; - } - - /** - * Wrap a subscriber will the common interface for subscribers. - * - * @param object $instance Any class subscriber. - * - * @return SubscriberInterface - * @throws ReflectionException Error is the class name is not valid. - */ - public function wrap( $instance ): SubscriberInterface { - if ( $instance instanceof OptimizedSubscriberInterface ) { - return new WrappedSubscriber( $instance, $instance->get_subscribed_events() ); - } - - $methods = get_class_methods( $instance ); - $reflection_class = new ReflectionClass( get_class( $instance ) ); - $events = []; - foreach ( $methods as $method ) { - $method_reflection = $reflection_class->getMethod( $method ); - $doc_comment = $method_reflection->getDocComment(); - if ( ! $doc_comment ) { - continue; - } - $pattern = '#@hook\s(?[a-zA-Z\\\-_$/]+)(\s(?[0-9]+))?#'; - - preg_match_all( $pattern, $doc_comment, $matches, PREG_PATTERN_ORDER ); - if ( ! $matches ) { - continue; - } - - foreach ( $matches[0] as $index => $match ) { - $hook = str_replace( '$prefix', $this->prefix, $matches['name'][ $index ] ); - - $events[ $hook ][] = [ - $method, - key_exists( 'priority', $matches ) && key_exists( $index, $matches['priority'] ) && '' !== $matches['priority'][ $index ] ? (int) $matches['priority'][ $index ] : 10, - $method_reflection->getNumberOfParameters(), - ]; - } - } - - return new WrappedSubscriber( $instance, $events ); - } -} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php b/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php deleted file mode 100644 index cb953e4..0000000 --- a/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php +++ /dev/null @@ -1,72 +0,0 @@ -instance = $instance; - $this->events = $events; - } - - /** - * Returns an array of events that this subscriber wants to listen to. - * - * The array key is the event name. The value can be: - * - * * The method name - * * An array with the method name and priority - * * An array with the method name, priority and number of accepted arguments - * - * For instance: - * - * * array('hook_name' => 'method_name') - * * array('hook_name' => array('method_name', $priority)) - * * array('hook_name' => array('method_name', $priority, $accepted_args)) - * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) - * - * @return array - */ - public function get_subscribed_events(): array { - return $this->events; - } - - /** - * Delegate callbacks to the actual subscriber. - * - * @param string $name Name from the method. - * @param array $arguments Parameters from the method. - * - * @return mixed - */ - public function __call( $name, $arguments ) { - - if ( method_exists( $this, $name ) ) { - return $this->{$name}( ...$arguments ); - } - - return $this->instance->{$name}( ...$arguments ); - } -} diff --git a/src/Dependencies/LaunchpadCore/Plugin.php b/src/Dependencies/LaunchpadCore/Plugin.php deleted file mode 100644 index 94d5a6e..0000000 --- a/src/Dependencies/LaunchpadCore/Plugin.php +++ /dev/null @@ -1,267 +0,0 @@ -container = $container; - $this->event_manager = $event_manager; - $this->subscriber_wrapper = $subscriber_wrapper; - $this->dispatcher = $dispatcher; - } - - /** - * Returns the Rocket container instance. - * - * @return ContainerInterface - */ - public function get_container() { - return $this->container; - } - - /** - * Loads the plugin into WordPress. - * - * @param array $params Parameters to pass to the container. - * @param array $providers List of providers from the plugin. - * - * @return void - * - * @throws ContainerExceptionInterface Error from the container. - * @throws NotFoundExceptionInterface Error when a class is not found on the container. - * @throws ReflectionException Error when a classname is invalid. - */ - public function load( array $params, array $providers = [] ) { - - foreach ( $params as $key => $value ) { - $this->container->share( $key, $value ); - } - - /** - * Runs before the plugin is loaded. - */ - $this->dispatcher->do_action( "{$this->container->get('prefix')}before_load" ); - - add_filter( "{$this->container->get('prefix')}container", [ $this, 'get_container' ] ); - - $this->container->share( 'event_manager', $this->event_manager ); - $this->container->share( 'dispatcher', $this->dispatcher ); - - $this->container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ $this->container->get( 'prefix' ) ] ); - $this->container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $this->container->get( 'dispatcher' ) ] ); - - $providers = array_map( - function ( $classname ) { - if ( is_string( $classname ) ) { - return new $classname(); - } - - return $classname; - }, - $providers - ); - - $providers = $this->optimize_service_providers( $providers ); - - foreach ( $providers as $service_provider ) { - $this->container->addServiceProvider( $service_provider ); - } - - foreach ( $providers as $service_provider ) { - if ( ! $service_provider instanceof HasInflectorInterface ) { - continue; - } - $service_provider->register_inflectors(); - } - - foreach ( $providers as $service_provider ) { - $this->load_init_subscribers( $service_provider ); - } - - foreach ( $providers as $service_provider ) { - $this->load_subscribers( $service_provider ); - } - - /** - * Runs after the plugin is loaded. - */ - $this->dispatcher->do_action( "{$this->container->get('prefix')}after_load" ); - } - - /** - * Optimize service providers to keep only the ones we need to load. - * - * @param ServiceProviderInterface[] $providers Providers given to the plugin. - * - * @return ServiceProviderInterface[] - * - * @throws ContainerExceptionInterface Error from the container. - * @throws NotFoundExceptionInterface Error when a class is not found on the container. - */ - protected function optimize_service_providers( array $providers ): array { - $optimized_providers = []; - - foreach ( $providers as $provider ) { - if ( ! $provider instanceof IsOptimizableServiceProvider ) { - $optimized_providers[] = $provider; - continue; - } - $subscribers = array_merge( $provider->get_common_subscribers(), $provider->get_init_subscribers(), is_admin() ? $provider->get_admin_subscribers() : $provider->get_front_subscribers() ); - - /** - * Plugin Subscribers from a provider. - * - * @param SubscriberInterface[] $subscribers Subscribers. - * @param AbstractServiceProvider $provider Provider. - * - * @return SubscriberInterface[] - */ - $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_provider_subscribers", new SubscriberSignaturesSanitizer(), $subscribers, $provider ); - - if ( count( $subscribers ) === 0 ) { - continue; - } - - $optimized_providers[] = $provider; - } - - return $optimized_providers; - } - - /** - * Load list of event subscribers from service provider. - * - * @param ServiceProviderInterface $service_provider_instance Instance of service provider. - * - * @return void - * - * @throws ContainerExceptionInterface Error from the container. - * @throws NotFoundExceptionInterface Error when a class is not found on the container. - * @throws ReflectionException Error when a classname is invalid. - */ - private function load_init_subscribers( ServiceProviderInterface $service_provider_instance ) { - $subscribers = $service_provider_instance->get_init_subscribers(); - - /** - * Plugin Init Subscribers. - * - * @param SubscriberInterface[] $subscribers Subscribers. - * - * @return SubscriberInterface[] - */ - $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_init_subscribers", new SubscriberSignaturesSanitizer(), $subscribers ); - - if ( empty( $subscribers ) ) { - return; - } - - foreach ( $subscribers as $subscriber ) { - $subscriber_object = $this->container->get( $subscriber ); - if ( ! $subscriber_object instanceof ClassicSubscriberInterface ) { - $subscriber_object = $this->subscriber_wrapper->wrap( $subscriber_object ); - } - - $this->event_manager->add_subscriber( $subscriber_object ); - } - } - - /** - * Load list of event subscribers from service provider. - * - * @param ServiceProviderInterface $service_provider_instance Instance of service provider. - * - * @return void - * - * @throws ContainerExceptionInterface Error from the container. - * @throws NotFoundExceptionInterface Error when a class is not found on the container. - * @throws ReflectionException Error when a classname is invalid. - */ - private function load_subscribers( ServiceProviderInterface $service_provider_instance ) { - - $subscribers = $service_provider_instance->get_common_subscribers(); - - if ( ! is_admin() ) { - $subscribers = array_merge( $subscribers, $service_provider_instance->get_front_subscribers() ); - } else { - $subscribers = array_merge( $subscribers, $service_provider_instance->get_admin_subscribers() ); - } - - /** - * Plugin Subscribers. - * - * @param SubscriberInterface[] $subscribers Subscribers. - * @param AbstractServiceProvider $service_provider_instance Provider. - * - * @return SubscriberInterface[] - */ - $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_subscribers", new SubscriberSignaturesSanitizer(), $subscribers, $service_provider_instance ); - - if ( empty( $subscribers ) ) { - return; - } - - foreach ( $subscribers as $subscriber ) { - $subscriber_object = $this->container->get( $subscriber ); - if ( ! $subscriber_object instanceof ClassicSubscriberInterface ) { - $subscriber_object = $this->subscriber_wrapper->wrap( $subscriber_object ); - } - - $this->event_manager->add_subscriber( $subscriber_object ); - } - } -} diff --git a/src/Dependencies/LaunchpadCore/boot.php b/src/Dependencies/LaunchpadCore/boot.php deleted file mode 100644 index d17f37a..0000000 --- a/src/Dependencies/LaunchpadCore/boot.php +++ /dev/null @@ -1,99 +0,0 @@ -load( $params, $providers ); - } - ); - - Deactivation::set_container( new Container() ); - Deactivation::set_dispatcher( new Dispatcher() ); - Deactivation::set_params( $params ); - Deactivation::set_providers( $providers ); - - register_deactivation_hook( $plugin_launcher_file, [ Deactivation::class, 'deactivate_plugin' ] ); - - Activation::set_container( new Container() ); - Activation::set_dispatcher( new Dispatcher() ); - Activation::set_params( $params ); - Activation::set_providers( $providers ); - - register_activation_hook( $plugin_launcher_file, [ Activation::class, 'activate_plugin' ] ); -} diff --git a/src/Dependencies/LaunchpadDispatcher/Dispatcher.php b/src/Dependencies/LaunchpadDispatcher/Dispatcher.php deleted file mode 100644 index d155f3f..0000000 --- a/src/Dependencies/LaunchpadDispatcher/Dispatcher.php +++ /dev/null @@ -1,102 +0,0 @@ -call_deprecated_actions($name, ...$parameters); - do_action($name, ...$parameters); - } - - public function apply_filters(string $name, SanitizerInterface $sanitizer, $default, ...$parameters) - { - $result_deprecated = $this->call_deprecated_filters($name, $default, ...$parameters); - - $result = apply_filters($name, $result_deprecated, ...$parameters); - - $sanitized_result = $sanitizer->sanitize($result); - - if( false === $sanitized_result && $sanitizer->is_default($sanitized_result, $result) ) { - return $default; - } - - return $sanitized_result; - } - - public function apply_string_filters(string $name, string $default, ...$parameters): string - { - return $this->apply_filters($name, new StringSanitizer(), $default, ...$parameters); - } - - public function apply_bool_filters(string $name, bool $default, ...$parameters): bool - { - return $this->apply_filters($name, new BoolSanitizer(), $default, ...$parameters); - } - - public function apply_int_filters(string $name, int $default, ...$parameters): int - { - return $this->apply_filters($name, new IntSanitizer(), $default, ...$parameters); - } - - public function apply_float_filters(string $name, float $default, ...$parameters): float - { - return $this->apply_filters($name, new FloatSanitizer(), $default, ...$parameters); - } - - public function add_deprecated_action(string $name, string $deprecated_name, string $version, string $message = '') - { - $this->deprecated_actions[$name][] = [ - 'name' => $deprecated_name, - 'version' => $version, - 'message' => $message - ]; - } - - public function add_deprecated_filter(string $name, string $deprecated_name, string $version, string $message = '') - { - $this->deprecated_filters[$name][] = [ - 'name' => $deprecated_name, - 'version' => $version, - 'message' => $message - ]; - } - - protected function call_deprecated_actions(string $name, ...$parameters) - { - if( ! key_exists($name, $this->deprecated_actions)) { - return; - } - - foreach ($this->deprecated_actions[$name] as $action) { - do_action_deprecated($action['name'], $parameters, $action['version'], $name, $action['message']); - $this->call_deprecated_actions($action['name'], ...$parameters); - } - } - - protected function call_deprecated_filters(string $name, $default, ...$parameters) - { - if( ! key_exists($name, $this->deprecated_filters)) { - return $default; - } - - foreach ($this->deprecated_filters[$name] as $filter) { - $filter_parameters = array_merge([$default], $parameters); - $default = apply_filters_deprecated($filter['name'], $filter_parameters, $filter['version'], $name, $filter['message']); - $default = $this->call_deprecated_filters($filter['name'], $default, ...$parameters); - } - - return $default; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php b/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php deleted file mode 100644 index b784264..0000000 --- a/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php +++ /dev/null @@ -1,10 +0,0 @@ -register_service(OptionsInterface::class) - ->share() - ->set_concrete(Options::class) - ->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument('prefix'); - }); - - $this->register_service(TransientsInterface::class) - ->share() - ->set_concrete(Transients::class) - ->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument('prefix'); - }); - - $this->register_service(SettingsInterface::class) - ->share() - ->set_concrete(Settings::class) - ->set_definition(function (DefinitionInterface $definition) { - $prefix = $this->container->get('prefix'); - $definition->addArguments([OptionsInterface::class, "{$prefix}settings"]); - }); - } - - /** - * Returns inflectors. - * - * @return array[] - */ - public function get_inflectors(): array - { - return [ - OptionsAwareInterface::class => [ - 'method' => 'set_options', - 'args' => [ - OptionsInterface::class, - ], - ], - TransientsAwareInterface::class => [ - 'method' => 'set_transients', - 'args' => [ - TransientsInterface::class, - ], - ], - SettingsAwareInterface::class => [ - 'method' => 'set_settings', - 'args' => [ - SettingsInterface::class, - ], - ], - ]; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php deleted file mode 100644 index 2ac1d50..0000000 --- a/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php +++ /dev/null @@ -1,26 +0,0 @@ -options = $options; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php deleted file mode 100644 index 33e407e..0000000 --- a/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php +++ /dev/null @@ -1,26 +0,0 @@ -settings = $settings; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php deleted file mode 100644 index 0f10433..0000000 --- a/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php +++ /dev/null @@ -1,26 +0,0 @@ -transients = $transients; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php b/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php deleted file mode 100644 index 714f360..0000000 --- a/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php +++ /dev/null @@ -1,15 +0,0 @@ - $values Values to import. - * - * @return void - */ - public function import(array $values); - - /** - * Export settings values. - * - * @return array - */ - public function dumps(): array; -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php b/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php deleted file mode 100644 index 756dc2f..0000000 --- a/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php +++ /dev/null @@ -1,25 +0,0 @@ -prefix = $prefix; - } - - /** - * Gets the option for the given name. Returns the default value if the value does not exist. - * - * @param string $name Name of the option to get. - * @param mixed $default Default value to return if the value does not exist. - * - * @return mixed - */ - public function get( string $name, $default = null ) { - $option = get_option( $this->get_full_key( $name ), $default ); - - if ( is_array( $default ) && ! is_array( $option ) ) { - $option = (array) $option; - } - - return $option; - } - - /** - * Sets the value of an option. Update the value if the option for the given name already exists. - * - * @param string $name Name of the option to set. - * @param mixed $value Value to set for the option. - * - * @return void - */ - public function set( string $name, $value ) { - update_option( $this->get_full_key( $name ), $value ); - } - - /** - * Deletes the option with the given name. - * - * @param string $name Name of the option to delete. - * - * @return void - */ - public function delete( string $name ) { - delete_option( $this->get_full_key( $name ) ); - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Settings.php b/src/Dependencies/LaunchpadOptions/Settings.php deleted file mode 100644 index b3eb57a..0000000 --- a/src/Dependencies/LaunchpadOptions/Settings.php +++ /dev/null @@ -1,142 +0,0 @@ -options = $options; - $this->settings_key = $settings_key; - $this->settings = (array) $this->options->get($settings_key, []); - } - - /** - * @inheritDoc - */ - public function get(string $name, $default = null) - { - /** - * Pre-filter any setting before read - * - * @param mixed $default The default value. - */ - $value = apply_filters( "pre_get_{$this->settings_key}_" . $name, null, $default ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound - - if ( null !== $value ) { - return $value; - } - - if( ! $this->has($name)) { - return $default; - } - - /** - * Filter any setting after read - * - * @param mixed $default The default value. - */ - return apply_filters( "get_{$this->settings_key}" . $name, $this->settings[$name], $default ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound - } - - /** - * @inheritDoc - */ - public function set(string $name, $value) - { - $this->settings[$name] = $value; - - $this->persist(); - } - - /** - * @inheritDoc - */ - public function delete(string $name) - { - unset($this->settings[$name]); - - $this->persist(); - } - - /** - * @inheritDoc - */ - public function has(string $name): bool - { - return key_exists($name, $this->settings); - } - - /** - * Persist the settings into the database. - * @return void - */ - protected function persist() - { - do_action("pre_persist_{$this->settings_key}", $this->settings); - - $this->options->set($this->settings_key, $this->settings); - - do_action("persist_{$this->settings_key}", $this->settings); - } - - /** - * Import multiple values at once. - * - * @param array $values Values to import. - * - * @return void - */ - public function import(array $values) - { - foreach ($values as $name => $value) { - $this->settings[$name] = $value; - } - - $this->persist(); - } - - /** - * Export settings values. - * - * @return array - */ - public function dumps(): array - { - $output = []; - - foreach ($this->settings as $name => $value) { - $output[$name] = $this->get($name); - } - - return $output; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php b/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php deleted file mode 100644 index 89b6133..0000000 --- a/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php +++ /dev/null @@ -1,45 +0,0 @@ -prefix . $name; - } - - /** - * Checks if the option with the given name exists. - * - * @param string $name Name of the option to check. - * - * @return bool - */ - public function has( string $name ): bool { - return null !== $this->get( $name ); - } - - /** - * Gets the option for the given name. Returns the default value if the value does not exist. - * - * @param string $name Name of the option to get. - * @param mixed $default Default value to return if the value does not exist. - * - * @return mixed - */ - abstract public function get( string $name, $default = null ); -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Transients.php b/src/Dependencies/LaunchpadOptions/Transients.php deleted file mode 100644 index 1baf132..0000000 --- a/src/Dependencies/LaunchpadOptions/Transients.php +++ /dev/null @@ -1,64 +0,0 @@ -prefix = $prefix; - } - - /** - * Gets the transient for the given name. Returns the default value if the value does not exist. - * - * @param string $name Name of the transient to get. - * @param mixed $default Default value to return if the value does not exist. - * - * @return mixed - */ - public function get(string $name, $default = null) - { - $transient = get_transient( $this->get_full_key( $name ), $default ); - - if ( is_array( $default ) && ! is_array( $transient ) ) { - $option = (array) $transient; - } - - return $transient; - } - - /** - * Sets the value of an transient. Update the value if the transient for the given name already exists. - * - * @param string $name Name of the transient to set. - * @param mixed $value Value to set for the transient. - * @param int $expiration Time until expiration in seconds. Default 0 (no expiration). - * - * @return void - */ - public function set(string $name, $value, int $expiration = 0) - { - set_transient( $this->get_full_key( $name ), $value, $expiration ); - } - - /** - * Deletes the transient with the given name. - * - * @param string $name Name of the transient to delete. - * - * @return void - */ - public function delete(string $name) - { - delete_transient( $this->get_full_key( $name ) ); - } -} \ No newline at end of file diff --git a/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php b/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php deleted file mode 100644 index d6cabf4..0000000 --- a/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -getValue(); - } elseif ($argument instanceof ClassNameInterface) { - $id = $argument->getClassName(); - } elseif (!is_string($argument)) { - return $argument; - } else { - $justStringValue = true; - $id = $argument; - } - - $container = null; - - try { - $container = $this->getLeagueContainer(); - } catch (ContainerException $e) { - if ($this instanceof ReflectionContainer) { - $container = $this; - } - } - - if ($container !== null) { - try { - return $container->get($id); - } catch (NotFoundException $exception) { - if ($argument instanceof ClassNameWithOptionalValue) { - return $argument->getOptionalValue(); - } - - if ($justStringValue) { - return $id; - } - - throw $exception; - } - } - - if ($argument instanceof ClassNameWithOptionalValue) { - return $argument->getOptionalValue(); - } - - // Just a string value. - return $id; - }, $arguments); - } - - /** - * {@inheritdoc} - */ - public function reflectArguments(ReflectionFunctionAbstract $method, array $args = []) : array - { - $arguments = array_map(function (ReflectionParameter $param) use ($method, $args) { - $name = $param->getName(); - $type = $param->getType(); - - if (array_key_exists($name, $args)) { - return new RawArgument($args[$name]); - } - - if ($type) { - if (PHP_VERSION_ID >= 70100) { - $typeName = $type->getName(); - } else { - $typeName = (string) $type; - } - - $typeName = ltrim($typeName, '?'); - - if ($param->isDefaultValueAvailable()) { - return new ClassNameWithOptionalValue($typeName, $param->getDefaultValue()); - } - - return new ClassName($typeName); - } - - if ($param->isDefaultValueAvailable()) { - return new RawArgument($param->getDefaultValue()); - } - - throw new NotFoundException(sprintf( - 'Unable to resolve a value for parameter (%s) in the function/method (%s)', - $name, - $method->getName() - )); - }, $method->getParameters()); - - return $this->resolveArguments($arguments); - } - - /** - * @return ContainerInterface - */ - abstract public function getContainer() : ContainerInterface; - - /** - * @return Container - */ - abstract public function getLeagueContainer() : Container; -} diff --git a/src/Dependencies/League/Container/Argument/ClassName.php b/src/Dependencies/League/Container/Argument/ClassName.php deleted file mode 100644 index e283336..0000000 --- a/src/Dependencies/League/Container/Argument/ClassName.php +++ /dev/null @@ -1,29 +0,0 @@ -value = $value; - } - - /** - * {@inheritdoc} - */ - public function getClassName() : string - { - return $this->value; - } -} diff --git a/src/Dependencies/League/Container/Argument/ClassNameInterface.php b/src/Dependencies/League/Container/Argument/ClassNameInterface.php deleted file mode 100644 index 2e26f78..0000000 --- a/src/Dependencies/League/Container/Argument/ClassNameInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -className = $className; - $this->optionalValue = $optionalValue; - } - - /** - * @inheritDoc - */ - public function getClassName(): string - { - return $this->className; - } - - public function getOptionalValue() - { - return $this->optionalValue; - } -} diff --git a/src/Dependencies/League/Container/Argument/RawArgument.php b/src/Dependencies/League/Container/Argument/RawArgument.php deleted file mode 100644 index 6c4a584..0000000 --- a/src/Dependencies/League/Container/Argument/RawArgument.php +++ /dev/null @@ -1,29 +0,0 @@ -value = $value; - } - - /** - * {@inheritdoc} - */ - public function getValue() - { - return $this->value; - } -} diff --git a/src/Dependencies/League/Container/Argument/RawArgumentInterface.php b/src/Dependencies/League/Container/Argument/RawArgumentInterface.php deleted file mode 100644 index d81c312..0000000 --- a/src/Dependencies/League/Container/Argument/RawArgumentInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -definitions = $definitions ?? new DefinitionAggregate; - $this->providers = $providers ?? new ServiceProviderAggregate; - $this->inflectors = $inflectors ?? new InflectorAggregate; - - if ($this->definitions instanceof ContainerAwareInterface) { - $this->definitions->setLeagueContainer($this); - } - - if ($this->providers instanceof ContainerAwareInterface) { - $this->providers->setLeagueContainer($this); - } - - if ($this->inflectors instanceof ContainerAwareInterface) { - $this->inflectors->setLeagueContainer($this); - } - } - - /** - * Add an item to the container. - * - * @param string $id - * @param mixed $concrete - * @param boolean $shared - * - * @return DefinitionInterface - */ - public function add(string $id, $concrete = null, bool $shared = null) : DefinitionInterface - { - $concrete = $concrete ?? $id; - $shared = $shared ?? $this->defaultToShared; - - return $this->definitions->add($id, $concrete, $shared); - } - - /** - * Proxy to add with shared as true. - * - * @param string $id - * @param mixed $concrete - * - * @return DefinitionInterface - */ - public function share(string $id, $concrete = null) : DefinitionInterface - { - return $this->add($id, $concrete, true); - } - - /** - * Whether the container should default to defining shared definitions. - * - * @param boolean $shared - * - * @return self - */ - public function defaultToShared(bool $shared = true) : ContainerInterface - { - $this->defaultToShared = $shared; - - return $this; - } - - /** - * Get a definition to extend. - * - * @param string $id [description] - * - * @return DefinitionInterface - */ - public function extend(string $id) : DefinitionInterface - { - if ($this->providers->provides($id)) { - $this->providers->register($id); - } - - if ($this->definitions->has($id)) { - return $this->definitions->getDefinition($id); - } - - throw new NotFoundException( - sprintf('Unable to extend alias (%s) as it is not being managed as a definition', $id) - ); - } - - /** - * Add a service provider. - * - * @param ServiceProviderInterface|string $provider - * - * @return self - */ - public function addServiceProvider($provider) : self - { - $this->providers->add($provider); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function get($id, bool $new = false) - { - if ($this->definitions->has($id)) { - $resolved = $this->definitions->resolve($id, $new); - return $this->inflectors->inflect($resolved); - } - - if ($this->definitions->hasTag($id)) { - $arrayOf = $this->definitions->resolveTagged($id, $new); - - array_walk($arrayOf, function (&$resolved) { - $resolved = $this->inflectors->inflect($resolved); - }); - - return $arrayOf; - } - - if ($this->providers->provides($id)) { - $this->providers->register($id); - - if (!$this->definitions->has($id) && !$this->definitions->hasTag($id)) { - throw new ContainerException(sprintf('Service provider lied about providing (%s) service', $id)); - } - - return $this->get($id, $new); - } - - foreach ($this->delegates as $delegate) { - if ($delegate->has($id)) { - $resolved = $delegate->get($id); - return $this->inflectors->inflect($resolved); - } - } - - throw new NotFoundException(sprintf('Alias (%s) is not being managed by the container or delegates', $id)); - } - - /** - * {@inheritdoc} - */ - public function has($id) - { - if ($this->definitions->has($id)) { - return true; - } - - if ($this->definitions->hasTag($id)) { - return true; - } - - if ($this->providers->provides($id)) { - return true; - } - - foreach ($this->delegates as $delegate) { - if ($delegate->has($id)) { - return true; - } - } - - return false; - } - - /** - * Allows for manipulation of specific types on resolution. - * - * @param string $type - * @param callable|null $callback - * - * @return InflectorInterface - */ - public function inflector(string $type, callable $callback = null) : InflectorInterface - { - return $this->inflectors->add($type, $callback); - } - - /** - * Delegate a backup container to be checked for services if it - * cannot be resolved via this container. - * - * @param ContainerInterface $container - * - * @return self - */ - public function delegate(ContainerInterface $container) : self - { - $this->delegates[] = $container; - - if ($container instanceof ContainerAwareInterface) { - $container->setLeagueContainer($this); - } - - return $this; - } -} diff --git a/src/Dependencies/League/Container/ContainerAwareInterface.php b/src/Dependencies/League/Container/ContainerAwareInterface.php deleted file mode 100644 index 8a9f8a6..0000000 --- a/src/Dependencies/League/Container/ContainerAwareInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -container = $container; - - return $this; - } - - /** - * Get the container. - * - * @return ContainerInterface - */ - public function getContainer() : ContainerInterface - { - if ($this->container instanceof ContainerInterface) { - return $this->container; - } - - throw new ContainerException('No container implementation has been set.'); - } - - /** - * Set a container. - * - * @param Container $container - * - * @return self - */ - public function setLeagueContainer(Container $container) : ContainerAwareInterface - { - $this->container = $container; - $this->leagueContainer = $container; - - return $this; - } - - /** - * Get the container. - * - * @return Container - */ - public function getLeagueContainer() : Container - { - if ($this->leagueContainer instanceof Container) { - return $this->leagueContainer; - } - - throw new ContainerException('No container implementation has been set.'); - } -} diff --git a/src/Dependencies/League/Container/Definition/Definition.php b/src/Dependencies/League/Container/Definition/Definition.php deleted file mode 100644 index ff5c0c7..0000000 --- a/src/Dependencies/League/Container/Definition/Definition.php +++ /dev/null @@ -1,278 +0,0 @@ -alias = $id; - $this->concrete = $concrete; - } - - /** - * {@inheritdoc} - */ - public function addTag(string $tag) : DefinitionInterface - { - $this->tags[$tag] = true; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasTag(string $tag) : bool - { - return isset($this->tags[$tag]); - } - - /** - * {@inheritdoc} - */ - public function setAlias(string $id) : DefinitionInterface - { - $this->alias = $id; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getAlias() : string - { - return $this->alias; - } - - /** - * {@inheritdoc} - */ - public function setShared(bool $shared = true) : DefinitionInterface - { - $this->shared = $shared; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function isShared() : bool - { - return $this->shared; - } - - /** - * {@inheritdoc} - */ - public function getConcrete() - { - return $this->concrete; - } - - /** - * {@inheritdoc} - */ - public function setConcrete($concrete) : DefinitionInterface - { - $this->concrete = $concrete; - $this->resolved = null; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addArgument($arg) : DefinitionInterface - { - $this->arguments[] = $arg; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addArguments(array $args) : DefinitionInterface - { - foreach ($args as $arg) { - $this->addArgument($arg); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addMethodCall(string $method, array $args = []) : DefinitionInterface - { - $this->methods[] = [ - 'method' => $method, - 'arguments' => $args - ]; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addMethodCalls(array $methods = []) : DefinitionInterface - { - foreach ($methods as $method => $args) { - $this->addMethodCall($method, $args); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function resolve(bool $new = false) - { - $concrete = $this->concrete; - - if ($this->isShared() && $this->resolved !== null && $new === false) { - return $this->resolved; - } - - if (is_callable($concrete)) { - $concrete = $this->resolveCallable($concrete); - } - - if ($concrete instanceof RawArgumentInterface) { - $this->resolved = $concrete->getValue(); - - return $concrete->getValue(); - } - - if ($concrete instanceof ClassNameInterface) { - $concrete = $concrete->getClassName(); - } - - if (is_string($concrete) && class_exists($concrete)) { - $concrete = $this->resolveClass($concrete); - } - - if (is_object($concrete)) { - $concrete = $this->invokeMethods($concrete); - } - - if (is_string($concrete) && $this->getContainer()->has($concrete)) { - $concrete = $this->getContainer()->get($concrete); - } - - $this->resolved = $concrete; - - return $concrete; - } - - /** - * Resolve a callable. - * - * @param callable $concrete - * - * @return mixed - */ - protected function resolveCallable(callable $concrete) - { - $resolved = $this->resolveArguments($this->arguments); - - return call_user_func_array($concrete, $resolved); - } - - /** - * Resolve a class. - * - * @param string $concrete - * - * @return object - * - * @throws ReflectionException - */ - protected function resolveClass(string $concrete) - { - $resolved = $this->resolveArguments($this->arguments); - $reflection = new ReflectionClass($concrete); - - return $reflection->newInstanceArgs($resolved); - } - - /** - * Invoke methods on resolved instance. - * - * @param object $instance - * - * @return object - */ - protected function invokeMethods($instance) - { - foreach ($this->methods as $method) { - $args = $this->resolveArguments($method['arguments']); - - /** @var callable $callable */ - $callable = [$instance, $method['method']]; - call_user_func_array($callable, $args); - } - - return $instance; - } -} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregate.php b/src/Dependencies/League/Container/Definition/DefinitionAggregate.php deleted file mode 100644 index 73e1d4b..0000000 --- a/src/Dependencies/League/Container/Definition/DefinitionAggregate.php +++ /dev/null @@ -1,124 +0,0 @@ -definitions = array_filter($definitions, function ($definition) { - return ($definition instanceof DefinitionInterface); - }); - } - - /** - * {@inheritdoc} - */ - public function add(string $id, $definition, bool $shared = false) : DefinitionInterface - { - if (!$definition instanceof DefinitionInterface) { - $definition = new Definition($id, $definition); - } - - $this->definitions[] = $definition - ->setAlias($id) - ->setShared($shared) - ; - - return $definition; - } - - /** - * {@inheritdoc} - */ - public function has(string $id) : bool - { - foreach ($this->getIterator() as $definition) { - if ($id === $definition->getAlias()) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function hasTag(string $tag) : bool - { - foreach ($this->getIterator() as $definition) { - if ($definition->hasTag($tag)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getDefinition(string $id) : DefinitionInterface - { - foreach ($this->getIterator() as $definition) { - if ($id === $definition->getAlias()) { - return $definition->setLeagueContainer($this->getLeagueContainer()); - } - } - - throw new NotFoundException(sprintf('Alias (%s) is not being handled as a definition.', $id)); - } - - /** - * {@inheritdoc} - */ - public function resolve(string $id, bool $new = false) - { - return $this->getDefinition($id)->resolve($new); - } - - /** - * {@inheritdoc} - */ - public function resolveTagged(string $tag, bool $new = false) : array - { - $arrayOf = []; - - foreach ($this->getIterator() as $definition) { - if ($definition->hasTag($tag)) { - $arrayOf[] = $definition->setLeagueContainer($this->getLeagueContainer())->resolve($new); - } - } - - return $arrayOf; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->definitions); - - for ($i = 0; $i < $count; $i++) { - yield $this->definitions[$i]; - } - } -} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php b/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php deleted file mode 100644 index 7069f2f..0000000 --- a/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php +++ /dev/null @@ -1,67 +0,0 @@ -type = $type; - $this->callback = $callback; - } - - /** - * {@inheritdoc} - */ - public function getType() : string - { - return $this->type; - } - - /** - * {@inheritdoc} - */ - public function invokeMethod(string $name, array $args) : InflectorInterface - { - $this->methods[$name] = $args; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function invokeMethods(array $methods) : InflectorInterface - { - foreach ($methods as $name => $args) { - $this->invokeMethod($name, $args); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setProperty(string $property, $value) : InflectorInterface - { - $this->properties[$property] = $this->resolveArguments([$value])[0]; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setProperties(array $properties) : InflectorInterface - { - foreach ($properties as $property => $value) { - $this->setProperty($property, $value); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function inflect($object) - { - $properties = $this->resolveArguments(array_values($this->properties)); - $properties = array_combine(array_keys($this->properties), $properties); - - // array_combine() can technically return false - foreach ($properties ?: [] as $property => $value) { - $object->{$property} = $value; - } - - foreach ($this->methods as $method => $args) { - $args = $this->resolveArguments($args); - - /** @var callable $callable */ - $callable = [$object, $method]; - call_user_func_array($callable, $args); - } - - if ($this->callback !== null) { - call_user_func($this->callback, $object); - } - } -} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregate.php b/src/Dependencies/League/Container/Inflector/InflectorAggregate.php deleted file mode 100644 index 644668e..0000000 --- a/src/Dependencies/League/Container/Inflector/InflectorAggregate.php +++ /dev/null @@ -1,58 +0,0 @@ -inflectors[] = $inflector; - - return $inflector; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->inflectors); - - for ($i = 0; $i < $count; $i++) { - yield $this->inflectors[$i]; - } - } - - /** - * {@inheritdoc} - */ - public function inflect($object) - { - foreach ($this->getIterator() as $inflector) { - $type = $inflector->getType(); - - if (! $object instanceof $type) { - continue; - } - - $inflector->setLeagueContainer($this->getLeagueContainer()); - $inflector->inflect($object); - } - - return $object; - } -} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php b/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php deleted file mode 100644 index 7309e01..0000000 --- a/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -cacheResolutions === true && array_key_exists($id, $this->cache)) { - return $this->cache[$id]; - } - - if (! $this->has($id)) { - throw new NotFoundException( - sprintf('Alias (%s) is not an existing class and therefore cannot be resolved', $id) - ); - } - - $reflector = new ReflectionClass($id); - $construct = $reflector->getConstructor(); - - if ($construct && !$construct->isPublic()) { - throw new NotFoundException( - sprintf('Alias (%s) has a non-public constructor and therefore cannot be instantiated', $id) - ); - } - - $resolution = $construct === null - ? new $id - : $resolution = $reflector->newInstanceArgs($this->reflectArguments($construct, $args)) - ; - - if ($this->cacheResolutions === true) { - $this->cache[$id] = $resolution; - } - - return $resolution; - } - - /** - * {@inheritdoc} - */ - public function has($id) - { - return class_exists($id); - } - - /** - * Invoke a callable via the container. - * - * @param callable $callable - * @param array $args - * - * @return mixed - * - * @throws ReflectionException - */ - public function call(callable $callable, array $args = []) - { - if (is_string($callable) && strpos($callable, '::') !== false) { - $callable = explode('::', $callable); - } - - if (is_array($callable)) { - if (is_string($callable[0])) { - $callable[0] = $this->getContainer()->get($callable[0]); - } - - $reflection = new ReflectionMethod($callable[0], $callable[1]); - - if ($reflection->isStatic()) { - $callable[0] = null; - } - - return $reflection->invokeArgs($callable[0], $this->reflectArguments($reflection, $args)); - } - - if (is_object($callable)) { - $reflection = new ReflectionMethod($callable, '__invoke'); - - return $reflection->invokeArgs($callable, $this->reflectArguments($reflection, $args)); - } - - $reflection = new ReflectionFunction(\Closure::fromCallable($callable)); - - return $reflection->invokeArgs($this->reflectArguments($reflection, $args)); - } - - /** - * Whether the container should default to caching resolutions and returning - * the cache on following calls. - * - * @param boolean $option - * - * @return self - */ - public function cacheResolutions(bool $option = true) : ContainerInterface - { - $this->cacheResolutions = $option; - - return $this; - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php b/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php deleted file mode 100644 index 1b356af..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php +++ /dev/null @@ -1,46 +0,0 @@ -provides, true); - } - - /** - * {@inheritdoc} - */ - public function setIdentifier(string $id) : ServiceProviderInterface - { - $this->identifier = $id; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getIdentifier() : string - { - return $this->identifier ?? get_class($this); - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php b/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php deleted file mode 100644 index 895f4be..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -getContainer()->has($provider)) { - $provider = $this->getContainer()->get($provider); - } elseif (is_string($provider) && class_exists($provider)) { - $provider = new $provider; - } - - if (in_array($provider, $this->providers, true)) { - return $this; - } - - if ($provider instanceof ContainerAwareInterface) { - $provider->setLeagueContainer($this->getLeagueContainer()); - } - - if ($provider instanceof BootableServiceProviderInterface) { - $provider->boot(); - } - - if ($provider instanceof ServiceProviderInterface) { - $this->providers[] = $provider; - - return $this; - } - - throw new ContainerException( - 'A service provider must be a fully qualified class name or instance ' . - 'of (\RocketCDN\Dependencies\League\Container\ServiceProvider\ServiceProviderInterface)' - ); - } - - /** - * {@inheritdoc} - */ - public function provides(string $service) : bool - { - foreach ($this->getIterator() as $provider) { - if ($provider->provides($service)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->providers); - - for ($i = 0; $i < $count; $i++) { - yield $this->providers[$i]; - } - } - - /** - * {@inheritdoc} - */ - public function register(string $service) - { - if (false === $this->provides($service)) { - throw new ContainerException( - sprintf('(%s) is not provided by a service provider', $service) - ); - } - - foreach ($this->getIterator() as $provider) { - if (in_array($provider->getIdentifier(), $this->registered, true)) { - continue; - } - - if ($provider->provides($service)) { - $this->registered[] = $provider->getIdentifier(); - $provider->register(); - } - } - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php b/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php deleted file mode 100644 index a0eb57e..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php +++ /dev/null @@ -1,36 +0,0 @@ -leagueContainer property or the `getLeagueContainer` method - * from the ContainerAwareTrait. - * - * @return void - */ - public function register(); - - /** - * Set a custom id for the service provider. This enables - * registering the same service provider multiple times. - * - * @param string $id - * - * @return self - */ - public function setIdentifier(string $id) : ServiceProviderInterface; - - /** - * The id of the service provider uniquely identifies it, so - * that we can quickly determine if it has already been registered. - * Defaults to get_class($provider). - * - * @return string - */ - public function getIdentifier() : string; -} diff --git a/src/Dependencies/Psr/Container/ContainerExceptionInterface.php b/src/Dependencies/Psr/Container/ContainerExceptionInterface.php deleted file mode 100644 index c0ddbc0..0000000 --- a/src/Dependencies/Psr/Container/ContainerExceptionInterface.php +++ /dev/null @@ -1,12 +0,0 @@ - Date: Thu, 4 Jul 2024 09:48:02 +0200 Subject: [PATCH 16/40] Added deploy script updated --- .github/workflows/deploy-tag.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-tag.yml b/.github/workflows/deploy-tag.yml index 1ceeb23..e3c11f7 100644 --- a/.github/workflows/deploy-tag.yml +++ b/.github/workflows/deploy-tag.yml @@ -11,6 +11,8 @@ jobs: - uses: actions/checkout@master - name: remove installers run: composer remove composer/installers + - name: regular build + run: composer install - name: optimized build run: composer install -o --no-dev --no-scripts - name: WordPress Plugin Deploy From 376aa5d13fcc5195414adb7373360b0f8c15b2ef Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Fri, 5 Jul 2024 09:41:03 +0200 Subject: [PATCH 17/40] Added a fix for undefined constant when clearing the cache --- src/Admin/AdminBar/AdminBar.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Admin/AdminBar/AdminBar.php b/src/Admin/AdminBar/AdminBar.php index 132044a..2e982db 100644 --- a/src/Admin/AdminBar/AdminBar.php +++ b/src/Admin/AdminBar/AdminBar.php @@ -6,7 +6,6 @@ use RocketCDN\API\Client; use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; -use RocketCDN\Options\Options; class AdminBar implements OptionsAwareInterface { use OptionsAwareTrait; @@ -166,7 +165,7 @@ public function purge_cache() { * @return void */ protected function exit() { - WP_ROCKET_CDN_IS_TESTING ? wp_die() : exit; + defined('WP_ROCKET_CDN_IS_TESTING') && constant('WP_ROCKET_CDN_IS_TESTING') ? wp_die() : exit; } /** From dc4d6c1f6e8599e8e95d4f6aeb5661095783fdbf Mon Sep 17 00:00:00 2001 From: Cyrille C <18537428+CrochetFeve0251@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:10:49 +0200 Subject: [PATCH 18/40] Update readme.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rémy Perona --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 6fe510d..7525273 100644 --- a/readme.txt +++ b/readme.txt @@ -208,7 +208,7 @@ You can report any security bugs found in the source code of the site-reviews pl == Changelog == -= 1.0.5 = += 1.0.6 = - Launchpad framework integration = 1.0.5 = From ea9b48975410f203624e57912bf596e1dd5b2455 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Fri, 5 Jul 2024 13:12:31 +0200 Subject: [PATCH 19/40] Fixed linter --- src/Admin/AdminBar/AdminBar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Admin/AdminBar/AdminBar.php b/src/Admin/AdminBar/AdminBar.php index 2e982db..f023edb 100644 --- a/src/Admin/AdminBar/AdminBar.php +++ b/src/Admin/AdminBar/AdminBar.php @@ -165,7 +165,7 @@ public function purge_cache() { * @return void */ protected function exit() { - defined('WP_ROCKET_CDN_IS_TESTING') && constant('WP_ROCKET_CDN_IS_TESTING') ? wp_die() : exit; + defined( 'WP_ROCKET_CDN_IS_TESTING' ) && constant( 'WP_ROCKET_CDN_IS_TESTING' ) ? wp_die() : exit; } /** From 5fa0c53a2665a7e28584ceb551d6e0a69067ec2f Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Tue, 23 Jul 2024 15:12:59 +0200 Subject: [PATCH 20/40] Fixed tests --- tests/Fixtures/src/Front/CDN/rewriteUrl.php | 14 ++++++++++---- tests/Unit/src/Front/CDN/rewriteUrl.php | 9 ++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/Fixtures/src/Front/CDN/rewriteUrl.php b/tests/Fixtures/src/Front/CDN/rewriteUrl.php index 4841bb6..a412a87 100644 --- a/tests/Fixtures/src/Front/CDN/rewriteUrl.php +++ b/tests/Fixtures/src/Front/CDN/rewriteUrl.php @@ -3,6 +3,7 @@ 'testNoCdnShouldReturnUrl' => [ 'config' => [ 'homeurl' => 'http://example.org', + 'admin_url' => 'http://example.org/wp-admin/', 'host' => 'example.org', 'cdn' => null, 'url' => 'http://example.org/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', @@ -16,6 +17,7 @@ 'testCdnShouldReturnUrlWithCdn' => [ 'config' => [ 'homeurl' => 'http://example.org', + 'admin_url' => 'http://example.org/wp-admin/', 'host' => 'example.org', 'url' => 'http://example.org/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', 'cdn' => 'cdn', @@ -29,6 +31,7 @@ 'testCdnNoHostShouldReturnUrlWithCdn' => [ 'config' => [ 'homeurl' => 'http://example.org', + 'admin_url' => 'http://example.org/wp-admin/', 'host' => 'example.org', 'url' => '/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', 'cdn' => 'cdn', @@ -36,16 +39,19 @@ ], 'expected' => 'cdn/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', ], - 'testCdnNoSchemeShouldReturnUrlWithCdn' => [ +'testCdnAndAdminShouldReturnNotUrlWithCdn' => [ 'config' => [ + 'is_admin' => true, 'homeurl' => 'http://example.org', + 'admin_url' => 'http://example.org/wp-admin/', 'host' => 'example.org', - 'url' => 'example.org/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', + 'url' => 'http://example.org/wp-admin/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', 'cdn' => 'cdn', 'parsed_url' => [ - 'host' => 'example.org', + 'host' => 'example.org', + 'scheme' => 'http', ], ], - 'expected' => 'cdn/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', + 'expected' => 'http://example.org/wp-admin/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', ], ]; diff --git a/tests/Unit/src/Front/CDN/rewriteUrl.php b/tests/Unit/src/Front/CDN/rewriteUrl.php index 8b50313..ba41142 100644 --- a/tests/Unit/src/Front/CDN/rewriteUrl.php +++ b/tests/Unit/src/Front/CDN/rewriteUrl.php @@ -30,12 +30,19 @@ protected function setUp(): void { * @dataProvider configTestData */ public function testShouldReturnExpected( $config, $expected ) { - $this->options->expects()->get( 'cdn_url' )->andReturn( $config['cdn'] ); + + if( ! key_exists('is_admin', $config) || ! $config['is_admin']) { + $this->options->expects()->get( 'cdn_url' )->andReturn( $config['cdn'] ); + } Functions\expect( 'home_url' ) ->with() ->andReturn( $config['homeurl'] ); + Functions\expect( 'admin_url' ) + ->with() + ->andReturn( $config['admin_url'] ); + Functions\expect( 'wp_parse_url' ) ->with( $config['url'] )->andReturnUsing( function( $arg1, $arg2 = null ) use ( $config ) { From 0e447024f623a5daa5f927205b65cfb485db4e9b Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 15 May 2024 15:59:22 +0200 Subject: [PATCH 21/40] Added launchpad --- .gitignore | 2 +- composer.json | 8 +- composer.lock | 248 +++++++++++++--- configs/parameters.php | 10 + configs/providers.php | 10 + includes/main.php | 15 - rocketcdn.php | 6 +- src/API/Client.php | 23 +- src/API/ServiceProvider.php | 24 +- src/Admin/AdminBar/AdminBar.php | 15 +- src/Admin/AdminBar/ServiceProvider.php | 52 ++-- src/Admin/Notices/Notices.php | 15 +- src/Admin/Notices/ServiceProvider.php | 49 ++- src/Admin/Settings/Page.php | 16 +- src/Admin/Settings/ServiceProvider.php | 54 ++-- .../Argument/ArgumentResolverInterface.php | 28 -- .../Argument/ArgumentResolverTrait.php | 120 -------- .../League/Container/Argument/ClassName.php | 29 -- .../Container/Argument/ClassNameInterface.php | 13 - .../Argument/ClassNameWithOptionalValue.php | 39 --- .../League/Container/Argument/RawArgument.php | 29 -- .../Argument/RawArgumentInterface.php | 13 - .../League/Container/Container.php | 248 ---------------- .../Container/ContainerAwareInterface.php | 40 --- .../League/Container/ContainerAwareTrait.php | 76 ----- .../Container/Definition/Definition.php | 278 ------------------ .../Definition/DefinitionAggregate.php | 124 -------- .../DefinitionAggregateInterface.php | 67 ----- .../Definition/DefinitionInterface.php | 120 -------- .../Exception/ContainerException.php | 10 - .../Container/Exception/NotFoundException.php | 10 - .../League/Container/Inflector/Inflector.php | 123 -------- .../Inflector/InflectorAggregate.php | 58 ---- .../Inflector/InflectorAggregateInterface.php | 27 -- .../Inflector/InflectorInterface.php | 60 ---- .../League/Container/ReflectionContainer.php | 131 --------- .../AbstractServiceProvider.php | 46 --- .../BootableServiceProviderInterface.php | 14 - .../ServiceProviderAggregate.php | 106 ------- .../ServiceProviderAggregateInterface.php | 36 --- .../ServiceProviderInterface.php | 46 --- .../Container/ContainerExceptionInterface.php | 13 - .../Psr/Container/ContainerInterface.php | 37 --- .../Container/NotFoundExceptionInterface.php | 13 - src/EventManagement/EventManager.php | 134 --------- src/EventManagement/SubscriberInterface.php | 4 +- src/Front/CDN.php | 22 +- src/Front/ServiceProvider.php | 46 +-- src/Options/AbstractOptions.php | 67 ----- src/Options/Options.php | 59 ---- src/Options/OptionsInterface.php | 56 ---- src/Plugin.php | 128 -------- tests/Integration/AdminTestCase.php | 3 + tests/Integration/AjaxTestCase.php | 13 +- tests/Integration/CapTrait.php | 6 +- .../Admin/AdminBar/Subscriber/purgeCache.php | 6 +- .../Admin/Settings/Subscriber/purgeCache.php | 2 +- .../Settings/Subscriber/validateApiKey.php | 4 +- 58 files changed, 373 insertions(+), 2678 deletions(-) create mode 100644 configs/parameters.php create mode 100644 configs/providers.php delete mode 100644 includes/main.php delete mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php delete mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverTrait.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassName.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassNameInterface.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassNameWithOptionalValue.php delete mode 100644 src/Dependencies/League/Container/Argument/RawArgument.php delete mode 100644 src/Dependencies/League/Container/Argument/RawArgumentInterface.php delete mode 100644 src/Dependencies/League/Container/Container.php delete mode 100644 src/Dependencies/League/Container/ContainerAwareInterface.php delete mode 100644 src/Dependencies/League/Container/ContainerAwareTrait.php delete mode 100644 src/Dependencies/League/Container/Definition/Definition.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregate.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionInterface.php delete mode 100644 src/Dependencies/League/Container/Exception/ContainerException.php delete mode 100644 src/Dependencies/League/Container/Exception/NotFoundException.php delete mode 100644 src/Dependencies/League/Container/Inflector/Inflector.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregate.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorInterface.php delete mode 100644 src/Dependencies/League/Container/ReflectionContainer.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregate.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderInterface.php delete mode 100644 src/Dependencies/Psr/Container/ContainerExceptionInterface.php delete mode 100644 src/Dependencies/Psr/Container/ContainerInterface.php delete mode 100644 src/Dependencies/Psr/Container/NotFoundExceptionInterface.php delete mode 100644 src/EventManagement/EventManager.php delete mode 100644 src/Options/AbstractOptions.php delete mode 100644 src/Options/Options.php delete mode 100644 src/Options/OptionsInterface.php delete mode 100644 src/Plugin.php diff --git a/.gitignore b/.gitignore index a67d42b..8b92a69 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ composer.phar /vendor/ - +src/Dependencies # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file # composer.lock diff --git a/composer.json b/composer.json index d3482ce..5a87708 100644 --- a/composer.json +++ b/composer.json @@ -34,12 +34,13 @@ "league/container": "^3.3", "phpcompatibility/phpcompatibility-wp": "^2.0", "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^7.5 || ^8 || ^9", "phpunit/php-file-iterator": "2.0.3", - "psr/container": "1.0.0", + "phpunit/phpunit": "^7.5 || ^8 || ^9", "roave/security-advisories": "dev-master", "szepeviktor/phpstan-wordpress": "^0.7.0", "wp-coding-standards/wpcs": "^2", + "wp-launchpad/core": "^0.2.6", + "wp-launchpad/framework-options": "^0.1.2", "wp-media/phpunit": "^3.0" }, "autoload": { @@ -59,7 +60,8 @@ "classmap_directory": "/src/classes/dependencies/", "classmap_prefix": "RocketCDN_", "packages": [ - "league/container" + "wp-launchpad/core", + "wp-launchpad/framework-options" ] } }, diff --git a/composer.lock b/composer.lock index e238e2a..054312b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "de9e8a22f5284ea08ba9f758fbdda55c", + "content-hash": "05d14a7ac2d918dedecab2a7125d6243", "packages": [ { "name": "composer/installers", @@ -2116,27 +2116,22 @@ }, { "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/" @@ -2149,7 +2144,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)", @@ -2163,9 +2158,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/master" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2017-02-14T16:28:37+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "roave/security-advisories", @@ -2173,12 +2168,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "386924e51b2e98d13dcc88bb530807046edbda90" + "reference": "8eea9afb8060c8ef05c89f02b123329f43e9ba4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/386924e51b2e98d13dcc88bb530807046edbda90", - "reference": "386924e51b2e98d13dcc88bb530807046edbda90", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/8eea9afb8060c8ef05c89f02b123329f43e9ba4e", + "reference": "8eea9afb8060c8ef05c89f02b123329f43e9ba4e", "shasum": "" }, "conflict": { @@ -2260,7 +2255,7 @@ "chriskacerguis/codeigniter-restserver": "<=2.7.1", "civicrm/civicrm-core": ">=4.2,<4.2.9|>=4.3,<4.3.3", "ckeditor/ckeditor": "<4.24", - "cockpit-hq/cockpit": "<=2.6.3|==2.7", + "cockpit-hq/cockpit": "<2.7|==2.7", "codeception/codeception": "<3.1.3|>=4,<4.1.22", "codeigniter/framework": "<3.1.9", "codeigniter4/framework": "<4.4.7", @@ -2380,7 +2375,7 @@ "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", "friendsoftypo3/openid": ">=4.5,<4.5.31|>=4.7,<4.7.16|>=6,<6.0.11|>=6.1,<6.1.6", "froala/wysiwyg-editor": "<3.2.7|>=4.0.1,<=4.1.3", - "froxlor/froxlor": "<=2.1.1", + "froxlor/froxlor": "<2.1.9", "frozennode/administrator": "<=5.0.12", "fuel/core": "<1.8.1", "funadmin/funadmin": "<=3.2|>=3.3.2,<=3.3.3", @@ -2460,7 +2455,7 @@ "kelvinmo/simplexrd": "<3.1.1", "kevinpapst/kimai2": "<1.16.7", "khodakhah/nodcms": "<=3", - "kimai/kimai": "<2.13", + "kimai/kimai": "<2.16", "kitodo/presentation": "<3.2.3|>=3.3,<3.3.4", "klaviyo/magento2-extension": ">=1,<3", "knplabs/knp-snappy": "<=1.4.2", @@ -2501,7 +2496,7 @@ "magneto/core": "<1.9.4.4-dev", "maikuolan/phpmussel": ">=1,<1.6", "mainwp/mainwp": "<=4.4.3.3", - "mantisbt/mantisbt": "<2.26.1", + "mantisbt/mantisbt": "<2.26.2", "marcwillmann/turn": "<0.3.3", "matyhtf/framework": "<3.0.6", "mautic/core": "<4.4.12|>=5.0.0.0-alpha,<5.0.4", @@ -2586,6 +2581,7 @@ "padraic/humbug_get_contents": "<1.1.2", "pagarme/pagarme-php": "<3", "pagekit/pagekit": "<=1.0.18", + "paragonie/ecc": "<2.0.1", "paragonie/random_compat": "<2", "passbolt/passbolt_api": "<4.6.2", "paypal/adaptivepayments-sdk-php": "<=3.9.2", @@ -2600,6 +2596,7 @@ "personnummer/personnummer": "<3.0.2", "phanan/koel": "<5.1.4", "phenx/php-svg-lib": "<0.5.2", + "php-censor/php-censor": "<2.0.13|>=2.1,<2.1.5", "php-mod/curl": "<2.3.2", "phpbb/phpbb": "<3.2.10|>=3.3,<3.3.1", "phpems/phpems": ">=6,<=6.1.3", @@ -2625,7 +2622,7 @@ "pimcore/demo": "<10.3", "pimcore/ecommerce-framework-bundle": "<1.0.10", "pimcore/perspective-editor": "<1.5.1", - "pimcore/pimcore": "<11.2.3", + "pimcore/pimcore": "<11.1.6.5-dev|>=11.2,<11.2.3", "pixelfed/pixelfed": "<0.11.11", "plotly/plotly.js": "<2.25.2", "pocketmine/bedrock-protocol": "<8.0.2", @@ -2637,7 +2634,7 @@ "prestashop/blockwishlist": ">=2,<2.1.1", "prestashop/contactform": ">=1.0.1,<4.3", "prestashop/gamification": "<2.3.2", - "prestashop/prestashop": "<8.1.4", + "prestashop/prestashop": "<8.1.6", "prestashop/productcomments": "<5.0.2", "prestashop/ps_emailsubscription": "<2.6.1", "prestashop/ps_facetedsearch": "<3.4.1", @@ -2721,6 +2718,7 @@ "socalnick/scn-social-auth": "<1.15.2", "socialiteproviders/steam": "<1.1", "spatie/browsershot": "<3.57.4", + "spatie/image-optimizer": "<1.7.3", "spipu/html2pdf": "<5.2.8", "spoon/library": "<1.4.1", "spoonity/tcpdf": "<6.2.22", @@ -2742,7 +2740,7 @@ "sylius/grid-bundle": "<1.10.1", "sylius/paypal-plugin": ">=1,<1.2.4|>=1.3,<1.3.1", "sylius/resource-bundle": ">=1,<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", - "sylius/sylius": "<=1.12.13", + "sylius/sylius": "<1.12.16|>=1.13.0.0-alpha1,<1.13.1", "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", "symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4", "symbiote/silverstripe-seed": "<6.0.3", @@ -2798,7 +2796,7 @@ "tinymighty/wiki-seo": "<1.2.2", "titon/framework": "<9.9.99", "tobiasbg/tablepress": "<=2.0.0.0-RC1", - "topthink/framework": "<6.0.14", + "topthink/framework": "<6.0.17|>=6.1,<6.1.5|>=8,<8.0.4", "topthink/think": "<=6.1.1", "topthink/thinkphp": "<=3.2.3", "torrentpier/torrentpier": "<=2.4.1", @@ -2809,7 +2807,7 @@ "twig/twig": "<1.44.7|>=2,<2.15.3|>=3,<3.4.3", "typo3/cms": "<9.5.29|>=10,<10.4.35|>=11,<11.5.23|>=12,<12.2", "typo3/cms-backend": "<4.1.14|>=4.2,<4.2.15|>=4.3,<4.3.7|>=4.4,<4.4.4|>=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", - "typo3/cms-core": "<=8.7.56|>=9,<=9.5.45|>=10,<=10.4.42|>=11,<=11.5.34|>=12,<=12.4.10|==13", + "typo3/cms-core": "<=8.7.56|>=9,<=9.5.47|>=10,<=10.4.44|>=11,<=11.5.36|>=12,<=12.4.14|>=13,<=13.1", "typo3/cms-extbase": "<6.2.24|>=7,<7.6.8|==8.1.1", "typo3/cms-fluid": "<4.3.4|>=4.4,<4.4.1", "typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", @@ -2956,7 +2954,7 @@ "type": "tidelift" } ], - "time": "2024-05-06T15:04:21+00:00" + "time": "2024-05-14T22:04:50+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -4471,29 +4469,30 @@ }, { "name": "symfony/service-contracts", - "version": "v2.2.0", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.0" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, - "suggest": { - "symfony/service-implementation": "" + "conflict": { + "ext-psr": "<1.1|>=2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -4503,7 +4502,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4530,7 +4532,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/master" + "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" }, "funding": [ { @@ -4546,7 +4548,7 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/string", @@ -4857,6 +4859,174 @@ }, "time": "2020-05-13T23:57:56+00:00" }, + { + "name": "wp-launchpad/core", + "version": "v0.2.6", + "source": { + "type": "git", + "url": "https://github.com/wp-launchpad/core.git", + "reference": "563ee994bd5d058341368ecd053e7a3145791d26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-launchpad/core/zipball/563ee994bd5d058341368ecd053e7a3145791d26", + "reference": "563ee994bd5d058341368ecd053e7a3145791d26", + "shasum": "" + }, + "require": { + "league/container": "^3.3", + "php": ">=7.1", + "wp-launchpad/dispatcher": "^1.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "phpcompatibility/phpcompatibility-wp": "^2.0", + "phpstan/phpstan": "^1.10", + "szepeviktor/phpstan-wordpress": "^1.3", + "wp-coding-standards/wpcs": "^3", + "wp-launchpad/cli": "^1.0.2", + "wp-launchpad/phpunit-wp-hooks": "^1.0", + "wp-media/phpunit": "^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaunchpadCore\\": "inc/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "CrochetFeve0251" + } + ], + "description": "Core from Launchpad", + "keywords": [ + "wordpress" + ], + "support": { + "issues": "https://github.com/wp-launchpad/core/issues", + "source": "https://github.com/wp-launchpad/core/tree/v0.2.6" + }, + "time": "2024-05-13T10:50:45+00:00" + }, + { + "name": "wp-launchpad/dispatcher", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/wp-launchpad/dispatcher.git", + "reference": "76d6b61c5324f2aa750a86b1acb692723a3b368f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-launchpad/dispatcher/zipball/76d6b61c5324f2aa750a86b1acb692723a3b368f", + "reference": "76d6b61c5324f2aa750a86b1acb692723a3b368f", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "wp-launchpad/cli": "^1.0.2", + "wp-launchpad/phpunit-wp-hooks": "^1.0", + "wp-media/phpunit": "^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaunchpadDispatcher\\": "inc/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "CrochetFeve0251" + } + ], + "description": "Dispatcher library for Launchpad framework", + "keywords": [ + "wordpress" + ], + "support": { + "issues": "https://github.com/wp-launchpad/dispatcher/issues", + "source": "https://github.com/wp-launchpad/dispatcher/tree/v1.0.0" + }, + "time": "2024-04-13T15:05:16+00:00" + }, + { + "name": "wp-launchpad/framework-options", + "version": "v0.1.2", + "source": { + "type": "git", + "url": "https://github.com/wp-launchpad/framework-options.git", + "reference": "0941149bc7ba628a1c4fdf380eeef69969ed5ced" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-launchpad/framework-options/zipball/0941149bc7ba628a1c4fdf380eeef69969ed5ced", + "reference": "0941149bc7ba628a1c4fdf380eeef69969ed5ced", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "wp-launchpad/core": "^0.2.4", + "wp-launchpad/options": "^0.1" + }, + "require-dev": { + "wp-media/phpunit": "^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaunchpadFrameworkOptions\\": "inc/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "description": "Options library for the framework Launchpad", + "support": { + "issues": "https://github.com/wp-launchpad/framework-options/issues", + "source": "https://github.com/wp-launchpad/framework-options/tree/v0.1.2" + }, + "time": "2024-05-09T13:30:49+00:00" + }, + { + "name": "wp-launchpad/options", + "version": "v0.1.2", + "source": { + "type": "git", + "url": "https://github.com/wp-launchpad/options.git", + "reference": "fd55e0a440e819a1bb77d9140491b1c5faf648f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-launchpad/options/zipball/fd55e0a440e819a1bb77d9140491b1c5faf648f6", + "reference": "fd55e0a440e819a1bb77d9140491b1c5faf648f6", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaunchpadOptions\\": "inc/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "description": "Options library for Launchpad", + "support": { + "issues": "https://github.com/wp-launchpad/options/issues", + "source": "https://github.com/wp-launchpad/options/tree/v0.1.2" + }, + "time": "2024-05-09T13:05:37+00:00" + }, { "name": "wp-media/phpunit", "version": "v3.0.3", diff --git a/configs/parameters.php b/configs/parameters.php new file mode 100644 index 0000000..d0c8030 --- /dev/null +++ b/configs/parameters.php @@ -0,0 +1,10 @@ + sanitize_key( 'RocketCDN' ), + 'template_basepath' => realpath( plugin_dir_path( __DIR__ ) ) . '/views/' , + 'assets_baseurl' => plugin_dir_url( __DIR__ ) . 'assets/', + 'is_mu_plugin' => false, + 'translation_key' => 'rocketcdn', + 'prefix' => 'rocketcdn_' +]; \ No newline at end of file diff --git a/configs/providers.php b/configs/providers.php new file mode 100644 index 0000000..6de45fc --- /dev/null +++ b/configs/providers.php @@ -0,0 +1,10 @@ +check() ) { - require realpath( plugin_dir_path( __FILE__ ) ) . '/includes/main.php'; + require __DIR__ . '/src/Dependencies/LaunchpadCore/boot.php'; + + boot( __FILE__ ); } unset( $rocketcdn_rq_check ); diff --git a/src/API/Client.php b/src/API/Client.php index 8976c00..2695dcf 100644 --- a/src/API/Client.php +++ b/src/API/Client.php @@ -3,26 +3,13 @@ namespace RocketCDN\API; -use RocketCDN\Options\Options; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; -class Client { - const ROCKETCDN_API = 'https://rocketcdn.me/api/'; - - /** - * Options instance - * - * @var Options - */ - private $options; +class Client implements OptionsAwareInterface { + use OptionsAwareTrait; - /** - * Instantiate the class - * - * @param Options $options Options instance. - */ - public function __construct( Options $options ) { - $this->options = $options; - } + const ROCKETCDN_API = 'https://rocketcdn.me/api/'; /** * Gets the customer data associated with the API key diff --git a/src/API/ServiceProvider.php b/src/API/ServiceProvider.php index 0de9516..9f5862a 100644 --- a/src/API/ServiceProvider.php +++ b/src/API/ServiceProvider.php @@ -3,25 +3,11 @@ namespace RocketCDN\API; -use RocketCDN\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; class ServiceProvider extends AbstractServiceProvider { - /** - * Services provided by this provider - * - * @var array - */ - protected $provides = [ - 'api_client', - ]; - - /** - * Registers the provided classes - * - * @return void - */ - public function register() { - $this->getContainer()->add( 'api_client', 'RocketCDN\API\Client' ) - ->addArgument( $this->getContainer()->get( 'options' ) ); - } + public function define() { + $this->register_service(Client::class); + } } diff --git a/src/Admin/AdminBar/AdminBar.php b/src/Admin/AdminBar/AdminBar.php index 8510908..a24d795 100644 --- a/src/Admin/AdminBar/AdminBar.php +++ b/src/Admin/AdminBar/AdminBar.php @@ -4,15 +4,12 @@ namespace RocketCDN\Admin\AdminBar; use RocketCDN\API\Client; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; use RocketCDN\Options\Options; -class AdminBar { - /** - * Options instance - * - * @var Options - */ - private $options; +class AdminBar implements OptionsAwareInterface { + use OptionsAwareTrait; /** * API client instance @@ -31,12 +28,10 @@ class AdminBar { /** * Instantiate the class * - * @param Options $options Options instance. * @param Client $api_client API client instance. * @param string $assets_baseurl Assets base URL. */ - public function __construct( Options $options, Client $api_client, $assets_baseurl ) { - $this->options = $options; + public function __construct( Client $api_client, $assets_baseurl ) { $this->api_client = $api_client; $this->assets_baseurl = $assets_baseurl; } diff --git a/src/Admin/AdminBar/ServiceProvider.php b/src/Admin/AdminBar/ServiceProvider.php index 45c1fa3..c50000c 100644 --- a/src/Admin/AdminBar/ServiceProvider.php +++ b/src/Admin/AdminBar/ServiceProvider.php @@ -3,39 +3,29 @@ namespace RocketCDN\Admin\AdminBar; -use RocketCDN\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use RocketCDN\API\Client; +use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; +use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - /** - * Services provided by this provider - * - * @var array - */ - protected $provides = [ - 'admin_bar', - 'admin_bar_subscriber', - ]; + public function get_common_subscribers(): array + { + return [ + \RocketCDN\Admin\AdminBar\Subscriber::class + ]; + } - /** - * Subscribers provided by this provider - * - * @var array - */ - public $subscribers = [ - 'admin_bar_subscriber', - ]; + public function define() { + $this->register_service(AdminBar::class)->set_definition(function (DefinitionInterface $definition) { + $definition->addArguments([ + Client::class, + 'assets_baseurl' + ]); + }); - /** - * Registers the provided classes - * - * @return void - */ - public function register() { - $this->getContainer()->add( 'admin_bar', 'RocketCDN\Admin\AdminBar\AdminBar' ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'api_client' ) ) - ->addArgument( $this->getContainer()->get( 'assets_baseurl' ) ); - $this->getContainer()->add( 'admin_bar_subscriber', 'RocketCDN\Admin\AdminBar\Subscriber' ) - ->addArgument( $this->getContainer()->get( 'admin_bar' ) ); - } + $this->register_service(\RocketCDN\Admin\AdminBar\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument(AdminBar::class); + }); + } } diff --git a/src/Admin/Notices/Notices.php b/src/Admin/Notices/Notices.php index 0b24ea2..0fa916e 100644 --- a/src/Admin/Notices/Notices.php +++ b/src/Admin/Notices/Notices.php @@ -4,15 +4,12 @@ namespace RocketCDN\Admin\Notices; use RocketCDN\API\Client; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; use RocketCDN\Options\Options; -class Notices { - /** - * Options instance - * - * @var Options - */ - private $options; +class Notices implements OptionsAwareInterface { + use OptionsAwareTrait; /** * API client instance @@ -24,11 +21,9 @@ class Notices { /** * Instantiate the class * - * @param Options $options Options instance. * @param Client $api_client API client instance. */ - public function __construct( Options $options, Client $api_client ) { - $this->options = $options; + public function __construct( Client $api_client ) { $this->api_client = $api_client; } diff --git a/src/Admin/Notices/ServiceProvider.php b/src/Admin/Notices/ServiceProvider.php index 377baf6..435ab99 100644 --- a/src/Admin/Notices/ServiceProvider.php +++ b/src/Admin/Notices/ServiceProvider.php @@ -3,38 +3,27 @@ namespace RocketCDN\Admin\Notices; -use RocketCDN\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use RocketCDN\API\Client; +use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; +use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - /** - * Services provided by this provider - * - * @var array - */ - protected $provides = [ - 'admin_notices', - 'admin_notices_subscriber', - ]; - /** - * Subscribers provided by this provider - * - * @var array - */ - public $subscribers = [ - 'admin_notices_subscriber', - ]; + public function get_common_subscribers(): array + { + return [ + \RocketCDN\Admin\Notices\Subscriber::class + ]; + } - /** - * Registers the provided classes - * - * @return void - */ - public function register() { - $this->getContainer()->add( 'admin_notices', 'RocketCDN\Admin\Notices\Notices' ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'api_client' ) ); - $this->getContainer()->add( 'admin_notices_subscriber', 'RocketCDN\Admin\Notices\Subscriber' ) - ->addArgument( $this->getContainer()->get( 'admin_notices' ) ); - } + public function define() { + $this->register_service(Notices::class)->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument(Client::class); + }); + + $this->register_service(\RocketCDN\Admin\Notices\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument(Notices::class); + }); + } } diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 1ce0390..ef73642 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -3,16 +3,14 @@ namespace RocketCDN\Admin\Settings; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; use RocketCDN\Options\Options; use RocketCDN\API\Client; -class Page { - /** - * Options instance - * - * @var Options - */ - private $options; +class Page implements OptionsAwareInterface { + + use OptionsAwareTrait; /** * API Client instance @@ -38,13 +36,11 @@ class Page { /** * Instantiates the class * - * @param Options $options Options instance. * @param Client $api_client API Client instance. * @param string $template_basepath Base filepath for the template. * @param string $assets_baseurl Base URL for the assets. */ - public function __construct( Options $options, Client $api_client, $template_basepath, $assets_baseurl ) { - $this->options = $options; + public function __construct( Client $api_client, $template_basepath, $assets_baseurl ) { $this->api_client = $api_client; $this->template_basepath = $template_basepath; $this->assets_baseurl = $assets_baseurl; diff --git a/src/Admin/Settings/ServiceProvider.php b/src/Admin/Settings/ServiceProvider.php index e683af9..bb829c7 100644 --- a/src/Admin/Settings/ServiceProvider.php +++ b/src/Admin/Settings/ServiceProvider.php @@ -3,40 +3,30 @@ namespace RocketCDN\Admin\Settings; -use RocketCDN\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use RocketCDN\API\Client; +use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; +use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - /** - * Services provided by this provider - * - * @var array - */ - protected $provides = [ - 'admin_page', - 'admin_subscriber', - ]; + public function get_common_subscribers(): array + { + return [ + \RocketCDN\Admin\Settings\Subscriber::class + ]; + } - /** - * Subscribers provided by this provider - * - * @var array - */ - public $subscribers = [ - 'admin_subscriber', - ]; + public function define() { + $this->register_service(Page::class)->set_definition(function (DefinitionInterface $definition) { + $definition->addArguments([ + Client::class, + 'template_basepath', + 'assets_baseurl', + ]); + }); - /** - * Registers the provided classes - * - * @return void - */ - public function register() { - $this->getContainer()->add( 'admin_page', 'RocketCDN\Admin\Settings\Page' ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'api_client' ) ) - ->addArgument( $this->getContainer()->get( 'template_basepath' ) ) - ->addArgument( $this->getContainer()->get( 'assets_baseurl' ) ); - $this->getContainer()->add( 'admin_subscriber', 'RocketCDN\Admin\Settings\Subscriber' ) - ->addArgument( $this->getContainer()->get( 'admin_page' ) ); - } + $this->register_service(\RocketCDN\Admin\Settings\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument(Page::class); + }); + } } diff --git a/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php b/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php deleted file mode 100644 index d6cabf4..0000000 --- a/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -getValue(); - } elseif ($argument instanceof ClassNameInterface) { - $id = $argument->getClassName(); - } elseif (!is_string($argument)) { - return $argument; - } else { - $justStringValue = true; - $id = $argument; - } - - $container = null; - - try { - $container = $this->getLeagueContainer(); - } catch (ContainerException $e) { - if ($this instanceof ReflectionContainer) { - $container = $this; - } - } - - if ($container !== null) { - try { - return $container->get($id); - } catch (NotFoundException $exception) { - if ($argument instanceof ClassNameWithOptionalValue) { - return $argument->getOptionalValue(); - } - - if ($justStringValue) { - return $id; - } - - throw $exception; - } - } - - if ($argument instanceof ClassNameWithOptionalValue) { - return $argument->getOptionalValue(); - } - - // Just a string value. - return $id; - }, $arguments); - } - - /** - * {@inheritdoc} - */ - public function reflectArguments(ReflectionFunctionAbstract $method, array $args = []) : array - { - $arguments = array_map(function (ReflectionParameter $param) use ($method, $args) { - $name = $param->getName(); - $type = $param->getType(); - - if (array_key_exists($name, $args)) { - return new RawArgument($args[$name]); - } - - if ($type) { - if (PHP_VERSION_ID >= 70100) { - $typeName = $type->getName(); - } else { - $typeName = (string) $type; - } - - $typeName = ltrim($typeName, '?'); - - if ($param->isDefaultValueAvailable()) { - return new ClassNameWithOptionalValue($typeName, $param->getDefaultValue()); - } - - return new ClassName($typeName); - } - - if ($param->isDefaultValueAvailable()) { - return new RawArgument($param->getDefaultValue()); - } - - throw new NotFoundException(sprintf( - 'Unable to resolve a value for parameter (%s) in the function/method (%s)', - $name, - $method->getName() - )); - }, $method->getParameters()); - - return $this->resolveArguments($arguments); - } - - /** - * @return ContainerInterface - */ - abstract public function getContainer() : ContainerInterface; - - /** - * @return Container - */ - abstract public function getLeagueContainer() : Container; -} diff --git a/src/Dependencies/League/Container/Argument/ClassName.php b/src/Dependencies/League/Container/Argument/ClassName.php deleted file mode 100644 index e283336..0000000 --- a/src/Dependencies/League/Container/Argument/ClassName.php +++ /dev/null @@ -1,29 +0,0 @@ -value = $value; - } - - /** - * {@inheritdoc} - */ - public function getClassName() : string - { - return $this->value; - } -} diff --git a/src/Dependencies/League/Container/Argument/ClassNameInterface.php b/src/Dependencies/League/Container/Argument/ClassNameInterface.php deleted file mode 100644 index 2e26f78..0000000 --- a/src/Dependencies/League/Container/Argument/ClassNameInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -className = $className; - $this->optionalValue = $optionalValue; - } - - /** - * @inheritDoc - */ - public function getClassName(): string - { - return $this->className; - } - - public function getOptionalValue() - { - return $this->optionalValue; - } -} diff --git a/src/Dependencies/League/Container/Argument/RawArgument.php b/src/Dependencies/League/Container/Argument/RawArgument.php deleted file mode 100644 index 6c4a584..0000000 --- a/src/Dependencies/League/Container/Argument/RawArgument.php +++ /dev/null @@ -1,29 +0,0 @@ -value = $value; - } - - /** - * {@inheritdoc} - */ - public function getValue() - { - return $this->value; - } -} diff --git a/src/Dependencies/League/Container/Argument/RawArgumentInterface.php b/src/Dependencies/League/Container/Argument/RawArgumentInterface.php deleted file mode 100644 index d81c312..0000000 --- a/src/Dependencies/League/Container/Argument/RawArgumentInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -definitions = $definitions ?? new DefinitionAggregate; - $this->providers = $providers ?? new ServiceProviderAggregate; - $this->inflectors = $inflectors ?? new InflectorAggregate; - - if ($this->definitions instanceof ContainerAwareInterface) { - $this->definitions->setLeagueContainer($this); - } - - if ($this->providers instanceof ContainerAwareInterface) { - $this->providers->setLeagueContainer($this); - } - - if ($this->inflectors instanceof ContainerAwareInterface) { - $this->inflectors->setLeagueContainer($this); - } - } - - /** - * Add an item to the container. - * - * @param string $id - * @param mixed $concrete - * @param boolean $shared - * - * @return DefinitionInterface - */ - public function add(string $id, $concrete = null, bool $shared = null) : DefinitionInterface - { - $concrete = $concrete ?? $id; - $shared = $shared ?? $this->defaultToShared; - - return $this->definitions->add($id, $concrete, $shared); - } - - /** - * Proxy to add with shared as true. - * - * @param string $id - * @param mixed $concrete - * - * @return DefinitionInterface - */ - public function share(string $id, $concrete = null) : DefinitionInterface - { - return $this->add($id, $concrete, true); - } - - /** - * Whether the container should default to defining shared definitions. - * - * @param boolean $shared - * - * @return self - */ - public function defaultToShared(bool $shared = true) : ContainerInterface - { - $this->defaultToShared = $shared; - - return $this; - } - - /** - * Get a definition to extend. - * - * @param string $id [description] - * - * @return DefinitionInterface - */ - public function extend(string $id) : DefinitionInterface - { - if ($this->providers->provides($id)) { - $this->providers->register($id); - } - - if ($this->definitions->has($id)) { - return $this->definitions->getDefinition($id); - } - - throw new NotFoundException( - sprintf('Unable to extend alias (%s) as it is not being managed as a definition', $id) - ); - } - - /** - * Add a service provider. - * - * @param ServiceProviderInterface|string $provider - * - * @return self - */ - public function addServiceProvider($provider) : self - { - $this->providers->add($provider); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function get($id, bool $new = false) - { - if ($this->definitions->has($id)) { - $resolved = $this->definitions->resolve($id, $new); - return $this->inflectors->inflect($resolved); - } - - if ($this->definitions->hasTag($id)) { - $arrayOf = $this->definitions->resolveTagged($id, $new); - - array_walk($arrayOf, function (&$resolved) { - $resolved = $this->inflectors->inflect($resolved); - }); - - return $arrayOf; - } - - if ($this->providers->provides($id)) { - $this->providers->register($id); - - if (!$this->definitions->has($id) && !$this->definitions->hasTag($id)) { - throw new ContainerException(sprintf('Service provider lied about providing (%s) service', $id)); - } - - return $this->get($id, $new); - } - - foreach ($this->delegates as $delegate) { - if ($delegate->has($id)) { - $resolved = $delegate->get($id); - return $this->inflectors->inflect($resolved); - } - } - - throw new NotFoundException(sprintf('Alias (%s) is not being managed by the container or delegates', $id)); - } - - /** - * {@inheritdoc} - */ - public function has($id) - { - if ($this->definitions->has($id)) { - return true; - } - - if ($this->definitions->hasTag($id)) { - return true; - } - - if ($this->providers->provides($id)) { - return true; - } - - foreach ($this->delegates as $delegate) { - if ($delegate->has($id)) { - return true; - } - } - - return false; - } - - /** - * Allows for manipulation of specific types on resolution. - * - * @param string $type - * @param callable|null $callback - * - * @return InflectorInterface - */ - public function inflector(string $type, callable $callback = null) : InflectorInterface - { - return $this->inflectors->add($type, $callback); - } - - /** - * Delegate a backup container to be checked for services if it - * cannot be resolved via this container. - * - * @param ContainerInterface $container - * - * @return self - */ - public function delegate(ContainerInterface $container) : self - { - $this->delegates[] = $container; - - if ($container instanceof ContainerAwareInterface) { - $container->setLeagueContainer($this); - } - - return $this; - } -} diff --git a/src/Dependencies/League/Container/ContainerAwareInterface.php b/src/Dependencies/League/Container/ContainerAwareInterface.php deleted file mode 100644 index 8a9f8a6..0000000 --- a/src/Dependencies/League/Container/ContainerAwareInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -container = $container; - - return $this; - } - - /** - * Get the container. - * - * @return ContainerInterface - */ - public function getContainer() : ContainerInterface - { - if ($this->container instanceof ContainerInterface) { - return $this->container; - } - - throw new ContainerException('No container implementation has been set.'); - } - - /** - * Set a container. - * - * @param Container $container - * - * @return self - */ - public function setLeagueContainer(Container $container) : ContainerAwareInterface - { - $this->container = $container; - $this->leagueContainer = $container; - - return $this; - } - - /** - * Get the container. - * - * @return Container - */ - public function getLeagueContainer() : Container - { - if ($this->leagueContainer instanceof Container) { - return $this->leagueContainer; - } - - throw new ContainerException('No container implementation has been set.'); - } -} diff --git a/src/Dependencies/League/Container/Definition/Definition.php b/src/Dependencies/League/Container/Definition/Definition.php deleted file mode 100644 index ff5c0c7..0000000 --- a/src/Dependencies/League/Container/Definition/Definition.php +++ /dev/null @@ -1,278 +0,0 @@ -alias = $id; - $this->concrete = $concrete; - } - - /** - * {@inheritdoc} - */ - public function addTag(string $tag) : DefinitionInterface - { - $this->tags[$tag] = true; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasTag(string $tag) : bool - { - return isset($this->tags[$tag]); - } - - /** - * {@inheritdoc} - */ - public function setAlias(string $id) : DefinitionInterface - { - $this->alias = $id; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getAlias() : string - { - return $this->alias; - } - - /** - * {@inheritdoc} - */ - public function setShared(bool $shared = true) : DefinitionInterface - { - $this->shared = $shared; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function isShared() : bool - { - return $this->shared; - } - - /** - * {@inheritdoc} - */ - public function getConcrete() - { - return $this->concrete; - } - - /** - * {@inheritdoc} - */ - public function setConcrete($concrete) : DefinitionInterface - { - $this->concrete = $concrete; - $this->resolved = null; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addArgument($arg) : DefinitionInterface - { - $this->arguments[] = $arg; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addArguments(array $args) : DefinitionInterface - { - foreach ($args as $arg) { - $this->addArgument($arg); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addMethodCall(string $method, array $args = []) : DefinitionInterface - { - $this->methods[] = [ - 'method' => $method, - 'arguments' => $args - ]; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addMethodCalls(array $methods = []) : DefinitionInterface - { - foreach ($methods as $method => $args) { - $this->addMethodCall($method, $args); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function resolve(bool $new = false) - { - $concrete = $this->concrete; - - if ($this->isShared() && $this->resolved !== null && $new === false) { - return $this->resolved; - } - - if (is_callable($concrete)) { - $concrete = $this->resolveCallable($concrete); - } - - if ($concrete instanceof RawArgumentInterface) { - $this->resolved = $concrete->getValue(); - - return $concrete->getValue(); - } - - if ($concrete instanceof ClassNameInterface) { - $concrete = $concrete->getClassName(); - } - - if (is_string($concrete) && class_exists($concrete)) { - $concrete = $this->resolveClass($concrete); - } - - if (is_object($concrete)) { - $concrete = $this->invokeMethods($concrete); - } - - if (is_string($concrete) && $this->getContainer()->has($concrete)) { - $concrete = $this->getContainer()->get($concrete); - } - - $this->resolved = $concrete; - - return $concrete; - } - - /** - * Resolve a callable. - * - * @param callable $concrete - * - * @return mixed - */ - protected function resolveCallable(callable $concrete) - { - $resolved = $this->resolveArguments($this->arguments); - - return call_user_func_array($concrete, $resolved); - } - - /** - * Resolve a class. - * - * @param string $concrete - * - * @return object - * - * @throws ReflectionException - */ - protected function resolveClass(string $concrete) - { - $resolved = $this->resolveArguments($this->arguments); - $reflection = new ReflectionClass($concrete); - - return $reflection->newInstanceArgs($resolved); - } - - /** - * Invoke methods on resolved instance. - * - * @param object $instance - * - * @return object - */ - protected function invokeMethods($instance) - { - foreach ($this->methods as $method) { - $args = $this->resolveArguments($method['arguments']); - - /** @var callable $callable */ - $callable = [$instance, $method['method']]; - call_user_func_array($callable, $args); - } - - return $instance; - } -} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregate.php b/src/Dependencies/League/Container/Definition/DefinitionAggregate.php deleted file mode 100644 index 73e1d4b..0000000 --- a/src/Dependencies/League/Container/Definition/DefinitionAggregate.php +++ /dev/null @@ -1,124 +0,0 @@ -definitions = array_filter($definitions, function ($definition) { - return ($definition instanceof DefinitionInterface); - }); - } - - /** - * {@inheritdoc} - */ - public function add(string $id, $definition, bool $shared = false) : DefinitionInterface - { - if (!$definition instanceof DefinitionInterface) { - $definition = new Definition($id, $definition); - } - - $this->definitions[] = $definition - ->setAlias($id) - ->setShared($shared) - ; - - return $definition; - } - - /** - * {@inheritdoc} - */ - public function has(string $id) : bool - { - foreach ($this->getIterator() as $definition) { - if ($id === $definition->getAlias()) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function hasTag(string $tag) : bool - { - foreach ($this->getIterator() as $definition) { - if ($definition->hasTag($tag)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getDefinition(string $id) : DefinitionInterface - { - foreach ($this->getIterator() as $definition) { - if ($id === $definition->getAlias()) { - return $definition->setLeagueContainer($this->getLeagueContainer()); - } - } - - throw new NotFoundException(sprintf('Alias (%s) is not being handled as a definition.', $id)); - } - - /** - * {@inheritdoc} - */ - public function resolve(string $id, bool $new = false) - { - return $this->getDefinition($id)->resolve($new); - } - - /** - * {@inheritdoc} - */ - public function resolveTagged(string $tag, bool $new = false) : array - { - $arrayOf = []; - - foreach ($this->getIterator() as $definition) { - if ($definition->hasTag($tag)) { - $arrayOf[] = $definition->setLeagueContainer($this->getLeagueContainer())->resolve($new); - } - } - - return $arrayOf; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->definitions); - - for ($i = 0; $i < $count; $i++) { - yield $this->definitions[$i]; - } - } -} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php b/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php deleted file mode 100644 index 7069f2f..0000000 --- a/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php +++ /dev/null @@ -1,67 +0,0 @@ -type = $type; - $this->callback = $callback; - } - - /** - * {@inheritdoc} - */ - public function getType() : string - { - return $this->type; - } - - /** - * {@inheritdoc} - */ - public function invokeMethod(string $name, array $args) : InflectorInterface - { - $this->methods[$name] = $args; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function invokeMethods(array $methods) : InflectorInterface - { - foreach ($methods as $name => $args) { - $this->invokeMethod($name, $args); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setProperty(string $property, $value) : InflectorInterface - { - $this->properties[$property] = $this->resolveArguments([$value])[0]; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setProperties(array $properties) : InflectorInterface - { - foreach ($properties as $property => $value) { - $this->setProperty($property, $value); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function inflect($object) - { - $properties = $this->resolveArguments(array_values($this->properties)); - $properties = array_combine(array_keys($this->properties), $properties); - - // array_combine() can technically return false - foreach ($properties ?: [] as $property => $value) { - $object->{$property} = $value; - } - - foreach ($this->methods as $method => $args) { - $args = $this->resolveArguments($args); - - /** @var callable $callable */ - $callable = [$object, $method]; - call_user_func_array($callable, $args); - } - - if ($this->callback !== null) { - call_user_func($this->callback, $object); - } - } -} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregate.php b/src/Dependencies/League/Container/Inflector/InflectorAggregate.php deleted file mode 100644 index 644668e..0000000 --- a/src/Dependencies/League/Container/Inflector/InflectorAggregate.php +++ /dev/null @@ -1,58 +0,0 @@ -inflectors[] = $inflector; - - return $inflector; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->inflectors); - - for ($i = 0; $i < $count; $i++) { - yield $this->inflectors[$i]; - } - } - - /** - * {@inheritdoc} - */ - public function inflect($object) - { - foreach ($this->getIterator() as $inflector) { - $type = $inflector->getType(); - - if (! $object instanceof $type) { - continue; - } - - $inflector->setLeagueContainer($this->getLeagueContainer()); - $inflector->inflect($object); - } - - return $object; - } -} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php b/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php deleted file mode 100644 index 7309e01..0000000 --- a/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -cacheResolutions === true && array_key_exists($id, $this->cache)) { - return $this->cache[$id]; - } - - if (! $this->has($id)) { - throw new NotFoundException( - sprintf('Alias (%s) is not an existing class and therefore cannot be resolved', $id) - ); - } - - $reflector = new ReflectionClass($id); - $construct = $reflector->getConstructor(); - - if ($construct && !$construct->isPublic()) { - throw new NotFoundException( - sprintf('Alias (%s) has a non-public constructor and therefore cannot be instantiated', $id) - ); - } - - $resolution = $construct === null - ? new $id - : $resolution = $reflector->newInstanceArgs($this->reflectArguments($construct, $args)) - ; - - if ($this->cacheResolutions === true) { - $this->cache[$id] = $resolution; - } - - return $resolution; - } - - /** - * {@inheritdoc} - */ - public function has($id) - { - return class_exists($id); - } - - /** - * Invoke a callable via the container. - * - * @param callable $callable - * @param array $args - * - * @return mixed - * - * @throws ReflectionException - */ - public function call(callable $callable, array $args = []) - { - if (is_string($callable) && strpos($callable, '::') !== false) { - $callable = explode('::', $callable); - } - - if (is_array($callable)) { - if (is_string($callable[0])) { - $callable[0] = $this->getContainer()->get($callable[0]); - } - - $reflection = new ReflectionMethod($callable[0], $callable[1]); - - if ($reflection->isStatic()) { - $callable[0] = null; - } - - return $reflection->invokeArgs($callable[0], $this->reflectArguments($reflection, $args)); - } - - if (is_object($callable)) { - $reflection = new ReflectionMethod($callable, '__invoke'); - - return $reflection->invokeArgs($callable, $this->reflectArguments($reflection, $args)); - } - - $reflection = new ReflectionFunction(\Closure::fromCallable($callable)); - - return $reflection->invokeArgs($this->reflectArguments($reflection, $args)); - } - - /** - * Whether the container should default to caching resolutions and returning - * the cache on following calls. - * - * @param boolean $option - * - * @return self - */ - public function cacheResolutions(bool $option = true) : ContainerInterface - { - $this->cacheResolutions = $option; - - return $this; - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php b/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php deleted file mode 100644 index 1b356af..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php +++ /dev/null @@ -1,46 +0,0 @@ -provides, true); - } - - /** - * {@inheritdoc} - */ - public function setIdentifier(string $id) : ServiceProviderInterface - { - $this->identifier = $id; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getIdentifier() : string - { - return $this->identifier ?? get_class($this); - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php b/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php deleted file mode 100644 index 895f4be..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -getContainer()->has($provider)) { - $provider = $this->getContainer()->get($provider); - } elseif (is_string($provider) && class_exists($provider)) { - $provider = new $provider; - } - - if (in_array($provider, $this->providers, true)) { - return $this; - } - - if ($provider instanceof ContainerAwareInterface) { - $provider->setLeagueContainer($this->getLeagueContainer()); - } - - if ($provider instanceof BootableServiceProviderInterface) { - $provider->boot(); - } - - if ($provider instanceof ServiceProviderInterface) { - $this->providers[] = $provider; - - return $this; - } - - throw new ContainerException( - 'A service provider must be a fully qualified class name or instance ' . - 'of (\RocketCDN\Dependencies\League\Container\ServiceProvider\ServiceProviderInterface)' - ); - } - - /** - * {@inheritdoc} - */ - public function provides(string $service) : bool - { - foreach ($this->getIterator() as $provider) { - if ($provider->provides($service)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->providers); - - for ($i = 0; $i < $count; $i++) { - yield $this->providers[$i]; - } - } - - /** - * {@inheritdoc} - */ - public function register(string $service) - { - if (false === $this->provides($service)) { - throw new ContainerException( - sprintf('(%s) is not provided by a service provider', $service) - ); - } - - foreach ($this->getIterator() as $provider) { - if (in_array($provider->getIdentifier(), $this->registered, true)) { - continue; - } - - if ($provider->provides($service)) { - $this->registered[] = $provider->getIdentifier(); - $provider->register(); - } - } - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php b/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php deleted file mode 100644 index a0eb57e..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php +++ /dev/null @@ -1,36 +0,0 @@ -leagueContainer property or the `getLeagueContainer` method - * from the ContainerAwareTrait. - * - * @return void - */ - public function register(); - - /** - * Set a custom id for the service provider. This enables - * registering the same service provider multiple times. - * - * @param string $id - * - * @return self - */ - public function setIdentifier(string $id) : ServiceProviderInterface; - - /** - * The id of the service provider uniquely identifies it, so - * that we can quickly determine if it has already been registered. - * Defaults to get_class($provider). - * - * @return string - */ - public function getIdentifier() : string; -} diff --git a/src/Dependencies/Psr/Container/ContainerExceptionInterface.php b/src/Dependencies/Psr/Container/ContainerExceptionInterface.php deleted file mode 100644 index 5a622ea..0000000 --- a/src/Dependencies/Psr/Container/ContainerExceptionInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -set_event_manager( $this ); - } - - $events = $subscriber->get_subscribed_events(); - - if ( empty( $events ) ) { - return; - } - - foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { - $this->add_subscriber_callback( $subscriber, $hook_name, $parameters ); - } - } - - /** - * Checks the WordPress plugin API to see if the given hook has - * the given callback. The priority of the callback will be returned - * or false. If no callback is given will return true or false if - * there's any callbacks registered to the hook. - * - * @uses has_filter() - * - * @param string $hook_name Hook name. - * @param mixed $callback Callback. - * - * @return bool|int - */ - public function has_callback( $hook_name, $callback = false ) { - return has_filter( $hook_name, $callback ); - } - - /** - * Removes the given callback from the given hook. The WordPress plugin API only - * removes the hook if the callback and priority match a registered hook. - * - * @uses remove_filter() - * - * @param string $hook_name Hook name. - * @param callable $callback Callback. - * @param int $priority Priority. - * - * @return bool - */ - public function remove_callback( $hook_name, $callback, $priority = 10 ) { - return remove_filter( $hook_name, $callback, $priority ); - } - - /** - * Remove an event subscriber. - * - * The event manager removes all the hooks that the given subscriber - * wants to register with the WordPress Plugin API. - * - * @param SubscriberInterface $subscriber SubscriberInterface implementation. - */ - public function remove_subscriber( SubscriberInterface $subscriber ) { - foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { - $this->remove_subscriber_callback( $subscriber, $hook_name, $parameters ); - } - } - - /** - * Adds the given subscriber's callback to a specific hook - * of the WordPress plugin API. - * - * @param SubscriberInterface $subscriber SubscriberInterface implementation. - * @param string $hook_name Hook name. - * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. - */ - private function add_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { - if ( is_string( $parameters ) ) { - $this->add_callback( $hook_name, [ $subscriber, $parameters ] ); - } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { - foreach ( $parameters as $parameter ) { - $this->add_subscriber_callback( $subscriber, $hook_name, $parameter ); - } - } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { - $this->add_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10, isset( $parameters[2] ) ? $parameters[2] : 1 ); - } - } - - /** - * Removes the given subscriber's callback to a specific hook - * of the WordPress plugin API. - * - * @param SubscriberInterface $subscriber SubscriberInterface implementation. - * @param string $hook_name Hook name. - * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. - */ - private function remove_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { - if ( is_string( $parameters ) ) { - $this->remove_callback( $hook_name, [ $subscriber, $parameters ] ); - } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { - foreach ( $parameters as $parameter ) { - $this->remove_subscriber_callback( $subscriber, $hook_name, $parameter ); - } - } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { - $this->remove_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10 ); - } - } -} diff --git a/src/EventManagement/SubscriberInterface.php b/src/EventManagement/SubscriberInterface.php index 87c700f..a94e251 100644 --- a/src/EventManagement/SubscriberInterface.php +++ b/src/EventManagement/SubscriberInterface.php @@ -3,13 +3,15 @@ namespace RocketCDN\EventManagement; +use RocketCDN\Dependencies\LaunchpadCore\EventManagement\OptimizedSubscriberInterface; + /** * A Subscriber knows what specific WordPress events it wants to listen to. * * When an EventManager adds a Subscriber, it gets all the WordPress events that * it wants to listen to. It then adds the subscriber as a listener for each of them. */ -interface SubscriberInterface { +interface SubscriberInterface extends OptimizedSubscriberInterface { /** * Returns an array of events that this subscriber wants to listen to. * diff --git a/src/Front/CDN.php b/src/Front/CDN.php index 77b5a4a..a4d4e6f 100644 --- a/src/Front/CDN.php +++ b/src/Front/CDN.php @@ -3,16 +3,13 @@ namespace RocketCDN\Front; -use RocketCDN\Options\Options; -class CDN { - /** - * Options instance - * - * @var Options - */ - private $options; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; +use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; +class CDN implements OptionsAwareInterface { + use OptionsAwareTrait; /** * Home URL host * @@ -20,15 +17,6 @@ class CDN { */ private $home_host = ''; - /** - * Instantiates the class - * - * @param Options $options Options instance. - */ - public function __construct( Options $options ) { - $this->options = $options; - } - /** * Setup output buffering * diff --git a/src/Front/ServiceProvider.php b/src/Front/ServiceProvider.php index 21d7bce..36a9a96 100644 --- a/src/Front/ServiceProvider.php +++ b/src/Front/ServiceProvider.php @@ -3,37 +3,23 @@ namespace RocketCDN\Front; -use RocketCDN\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; +use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; +use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - /** - * Services provided by this provider - * - * @var array - */ - protected $provides = [ - 'cdn', - 'cdn_subscriber', - ]; + public function define() { + $this->register_service(CDN::class); + $this->register_service(\RocketCDN\Front\Subscriber::class)->share() + ->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument(CDN::class); + }); + } - /** - * Subscribers provided by this provider - * - * @var array - */ - public $subscribers = [ - 'cdn_subscriber', - ]; - - /** - * Registers the provided classes - * - * @return void - */ - public function register() { - $this->getContainer()->add( 'cdn', 'RocketCDN\Front\CDN' ) - ->addArgument( $this->getContainer()->get( 'options' ) ); - $this->getContainer()->add( 'cdn_subscriber', 'RocketCDN\Front\Subscriber' ) - ->addArgument( $this->getContainer()->get( 'cdn' ) ); - } + public function get_common_subscribers(): array + { + return [ + \RocketCDN\Front\Subscriber::class + ]; + } } diff --git a/src/Options/AbstractOptions.php b/src/Options/AbstractOptions.php deleted file mode 100644 index 7553cfd..0000000 --- a/src/Options/AbstractOptions.php +++ /dev/null @@ -1,67 +0,0 @@ -prefix . $name; - } - - /** - * Gets the option for the given name. Returns the default value if the value does not exist. - * - * @param string $name Name of the option to get. - * @param mixed $default Default value to return if the value does not exist. - * - * @return mixed - */ - abstract public function get( string $name, $default = null ); - - /** - * Sets the value of an option. Update the value if the option for the given name already exists. - * - * @param string $name Name of the option to set. - * @param mixed $value Value to set for the option. - * - * @return void - */ - abstract public function set( string $name, $value ); - - /** - * Deletes the option with the given name. - * - * @param string $name Name of the option to delete. - * - * @return void - */ - abstract public function delete( string $name ); - - /** - * Checks if the option with the given name exists. - * - * @param string $name Name of the option to check. - * - * @return bool - */ - public function has( string $name ): bool { - return null !== $this->get( $name ); - } -} diff --git a/src/Options/Options.php b/src/Options/Options.php deleted file mode 100644 index c6ba1de..0000000 --- a/src/Options/Options.php +++ /dev/null @@ -1,59 +0,0 @@ -prefix = $prefix; - } - - /** - * Gets the option for the given name. Returns the default value if the value does not exist. - * - * @param string $name Name of the option to get. - * @param mixed $default Default value to return if the value does not exist. - * - * @return mixed - */ - public function get( string $name, $default = null ) { - $option = get_option( $this->get_option_name( $name ), $default ); - - if ( is_array( $default ) && ! is_array( $option ) ) { - $option = (array) $option; - } - - return $option; - } - - /** - * Sets the value of an option. Update the value if the option for the given name already exists. - * - * @param string $name Name of the option to set. - * @param mixed $value Value to set for the option. - * - * @return void - */ - public function set( string $name, $value ) { - update_option( $this->get_option_name( $name ), $value ); - } - - /** - * Deletes the option with the given name. - * - * @param string $name Name of the option to delete. - * - * @return void - */ - public function delete( string $name ) { - delete_option( $this->get_option_name( $name ) ); - } -} diff --git a/src/Options/OptionsInterface.php b/src/Options/OptionsInterface.php deleted file mode 100644 index 5b6305b..0000000 --- a/src/Options/OptionsInterface.php +++ /dev/null @@ -1,56 +0,0 @@ -container = $container; - - add_filter( 'rocketcdn_container', [ $this, 'get_container' ] ); - } - - /** - * Returns the RocketCDN container instance. - * - * @return Container - */ - public function get_container() { - return $this->container; - } - - /** - * Checks if the plugin is loaded - * - * @return boolean - */ - private function is_loaded(): bool { - return $this->loaded; - } - - /** - * Loads the plugin in WordPress - * - * @return void - */ - public function load() { - if ( $this->is_loaded() ) { - return; - } - - $this->container->add( - 'event_manager', - function () { - return new EventManager(); - } - ); - - $this->container->add( 'template_basepath', realpath( plugin_dir_path( __DIR__ ) ) . '/views/' ); - $this->container->add( 'assets_baseurl', plugin_dir_url( __DIR__ ) . 'assets/' ); - $this->container->add( - 'options', - function () { - return new Options( 'rocketcdn_' ); - } - ); - - foreach ( $this->get_service_providers() as $service_provider ) { - $service_provider_instance = new $service_provider(); - $this->container->addServiceProvider( $service_provider_instance ); - - // Load each service provider's subscribers if found. - $this->load_subscribers( $service_provider_instance ); - } - - $this->loaded = true; - } - - /** - * Get list of service providers' classes. - * - * @return array Service providers. - */ - private function get_service_providers() { - return [ - 'RocketCDN\API\ServiceProvider', - 'RocketCDN\Admin\Settings\ServiceProvider', - 'RocketCDN\Admin\Notices\ServiceProvider', - 'RocketCDN\Admin\AdminBar\ServiceProvider', - 'RocketCDN\Front\ServiceProvider', - ]; - } - - /** - * Load list of event subscribers from service provider. - * - * @param ServiceProviderInterface $service_provider_instance Instance of service provider. - * - * @return void - */ - private function load_subscribers( ServiceProviderInterface $service_provider_instance ) { - if ( empty( $service_provider_instance->subscribers ) ) { - return; - } - - foreach ( $service_provider_instance->subscribers as $subscriber ) { - $subscriber_object = $this->container->get( $subscriber ); - - if ( $subscriber_object instanceof SubscriberInterface ) { - $this->container->get( 'event_manager' )->add_subscriber( $subscriber_object ); - } - } - } -} diff --git a/tests/Integration/AdminTestCase.php b/tests/Integration/AdminTestCase.php index 50fb53b..8899420 100644 --- a/tests/Integration/AdminTestCase.php +++ b/tests/Integration/AdminTestCase.php @@ -5,6 +5,7 @@ use WPMedia\PHPUnit\Integration\TestCase as BaseTestCase; abstract class AdminTestCase extends BaseTestCase { + use DBTrait; protected $user_id; @@ -21,6 +22,8 @@ public static function setUpBeforeClass() : void { public function set_up() { parent::set_up(); + self::removeDBHooks(); + // Suppress warnings from "Cannot modify header information - headers already sent by". $this->error_level = error_reporting(); error_reporting( $this->error_level & ~E_WARNING ); diff --git a/tests/Integration/AjaxTestCase.php b/tests/Integration/AjaxTestCase.php index 84e9f07..15e5a9f 100644 --- a/tests/Integration/AjaxTestCase.php +++ b/tests/Integration/AjaxTestCase.php @@ -11,6 +11,7 @@ abstract class AjaxTestCase extends WPMediaAjaxTestCase { use CallbackTrait; use CapTrait; use SettingsTrait; + use DBTrait; protected static $use_settings_trait = false; protected static $transients = []; @@ -20,10 +21,10 @@ abstract class AjaxTestCase extends WPMediaAjaxTestCase { public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); - self::hasAdminCapBeforeClass(); + self::hasAdminCapBeforeClass(); - if ( static::$use_settings_trait ) { - SettingsTrait::getOriginalSettings(); + if ( self::$use_settings_trait ) { + self::getOriginalSettings(); } if ( ! empty( self::$transients ) ) { @@ -34,11 +35,11 @@ public static function setUpBeforeClass() : void { } public static function tearDownAfterClass(): void { - parent::setUpBeforeClass(); + parent::tearDownAfterClass(); self::resetAdminCap(); - if ( static::$use_settings_trait ) { + if ( self::$use_settings_trait ) { self::resetOriginalSettings(); } @@ -56,6 +57,8 @@ public function set_up() { $this->loadTestDataConfig(); } + self::removeDBHooks(); + parent::set_up(); if ( static::$use_settings_trait ) { diff --git a/tests/Integration/CapTrait.php b/tests/Integration/CapTrait.php index 9c62ecc..aef4eaa 100644 --- a/tests/Integration/CapTrait.php +++ b/tests/Integration/CapTrait.php @@ -7,19 +7,19 @@ trait CapTrait { public static function hasAdminCapBeforeClass() { $admin = get_role( 'administrator' ); - static::$had_cap = $admin->has_cap( 'manage_options' ); + self::$had_cap = $admin->has_cap( 'manage_options' ); } public static function setAdminCap() { $admin = get_role( 'administrator' ); - if ( ! static::$had_cap ) { + if ( ! self::$had_cap ) { $admin->add_cap( 'manage_options' ); } } public static function resetAdminCap() { $admin = get_role( 'administrator' ); - if ( ! static::$had_cap ) { + if ( ! self::$had_cap ) { $admin->remove_cap( 'manage_options' ); } } diff --git a/tests/Integration/src/Admin/AdminBar/Subscriber/purgeCache.php b/tests/Integration/src/Admin/AdminBar/Subscriber/purgeCache.php index d0d2951..f2d9108 100644 --- a/tests/Integration/src/Admin/AdminBar/Subscriber/purgeCache.php +++ b/tests/Integration/src/Admin/AdminBar/Subscriber/purgeCache.php @@ -19,14 +19,14 @@ class Test_PurgeCache extends TestCase public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); - CapTrait::hasAdminCapBeforeClass(); - CapTrait::setAdminCap(); + self::hasAdminCapBeforeClass(); + self::setAdminCap(); } public static function tearDownAfterClass(): void { parent::tearDownAfterClass(); - CapTrait::resetAdminCap(); + self::resetAdminCap(); } public function set_up() { diff --git a/tests/Integration/src/Admin/Settings/Subscriber/purgeCache.php b/tests/Integration/src/Admin/Settings/Subscriber/purgeCache.php index 800a6da..57d43e3 100644 --- a/tests/Integration/src/Admin/Settings/Subscriber/purgeCache.php +++ b/tests/Integration/src/Admin/Settings/Subscriber/purgeCache.php @@ -19,7 +19,7 @@ class Test_PurgeCache extends AjaxTestCase { protected $cdn; public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); - CapTrait::setAdminCap(); + self::setAdminCap(); self::$admin_user_id = static::factory()->user->create( [ 'role' => 'administrator' ] ); } diff --git a/tests/Integration/src/Admin/Settings/Subscriber/validateApiKey.php b/tests/Integration/src/Admin/Settings/Subscriber/validateApiKey.php index 5b6a7d7..c90817f 100644 --- a/tests/Integration/src/Admin/Settings/Subscriber/validateApiKey.php +++ b/tests/Integration/src/Admin/Settings/Subscriber/validateApiKey.php @@ -14,12 +14,14 @@ * @group Admin */ class Test_ValidateApiKey extends AjaxTestCase { + use CapTrait; + protected $api_key; private static $admin_user_id = 0; public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); - CapTrait::setAdminCap(); + self::setAdminCap(); self::$admin_user_id = static::factory()->user->create( [ 'role' => 'administrator' ] ); } From 797d96855f2cf84e530c77749ea972a406cbb8e9 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Tue, 2 Jul 2024 18:38:12 +0200 Subject: [PATCH 22/40] Fixes for linter --- configs/parameters.php | 14 +++---- configs/providers.php | 14 +++---- readme.txt | 3 ++ rocketcdn.php | 12 +++--- src/API/Client.php | 2 +- src/API/ServiceProvider.php | 14 ++++--- src/Admin/AdminBar/AdminBar.php | 6 +-- src/Admin/AdminBar/ServiceProvider.php | 50 +++++++++++++++--------- src/Admin/Notices/Notices.php | 2 +- src/Admin/Notices/ServiceProvider.php | 42 ++++++++++++-------- src/Admin/Settings/Page.php | 8 ++-- src/Admin/Settings/ServiceProvider.php | 53 +++++++++++++++++--------- src/Front/CDN.php | 3 +- src/Front/ServiceProvider.php | 38 +++++++++++------- 14 files changed, 159 insertions(+), 102 deletions(-) diff --git a/configs/parameters.php b/configs/parameters.php index d0c8030..008779d 100644 --- a/configs/parameters.php +++ b/configs/parameters.php @@ -1,10 +1,10 @@ sanitize_key( 'RocketCDN' ), - 'template_basepath' => realpath( plugin_dir_path( __DIR__ ) ) . '/views/' , - 'assets_baseurl' => plugin_dir_url( __DIR__ ) . 'assets/', - 'is_mu_plugin' => false, - 'translation_key' => 'rocketcdn', - 'prefix' => 'rocketcdn_' -]; \ No newline at end of file + 'plugin_name' => sanitize_key( 'RocketCDN' ), + 'template_basepath' => realpath( plugin_dir_path( __DIR__ ) ) . '/views/', + 'assets_baseurl' => plugin_dir_url( __DIR__ ) . 'assets/', + 'is_mu_plugin' => false, + 'translation_key' => 'rocketcdn', + 'prefix' => 'rocketcdn_', +]; diff --git a/configs/providers.php b/configs/providers.php index 6de45fc..80045c2 100644 --- a/configs/providers.php +++ b/configs/providers.php @@ -1,10 +1,10 @@ 'RocketCDN', 'plugin_version' => ROCKETCDN_VERSION, 'wp_version' => '5.4', - 'php_version' => '7.0', + 'php_version' => '7.3', ] ); if ( $rocketcdn_rq_check->check() ) { - require __DIR__ . '/src/Dependencies/LaunchpadCore/boot.php'; + require __DIR__ . '/src/Dependencies/LaunchpadCore/boot.php'; - boot( __FILE__ ); + boot( __FILE__ ); } unset( $rocketcdn_rq_check ); diff --git a/src/API/Client.php b/src/API/Client.php index 2695dcf..d4914f6 100644 --- a/src/API/Client.php +++ b/src/API/Client.php @@ -7,7 +7,7 @@ use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; class Client implements OptionsAwareInterface { - use OptionsAwareTrait; + use OptionsAwareTrait; const ROCKETCDN_API = 'https://rocketcdn.me/api/'; diff --git a/src/API/ServiceProvider.php b/src/API/ServiceProvider.php index 9f5862a..7604c4d 100644 --- a/src/API/ServiceProvider.php +++ b/src/API/ServiceProvider.php @@ -4,10 +4,14 @@ namespace RocketCDN\API; use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; -use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; - class ServiceProvider extends AbstractServiceProvider { - public function define() { - $this->register_service(Client::class); - } + + /** + * Register the services. + * + * @return void + */ + public function define() { + $this->register_service( Client::class ); + } } diff --git a/src/Admin/AdminBar/AdminBar.php b/src/Admin/AdminBar/AdminBar.php index a24d795..132044a 100644 --- a/src/Admin/AdminBar/AdminBar.php +++ b/src/Admin/AdminBar/AdminBar.php @@ -9,7 +9,7 @@ use RocketCDN\Options\Options; class AdminBar implements OptionsAwareInterface { - use OptionsAwareTrait; + use OptionsAwareTrait; /** * API client instance @@ -28,8 +28,8 @@ class AdminBar implements OptionsAwareInterface { /** * Instantiate the class * - * @param Client $api_client API client instance. - * @param string $assets_baseurl Assets base URL. + * @param Client $api_client API client instance. + * @param string $assets_baseurl Assets base URL. */ public function __construct( Client $api_client, $assets_baseurl ) { $this->api_client = $api_client; diff --git a/src/Admin/AdminBar/ServiceProvider.php b/src/Admin/AdminBar/ServiceProvider.php index c50000c..77ccf10 100644 --- a/src/Admin/AdminBar/ServiceProvider.php +++ b/src/Admin/AdminBar/ServiceProvider.php @@ -5,27 +5,41 @@ use RocketCDN\API\Client; use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; -use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - public function get_common_subscribers(): array - { - return [ - \RocketCDN\Admin\AdminBar\Subscriber::class - ]; - } + /** + * Returns common subscribers. + * + * @return string[] + */ + public function get_common_subscribers(): array { + return [ + \RocketCDN\Admin\AdminBar\Subscriber::class, + ]; + } - public function define() { - $this->register_service(AdminBar::class)->set_definition(function (DefinitionInterface $definition) { - $definition->addArguments([ - Client::class, - 'assets_baseurl' - ]); - }); + /** + * Register the services. + * + * @return void + */ + public function define() { + $this->register_service( AdminBar::class )->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArguments( + [ + Client::class, + 'assets_baseurl', + ] + ); + } + ); - $this->register_service(\RocketCDN\Admin\AdminBar\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument(AdminBar::class); - }); - } + $this->register_service( \RocketCDN\Admin\AdminBar\Subscriber::class )->share()->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArgument( AdminBar::class ); + } + ); + } } diff --git a/src/Admin/Notices/Notices.php b/src/Admin/Notices/Notices.php index 0fa916e..4eb1101 100644 --- a/src/Admin/Notices/Notices.php +++ b/src/Admin/Notices/Notices.php @@ -21,7 +21,7 @@ class Notices implements OptionsAwareInterface { /** * Instantiate the class * - * @param Client $api_client API client instance. + * @param Client $api_client API client instance. */ public function __construct( Client $api_client ) { $this->api_client = $api_client; diff --git a/src/Admin/Notices/ServiceProvider.php b/src/Admin/Notices/ServiceProvider.php index 435ab99..fce6022 100644 --- a/src/Admin/Notices/ServiceProvider.php +++ b/src/Admin/Notices/ServiceProvider.php @@ -5,25 +5,37 @@ use RocketCDN\API\Client; use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; -use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - public function get_common_subscribers(): array - { - return [ - \RocketCDN\Admin\Notices\Subscriber::class - ]; - } + /** + * Returns common subscribers. + * + * @return string[] + */ + public function get_common_subscribers(): array { + return [ + \RocketCDN\Admin\Notices\Subscriber::class, + ]; + } - public function define() { - $this->register_service(Notices::class)->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument(Client::class); - }); + /** + * Register the services. + * + * @return void + */ + public function define() { + $this->register_service( Notices::class )->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArgument( Client::class ); + } + ); - $this->register_service(\RocketCDN\Admin\Notices\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument(Notices::class); - }); - } + $this->register_service( \RocketCDN\Admin\Notices\Subscriber::class )->share()->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArgument( Notices::class ); + } + ); + } } diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index ef73642..f84fa3f 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -10,7 +10,7 @@ class Page implements OptionsAwareInterface { - use OptionsAwareTrait; + use OptionsAwareTrait; /** * API Client instance @@ -36,9 +36,9 @@ class Page implements OptionsAwareInterface { /** * Instantiates the class * - * @param Client $api_client API Client instance. - * @param string $template_basepath Base filepath for the template. - * @param string $assets_baseurl Base URL for the assets. + * @param Client $api_client API Client instance. + * @param string $template_basepath Base filepath for the template. + * @param string $assets_baseurl Base URL for the assets. */ public function __construct( Client $api_client, $template_basepath, $assets_baseurl ) { $this->api_client = $api_client; diff --git a/src/Admin/Settings/ServiceProvider.php b/src/Admin/Settings/ServiceProvider.php index bb829c7..12c9a6e 100644 --- a/src/Admin/Settings/ServiceProvider.php +++ b/src/Admin/Settings/ServiceProvider.php @@ -5,28 +5,43 @@ use RocketCDN\API\Client; use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; -use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - public function get_common_subscribers(): array - { - return [ - \RocketCDN\Admin\Settings\Subscriber::class - ]; - } - public function define() { - $this->register_service(Page::class)->set_definition(function (DefinitionInterface $definition) { - $definition->addArguments([ - Client::class, - 'template_basepath', - 'assets_baseurl', - ]); - }); + /** + * Returns common subscribers. + * + * @return string[] + */ + public function get_common_subscribers(): array { + return [ + \RocketCDN\Admin\Settings\Subscriber::class, + ]; + } - $this->register_service(\RocketCDN\Admin\Settings\Subscriber::class)->share()->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument(Page::class); - }); - } + /** + * Register the services. + * + * @return void + */ + public function define() { + $this->register_service( Page::class )->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArguments( + [ + Client::class, + 'template_basepath', + 'assets_baseurl', + ] + ); + } + ); + + $this->register_service( \RocketCDN\Admin\Settings\Subscriber::class )->share()->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArgument( Page::class ); + } + ); + } } diff --git a/src/Front/CDN.php b/src/Front/CDN.php index a4d4e6f..f12e51a 100644 --- a/src/Front/CDN.php +++ b/src/Front/CDN.php @@ -3,13 +3,12 @@ namespace RocketCDN\Front; - use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; class CDN implements OptionsAwareInterface { - use OptionsAwareTrait; + use OptionsAwareTrait; /** * Home URL host * diff --git a/src/Front/ServiceProvider.php b/src/Front/ServiceProvider.php index 36a9a96..21bc8e6 100644 --- a/src/Front/ServiceProvider.php +++ b/src/Front/ServiceProvider.php @@ -4,22 +4,32 @@ namespace RocketCDN\Front; use RocketCDN\Dependencies\LaunchpadCore\Container\AbstractServiceProvider; -use RocketCDN\Dependencies\LaunchpadOptions\Interfaces\OptionsInterface; use RocketCDN\Dependencies\League\Container\Definition\DefinitionInterface; class ServiceProvider extends AbstractServiceProvider { - public function define() { - $this->register_service(CDN::class); - $this->register_service(\RocketCDN\Front\Subscriber::class)->share() - ->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument(CDN::class); - }); - } + /** + * Register the services. + * + * @return void + */ + public function define() { + $this->register_service( CDN::class ); + $this->register_service( \RocketCDN\Front\Subscriber::class )->share() + ->set_definition( + function ( DefinitionInterface $definition ) { + $definition->addArgument( CDN::class ); + } + ); + } - public function get_common_subscribers(): array - { - return [ - \RocketCDN\Front\Subscriber::class - ]; - } + /** + * Returns common subscribers. + * + * @return string[] + */ + public function get_common_subscribers(): array { + return [ + \RocketCDN\Front\Subscriber::class, + ]; + } } From 4a2caa5f1ae193f5121c7c2ac561a016cf3d6eeb Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 15:36:28 +0200 Subject: [PATCH 23/40] Fixed ci for deploying to wordpress.org --- .github/workflows/deploy-tag.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-tag.yml b/.github/workflows/deploy-tag.yml index cf2459e..18b79ee 100644 --- a/.github/workflows/deploy-tag.yml +++ b/.github/workflows/deploy-tag.yml @@ -9,7 +9,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - name: build + - name: normal build + run: composer install + - name: optimized build run: composer install -o --no-dev --no-scripts - name: WordPress Plugin Deploy uses: 10up/action-wordpress-plugin-deploy@stable From 79964c2b604d0e7648f87db3b8ebd1dcfdb6f28e Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 15:41:43 +0200 Subject: [PATCH 24/40] Updated php on the linter --- .github/workflows/lint_phpcs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_phpcs.yml b/.github/workflows/lint_phpcs.yml index 92597a8..95d1e02 100644 --- a/.github/workflows/lint_phpcs.yml +++ b/.github/workflows/lint_phpcs.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['7.4'] + php-versions: ['8.0'] name: RocketCDN lint with PHPCS. PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}. steps: From 9919efb06444e64ad3e41144841f50897c32c589 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 15:45:41 +0200 Subject: [PATCH 25/40] Fix installer issue --- .github/workflows/deploy-tag.yml | 2 ++ composer.json | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-tag.yml b/.github/workflows/deploy-tag.yml index 18b79ee..64fff3b 100644 --- a/.github/workflows/deploy-tag.yml +++ b/.github/workflows/deploy-tag.yml @@ -11,6 +11,8 @@ jobs: - uses: actions/checkout@master - name: normal build run: composer install + - name: remove installers + run: composer remove composer/installers - name: optimized build run: composer install -o --no-dev --no-scripts - name: WordPress Plugin Deploy diff --git a/composer.json b/composer.json index 5a87708..a2acabf 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,11 @@ ], "type": "wordpress-plugin", "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "composer/installers": true + } + }, "support": { "issues": "https://github.com/wp-media/rocketcdn-plugin/issues", From 4a0004c6fcbfa2aecdb67ed5b3d829c17a6de0b1 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 15:47:33 +0200 Subject: [PATCH 26/40] Fix phpcs issue --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a2acabf..37d7c2a 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "config": { "sort-packages": true, "allow-plugins": { - "composer/installers": true + "composer/installers": true, + "dealerdirect/phpcodesniffer-composer-installer": true } }, From ca232afdb30fe905e8f138052eeaa5a5dfc8d785 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 15:49:42 +0200 Subject: [PATCH 27/40] Fix script issue --- .github/workflows/lint_phpcs.yml | 2 +- .github/workflows/test_php8.yml | 2 +- .github/workflows/test_rocketcdn.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint_phpcs.yml b/.github/workflows/lint_phpcs.yml index 95d1e02..6126970 100644 --- a/.github/workflows/lint_phpcs.yml +++ b/.github/workflows/lint_phpcs.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['8.0'] + php-versions: ['8.1'] name: RocketCDN lint with PHPCS. PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}. steps: diff --git a/.github/workflows/test_php8.yml b/.github/workflows/test_php8.yml index 2a82dc9..a5cadb1 100644 --- a/.github/workflows/test_php8.yml +++ b/.github/workflows/test_php8.yml @@ -61,7 +61,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-scripts --ignore-platform-reqs + run: composer install --prefer-dist --no-interaction --ignore-platform-reqs - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/.github/workflows/test_rocketcdn.yml b/.github/workflows/test_rocketcdn.yml index 2523778..6642ac5 100644 --- a/.github/workflows/test_rocketcdn.yml +++ b/.github/workflows/test_rocketcdn.yml @@ -62,7 +62,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-scripts + run: composer install --prefer-dist --no-interaction - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} From f1e852a469091c8a5dd0b379d9f84385b36253ea Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 16:10:26 +0200 Subject: [PATCH 28/40] Added fixes for unit tests --- .github/workflows/test_rocketcdn.yml | 2 +- tests/Fixtures/src/Options/Options/delete.php | 10 ------ tests/Fixtures/src/Options/Options/get.php | 33 ------------------- .../src/Options/Options/getOptionName.php | 17 ---------- tests/Fixtures/src/Options/Options/set.php | 15 --------- tests/Unit/src/API/Client/getCustomerData.php | 4 +-- .../Unit/src/API/Client/getWebsiteCdnUrl.php | 4 +-- tests/Unit/src/API/Client/isWebsiteSync.php | 4 +-- tests/Unit/src/API/Client/purgeCache.php | 5 +-- .../AdminBar/AdminBar/addAdminBarMenu.php | 5 +-- .../Admin/AdminBar/AdminBar/enqueueStyle.php | 3 +- .../Admin/AdminBar/AdminBar/purgeCache.php | 5 +-- .../Notices/Notices/emptyApiKeyNotice.php | 5 +-- .../Notices/Notices/wrongApiKeyNotice.php | 6 ++-- .../Admin/Settings/Page/configureSettings.php | 4 +-- .../src/Admin/Settings/Page/enqueueAssets.php | 5 +-- .../src/Admin/Settings/Page/purgeCache.php | 5 +-- .../src/Admin/Settings/Page/renderPage.php | 5 +-- .../src/Admin/Settings/Page/saveCdnUrl.php | 5 +-- .../src/Admin/Settings/Page/updateApiKey.php | 5 +-- .../Admin/Settings/Page/validateApiKey.php | 5 +-- tests/Unit/src/Front/CDN/addPreconnectCdn.php | 5 +-- tests/Unit/src/Front/CDN/endBuffering.php | 5 +-- tests/Unit/src/Front/CDN/rewriteUrl.php | 5 +-- tests/Unit/src/Front/CDN/startBuffering.php | 4 +-- tests/Unit/src/Options/Options/delete.php | 25 -------------- tests/Unit/src/Options/Options/get.php | 27 --------------- .../src/Options/Options/getOptionName.php | 22 ------------- tests/Unit/src/Options/Options/set.php | 25 -------------- 29 files changed, 40 insertions(+), 230 deletions(-) delete mode 100644 tests/Fixtures/src/Options/Options/delete.php delete mode 100644 tests/Fixtures/src/Options/Options/get.php delete mode 100644 tests/Fixtures/src/Options/Options/getOptionName.php delete mode 100644 tests/Fixtures/src/Options/Options/set.php delete mode 100644 tests/Unit/src/Options/Options/delete.php delete mode 100644 tests/Unit/src/Options/Options/get.php delete mode 100644 tests/Unit/src/Options/Options/getOptionName.php delete mode 100644 tests/Unit/src/Options/Options/set.php diff --git a/.github/workflows/test_rocketcdn.yml b/.github/workflows/test_rocketcdn.yml index 6642ac5..e51ab38 100644 --- a/.github/workflows/test_rocketcdn.yml +++ b/.github/workflows/test_rocketcdn.yml @@ -62,7 +62,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction + run: composer install --prefer-dist --no-interaction --ignore-platform-reqs - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/tests/Fixtures/src/Options/Options/delete.php b/tests/Fixtures/src/Options/Options/delete.php deleted file mode 100644 index d6fcb4d..0000000 --- a/tests/Fixtures/src/Options/Options/delete.php +++ /dev/null @@ -1,10 +0,0 @@ - [ - 'config' => [ - 'prefix' => 'prefix', - 'name' => 'name', - ], - 'expected' => 'prefixname', - ], -]; diff --git a/tests/Fixtures/src/Options/Options/get.php b/tests/Fixtures/src/Options/Options/get.php deleted file mode 100644 index 82bb3b5..0000000 --- a/tests/Fixtures/src/Options/Options/get.php +++ /dev/null @@ -1,33 +0,0 @@ - [ - 'config' => [ - 'prefix' => 'prefix', - 'option_name' => 'option_name', - 'default' => 'default', - 'name' => 'name', - 'option' => 'option', - ], - 'expected' => 'option', - ], - 'testShouldReturnDefaultWhenNotExisting' => [ - 'config' => [ - 'prefix' => 'prefix', - 'option_name' => 'option_name', - 'default' => 'default', - 'name' => 'name', - 'option' => 'default', - ], - 'expected' => 'default', - ], - 'testShouldReturnConvertedValueWhenNotArray' => [ - 'config' => [ - 'prefix' => 'prefix', - 'option_name' => 'option_name', - 'default' => [], - 'name' => 'name', - 'option' => 'option', - ], - 'expected' => (array) 'option', - ], -]; diff --git a/tests/Fixtures/src/Options/Options/getOptionName.php b/tests/Fixtures/src/Options/Options/getOptionName.php deleted file mode 100644 index 3a5100a..0000000 --- a/tests/Fixtures/src/Options/Options/getOptionName.php +++ /dev/null @@ -1,17 +0,0 @@ - [ - 'config' => [ - 'prefix' => '', - 'name' => 'name', - ], - 'expected' => 'name', - ], - 'testPrefixNonEmptyShouldReturnExpected' => [ - 'config' => [ - 'prefix' => 'prefix', - 'name' => 'name', - ], - 'expected' => 'prefixname', - ], -]; diff --git a/tests/Fixtures/src/Options/Options/set.php b/tests/Fixtures/src/Options/Options/set.php deleted file mode 100644 index f782897..0000000 --- a/tests/Fixtures/src/Options/Options/set.php +++ /dev/null @@ -1,15 +0,0 @@ - [ - 'config' => [ - 'prefix' => 'prefix', - 'name' => 'name', - 'value' => 'value', - ], - 'expected' => [ - 'option_name' => 'prefixname', - 'value' => 'value', - ], - ], -]; diff --git a/tests/Unit/src/API/Client/getCustomerData.php b/tests/Unit/src/API/Client/getCustomerData.php index 3a1d028..e8d65f7 100644 --- a/tests/Unit/src/API/Client/getCustomerData.php +++ b/tests/Unit/src/API/Client/getCustomerData.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -21,8 +20,7 @@ class Test_GetCustomerData extends TestCase { protected function setUp(): void { parent::setUp(); - $options_api = Mockery::mock( Options::class ); - $this->client = new Client( $options_api ); + $this->client = new Client(); } /** diff --git a/tests/Unit/src/API/Client/getWebsiteCdnUrl.php b/tests/Unit/src/API/Client/getWebsiteCdnUrl.php index fd6652d..6af6a02 100644 --- a/tests/Unit/src/API/Client/getWebsiteCdnUrl.php +++ b/tests/Unit/src/API/Client/getWebsiteCdnUrl.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; /** @@ -19,8 +18,7 @@ class Test_GetWebsiteCdnUrl extends TestCase { protected function setUp(): void { parent::setUp(); - $options_api = Mockery::mock( Options::class ); - $this->client = Mockery::mock( Client::class . '[get_customer_data]', [ $options_api ] ); + $this->client = Mockery::mock( Client::class . '[get_customer_data]' ); } /** diff --git a/tests/Unit/src/API/Client/isWebsiteSync.php b/tests/Unit/src/API/Client/isWebsiteSync.php index 432a4d5..9fa8378 100644 --- a/tests/Unit/src/API/Client/isWebsiteSync.php +++ b/tests/Unit/src/API/Client/isWebsiteSync.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; /** @@ -18,8 +17,7 @@ class Test_IsWebsiteSync extends TestCase { protected function setUp(): void { parent::setUp(); - $options_api = Mockery::mock( Options::class ); - $this->client = Mockery::mock( Client::class . '[get_customer_data]', [ $options_api ] ); + $this->client = Mockery::mock( Client::class . '[get_customer_data]' ); } /** diff --git a/tests/Unit/src/API/Client/purgeCache.php b/tests/Unit/src/API/Client/purgeCache.php index a3af076..1712e97 100644 --- a/tests/Unit/src/API/Client/purgeCache.php +++ b/tests/Unit/src/API/Client/purgeCache.php @@ -4,8 +4,8 @@ use Mockery; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use Brain\Monkey\Functions; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -27,7 +27,8 @@ public function testShouldReturnAsExcepted( $config, $expected ) { } else { $options_api->expects()->get( 'cdn_url' )->never(); } - $client = new Client( $options_api ); + $client = new Client(); + $client->set_options($options_api); Functions\expect( '__' )->zeroOrMoreTimes() ->andReturnFirstArg(); if ( $config['api'] && $config['cdn'] ) { diff --git a/tests/Unit/src/Admin/AdminBar/AdminBar/addAdminBarMenu.php b/tests/Unit/src/Admin/AdminBar/AdminBar/addAdminBarMenu.php index fc95a5e..da83e49 100644 --- a/tests/Unit/src/Admin/AdminBar/AdminBar/addAdminBarMenu.php +++ b/tests/Unit/src/Admin/AdminBar/AdminBar/addAdminBarMenu.php @@ -5,7 +5,7 @@ use Mockery; use RocketCDN\Admin\AdminBar\AdminBar; use RocketCDN\API\Client; -use RocketCDN\Options\Options; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; use WP_Admin_Bar; @@ -25,7 +25,8 @@ protected function setUp(): void { $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); $this->admin_bar = Mockery::mock( WP_Admin_Bar::class ); - $this->admin_bar_menu = new AdminBar( $this->options, $this->client, '/' ); + $this->admin_bar_menu = new AdminBar( $this->client, '/' ); + $this->admin_bar_menu->set_options($this->options); parent::setUp(); } diff --git a/tests/Unit/src/Admin/AdminBar/AdminBar/enqueueStyle.php b/tests/Unit/src/Admin/AdminBar/AdminBar/enqueueStyle.php index aa6310d..7360779 100644 --- a/tests/Unit/src/Admin/AdminBar/AdminBar/enqueueStyle.php +++ b/tests/Unit/src/Admin/AdminBar/AdminBar/enqueueStyle.php @@ -5,7 +5,6 @@ use Mockery; use RocketCDN\Admin\AdminBar\AdminBar; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -20,7 +19,7 @@ class Test_EnqueueStyle extends TestCase { * @dataProvider configTestData */ public function testShouldReturnExpected( $config, $expected ) { - $admin_bar = new AdminBar( Mockery::mock( Options::class ), Mockery::mock( Client::class ), $config['base'] ); + $admin_bar = new AdminBar( Mockery::mock( Client::class ), $config['base'] ); Functions\expect( 'wp_enqueue_style' ) ->with( $expected['id'], $expected['path'], $expected['options'], $expected['version'] ); $admin_bar->enqueue_style(); diff --git a/tests/Unit/src/Admin/AdminBar/AdminBar/purgeCache.php b/tests/Unit/src/Admin/AdminBar/AdminBar/purgeCache.php index 3f721b1..18c4340 100644 --- a/tests/Unit/src/Admin/AdminBar/AdminBar/purgeCache.php +++ b/tests/Unit/src/Admin/AdminBar/AdminBar/purgeCache.php @@ -5,7 +5,6 @@ use Mockery; use RocketCDN\Admin\AdminBar\AdminBar; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -16,14 +15,12 @@ */ class Test_PurgeCache extends TestCase { - protected $options; protected $client; protected $admin_bar_menu; protected function setUp(): void { - $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->admin_bar_menu = Mockery::mock( AdminBar::class . '[exit]', [ $this->options, $this->client, '/' ] ) + $this->admin_bar_menu = Mockery::mock( AdminBar::class . '[exit]', [ $this->client, '/' ] ) ->shouldAllowMockingProtectedMethods(); parent::setUp(); } diff --git a/tests/Unit/src/Admin/Notices/Notices/emptyApiKeyNotice.php b/tests/Unit/src/Admin/Notices/Notices/emptyApiKeyNotice.php index 831b659..fb5341c 100644 --- a/tests/Unit/src/Admin/Notices/Notices/emptyApiKeyNotice.php +++ b/tests/Unit/src/Admin/Notices/Notices/emptyApiKeyNotice.php @@ -5,7 +5,7 @@ use Mockery; use RocketCDN\Admin\Notices\Notices; use RocketCDN\API\Client; -use RocketCDN\Options\Options; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -23,7 +23,8 @@ class Test_EmptyApiKeyNotice extends TestCase { protected function setUp(): void { $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->notices = new Notices( $this->options, $this->client ); + $this->notices = new Notices( $this->client ); + $this->notices->set_options($this->options); parent::setUp(); } diff --git a/tests/Unit/src/Admin/Notices/Notices/wrongApiKeyNotice.php b/tests/Unit/src/Admin/Notices/Notices/wrongApiKeyNotice.php index eb59206..675cab4 100644 --- a/tests/Unit/src/Admin/Notices/Notices/wrongApiKeyNotice.php +++ b/tests/Unit/src/Admin/Notices/Notices/wrongApiKeyNotice.php @@ -4,6 +4,7 @@ use Mockery; use RocketCDN\Admin\Notices\Notices; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -19,9 +20,10 @@ class Test_WrongApiKeyNotice extends TestCase { protected $notices; protected function setUp(): void { - $this->options = Mockery::mock( \RocketCDN\Options\Options::class ); + $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( \RocketCDN\API\Client::class ); - $this->notices = new Notices( $this->options, $this->client ); + $this->notices = new Notices( $this->client ); + $this->notices->set_options($this->options); parent::setUp(); } diff --git a/tests/Unit/src/Admin/Settings/Page/configureSettings.php b/tests/Unit/src/Admin/Settings/Page/configureSettings.php index 9bbfad5..9c66934 100644 --- a/tests/Unit/src/Admin/Settings/Page/configureSettings.php +++ b/tests/Unit/src/Admin/Settings/Page/configureSettings.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use WPMedia\PHPUnit\Unit\TestCase; use Brain\Monkey\Functions; @@ -20,9 +19,8 @@ class Test_ConfigureSettings extends TestCase { protected function setUp(): void { parent::setUp(); - $options_api = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $options_api, $this->client, '/', '/' ); + $this->page = new Page( $this->client, '/', '/' ); } public function testShouldRegister() { diff --git a/tests/Unit/src/Admin/Settings/Page/enqueueAssets.php b/tests/Unit/src/Admin/Settings/Page/enqueueAssets.php index 67e78de..e372d62 100644 --- a/tests/Unit/src/Admin/Settings/Page/enqueueAssets.php +++ b/tests/Unit/src/Admin/Settings/Page/enqueueAssets.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -14,15 +13,13 @@ * @group Settings */ class Test_EnqueueAssets extends TestCase { - protected $options; protected $client; protected $page; protected function setUp(): void { parent::setUp(); - $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); } /** * @dataProvider configTestData diff --git a/tests/Unit/src/Admin/Settings/Page/purgeCache.php b/tests/Unit/src/Admin/Settings/Page/purgeCache.php index 2335366..eeafe64 100644 --- a/tests/Unit/src/Admin/Settings/Page/purgeCache.php +++ b/tests/Unit/src/Admin/Settings/Page/purgeCache.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -14,15 +13,13 @@ * @group Settings */ class Test_PurgeCache extends TestCase { - protected $options; protected $client; protected $page; protected function setUp(): void { parent::setUp(); - $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); } /** diff --git a/tests/Unit/src/Admin/Settings/Page/renderPage.php b/tests/Unit/src/Admin/Settings/Page/renderPage.php index a91d5a9..3cb714f 100644 --- a/tests/Unit/src/Admin/Settings/Page/renderPage.php +++ b/tests/Unit/src/Admin/Settings/Page/renderPage.php @@ -4,8 +4,8 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use Brain\Monkey\Functions; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -23,7 +23,8 @@ protected function setUp(): void { parent::setUp(); $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page->set_options($this->options); } /** diff --git a/tests/Unit/src/Admin/Settings/Page/saveCdnUrl.php b/tests/Unit/src/Admin/Settings/Page/saveCdnUrl.php index edccdca..59219fe 100644 --- a/tests/Unit/src/Admin/Settings/Page/saveCdnUrl.php +++ b/tests/Unit/src/Admin/Settings/Page/saveCdnUrl.php @@ -4,7 +4,7 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -21,7 +21,8 @@ protected function setUp(): void { parent::setUp(); $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page->set_options($this->options); } /** diff --git a/tests/Unit/src/Admin/Settings/Page/updateApiKey.php b/tests/Unit/src/Admin/Settings/Page/updateApiKey.php index 9d2e3fa..3a62e4d 100644 --- a/tests/Unit/src/Admin/Settings/Page/updateApiKey.php +++ b/tests/Unit/src/Admin/Settings/Page/updateApiKey.php @@ -4,8 +4,8 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use Brain\Monkey\Functions; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -23,7 +23,8 @@ protected function setUp(): void { parent::setUp(); $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page->set_options($this->options); } /** diff --git a/tests/Unit/src/Admin/Settings/Page/validateApiKey.php b/tests/Unit/src/Admin/Settings/Page/validateApiKey.php index 5932d17..2c5d72d 100644 --- a/tests/Unit/src/Admin/Settings/Page/validateApiKey.php +++ b/tests/Unit/src/Admin/Settings/Page/validateApiKey.php @@ -5,7 +5,6 @@ use Mockery; use RocketCDN\Admin\Settings\Page; use RocketCDN\API\Client; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -15,15 +14,13 @@ */ class Test_ValidateApiKey extends TestCase { - protected $options; protected $client; protected $page; protected function setUp(): void { parent::setUp(); - $this->options = Mockery::mock( Options::class ); $this->client = Mockery::mock( Client::class ); - $this->page = new Page( $this->options, $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); + $this->page = new Page( $this->client, WP_ROCKET_CDN_PLUGIN_ROOT . '/views/', '/' ); } /** diff --git a/tests/Unit/src/Front/CDN/addPreconnectCdn.php b/tests/Unit/src/Front/CDN/addPreconnectCdn.php index 650e904..360718a 100644 --- a/tests/Unit/src/Front/CDN/addPreconnectCdn.php +++ b/tests/Unit/src/Front/CDN/addPreconnectCdn.php @@ -3,8 +3,8 @@ namespace RocketCDN\Tests\Unit\src\Front\CDN; use Mockery; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Front\CDN; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; /** @@ -20,7 +20,8 @@ class Test_AddPreconnectCdn extends TestCase { protected function setUp(): void { parent::setUp(); $this->options = Mockery::mock( Options::class ); - $this->cdn = Mockery::mock( CDN::class . '[should_rewrite]', [ $this->options ] )->shouldAllowMockingProtectedMethods(); + $this->cdn = Mockery::mock( CDN::class . '[should_rewrite]' )->shouldAllowMockingProtectedMethods(); + $this->cdn->set_options($this->options); } /** * @dataProvider configTestData diff --git a/tests/Unit/src/Front/CDN/endBuffering.php b/tests/Unit/src/Front/CDN/endBuffering.php index 9e54aa9..b3c5bf1 100644 --- a/tests/Unit/src/Front/CDN/endBuffering.php +++ b/tests/Unit/src/Front/CDN/endBuffering.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\Front\CDN; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -21,13 +20,11 @@ */ class Test_EndBuffering extends TestCase { - protected $options; protected $cdn; protected function setUp(): void { parent::setUp(); - $this->options = Mockery::mock( Options::class ); - $this->cdn = Mockery::mock( CDN::class . '[rewrite_url]', [ $this->options ] ); + $this->cdn = Mockery::mock( CDN::class . '[rewrite_url]' ); } /** * @dataProvider configTestData diff --git a/tests/Unit/src/Front/CDN/rewriteUrl.php b/tests/Unit/src/Front/CDN/rewriteUrl.php index 5ee4284..8b50313 100644 --- a/tests/Unit/src/Front/CDN/rewriteUrl.php +++ b/tests/Unit/src/Front/CDN/rewriteUrl.php @@ -3,8 +3,8 @@ namespace RocketCDN\Tests\Unit\src\Front\CDN; use Mockery; +use RocketCDN\Dependencies\LaunchpadOptions\Options; use RocketCDN\Front\CDN; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -22,7 +22,8 @@ class Test_RewriteUrl extends TestCase { protected function setUp(): void { parent::setUp(); $this->options = Mockery::mock( Options::class ); - $this->cdn = new CDN( $this->options ); + $this->cdn = new CDN(); + $this->cdn->set_options($this->options); } /** diff --git a/tests/Unit/src/Front/CDN/startBuffering.php b/tests/Unit/src/Front/CDN/startBuffering.php index 8b372b3..8ce91e4 100644 --- a/tests/Unit/src/Front/CDN/startBuffering.php +++ b/tests/Unit/src/Front/CDN/startBuffering.php @@ -4,7 +4,6 @@ use Mockery; use RocketCDN\Front\CDN; -use RocketCDN\Options\Options; use RocketCDN\Tests\Unit\TestCase; use Brain\Monkey\Functions; @@ -20,8 +19,7 @@ class Test_StartBuffering extends TestCase { protected function setUp(): void { parent::setUp(); - $options = Mockery::mock( Options::class ); - $this->cdn = new CDN( $options ); + $this->cdn = new CDN(); } /** * @dataProvider configTestData diff --git a/tests/Unit/src/Options/Options/delete.php b/tests/Unit/src/Options/Options/delete.php deleted file mode 100644 index 7015677..0000000 --- a/tests/Unit/src/Options/Options/delete.php +++ /dev/null @@ -1,25 +0,0 @@ -with( $expected ); - $option->delete( $config['name'] ); - } -} diff --git a/tests/Unit/src/Options/Options/get.php b/tests/Unit/src/Options/Options/get.php deleted file mode 100644 index bf30126..0000000 --- a/tests/Unit/src/Options/Options/get.php +++ /dev/null @@ -1,27 +0,0 @@ -with( $config['option_name'], $config['default'] ) - ->andReturn( $config['option'] ); - $this->assertEquals( $expected, $option->get( $config['name'], $config['default'] ) ); - } -} diff --git a/tests/Unit/src/Options/Options/getOptionName.php b/tests/Unit/src/Options/Options/getOptionName.php deleted file mode 100644 index c82fc8e..0000000 --- a/tests/Unit/src/Options/Options/getOptionName.php +++ /dev/null @@ -1,22 +0,0 @@ -assertEquals( $expected, $option->get_option_name( $config['name'] ) ); - } -} diff --git a/tests/Unit/src/Options/Options/set.php b/tests/Unit/src/Options/Options/set.php deleted file mode 100644 index 7f3c588..0000000 --- a/tests/Unit/src/Options/Options/set.php +++ /dev/null @@ -1,25 +0,0 @@ -with( $expected['option_name'], $expected['value'] ); - $option->set( $config['name'], $config['value'] ); - } -} From fc94921f54ff6f2dd05bd027b8c1f40c75a43388 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 16:19:35 +0200 Subject: [PATCH 29/40] Retrograde mozart --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 37d7c2a..fceff48 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "require-dev": { "php": "^7 || ^8", "brain/monkey": "^2.0", - "coenjacobs/mozart": "^0.7", + "coenjacobs/mozart": "^0.5.1", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "league/container": "^3.3", "phpcompatibility/phpcompatibility-wp": "^2.0", From 5880b179bef1ef0e99949d258c57a20378613111 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 16:23:02 +0200 Subject: [PATCH 30/40] Retrograde mozart --- composer.lock | 299 +++++++++++++++++++++++++------------------------- 1 file changed, 152 insertions(+), 147 deletions(-) diff --git a/composer.lock b/composer.lock index 054312b..c680817 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "05d14a7ac2d918dedecab2a7125d6243", + "content-hash": "22246a4fde2b733124fb799855ae6182", "packages": [ { "name": "composer/installers", @@ -279,29 +279,26 @@ }, { "name": "coenjacobs/mozart", - "version": "0.7.1", + "version": "0.5.1", "source": { "type": "git", "url": "https://github.com/coenjacobs/mozart.git", - "reference": "dbcdeb992d20d9c8914eef090f9a0d684bb1102c" + "reference": "4bdde231f3309d9299c87b2246166e87acc93653" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/coenjacobs/mozart/zipball/dbcdeb992d20d9c8914eef090f9a0d684bb1102c", - "reference": "dbcdeb992d20d9c8914eef090f9a0d684bb1102c", + "url": "https://api.github.com/repos/coenjacobs/mozart/zipball/4bdde231f3309d9299c87b2246166e87acc93653", + "reference": "4bdde231f3309d9299c87b2246166e87acc93653", "shasum": "" }, "require": { "league/flysystem": "^1.0", - "php": "^7.3|^8.0", + "php": "^7.2", "symfony/console": "^4|^5", "symfony/finder": "^4|^5" }, "require-dev": { - "mheap/phpunit-github-actions-printer": "^1.4", - "phpunit/phpunit": "^8.5", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.4" + "phpunit/phpunit": "^8.5" }, "bin": [ "bin/mozart" @@ -325,15 +322,9 @@ "description": "Composes all dependencies as a package inside a WordPress plugin", "support": { "issues": "https://github.com/coenjacobs/mozart/issues", - "source": "https://github.com/coenjacobs/mozart/tree/0.7.1" + "source": "https://github.com/coenjacobs/mozart/tree/0.5.1" }, - "funding": [ - { - "url": "https://github.com/coenjacobs", - "type": "github" - } - ], - "time": "2021-02-02T21:37:03+00:00" + "time": "2019-12-23T12:24:56+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -860,16 +851,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.11", + "version": "1.6.12", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "81a161d0b135df89951abd52296adf97deb0723d" + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/81a161d0b135df89951abd52296adf97deb0723d", - "reference": "81a161d0b135df89951abd52296adf97deb0723d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699", "shasum": "" }, "require": { @@ -939,20 +930,20 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2024-03-21T18:34:15+00:00" + "time": "2024-05-16T03:13:13+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -960,11 +951,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -990,7 +982,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -998,7 +990,7 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "phar-io/manifest", @@ -1424,16 +1416,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", "shasum": "" }, "require": { @@ -1482,9 +1474,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" }, - "time": "2024-04-09T21:13:58+00:00" + "time": "2024-05-21T05:55:05+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -1615,16 +1607,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.0", + "version": "1.29.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", "shasum": "" }, "require": { @@ -1656,9 +1648,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" }, - "time": "2024-05-06T12:04:23+00:00" + "time": "2024-05-31T08:52:43+00:00" }, { "name": "phpstan/phpstan", @@ -2168,12 +2160,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "8eea9afb8060c8ef05c89f02b123329f43e9ba4e" + "reference": "fed98f59fae0ca97a0753263270f4a8680d09f03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/8eea9afb8060c8ef05c89f02b123329f43e9ba4e", - "reference": "8eea9afb8060c8ef05c89f02b123329f43e9ba4e", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/fed98f59fae0ca97a0753263270f4a8680d09f03", + "reference": "fed98f59fae0ca97a0753263270f4a8680d09f03", "shasum": "" }, "conflict": { @@ -2181,6 +2173,10 @@ "admidio/admidio": "<4.2.13", "adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3", "aheinze/cockpit": "<2.2", + "aimeos/ai-admin-graphql": ">=2022.04.1,<2022.10.10|>=2023.04.1,<2023.10.6|>=2024.04.1,<2024.04.6", + "aimeos/ai-admin-jsonadm": "<2020.10.13|>=2021.04.1,<2021.10.6|>=2022.04.1,<2022.10.3|>=2023.04.1,<2023.10.4|==2024.04.1", + "aimeos/ai-client-html": ">=2020.04.1,<2020.10.27|>=2021.04.1,<2021.10.22|>=2022.04.1,<2022.10.13|>=2023.04.1,<2023.10.15|>=2024.04.1,<2024.04.7", + "aimeos/aimeos-core": ">=2022.04.1,<2022.10.17|>=2023.04.1,<2023.10.17|>=2024.04.1,<2024.04.7", "aimeos/aimeos-typo3": "<19.10.12|>=20,<20.10.5", "airesvsg/acf-to-rest-api": "<=3.1", "akaunting/akaunting": "<2.1.13", @@ -2231,6 +2227,7 @@ "bmarshall511/wordpress_zero_spam": "<5.2.13", "bolt/bolt": "<3.7.2", "bolt/core": "<=4.2", + "born05/craft-twofactorauthentication": "<3.3.4", "bottelet/flarepoint": "<2.2.1", "bref/bref": "<2.1.17", "brightlocal/phpwhois": "<=4.2.5", @@ -2246,6 +2243,7 @@ "cardgate/magento2": "<2.0.33", "cardgate/woocommerce": "<=3.1.15", "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", + "cart2quote/module-quotation-encoded": ">=4.1.6,<=4.4.5|>=5,<5.4.4", "cartalyst/sentry": "<=2.1.6", "catfan/medoo": "<1.7.5", "causal/oidc": "<2.1", @@ -2261,7 +2259,7 @@ "codeigniter4/framework": "<4.4.7", "codeigniter4/shield": "<1.0.0.0-beta8", "codiad/codiad": "<=2.8.4", - "composer/composer": "<1.10.27|>=2,<2.2.23|>=2.3,<2.7", + "composer/composer": "<1.10.27|>=2,<2.2.24|>=2.3,<2.7.7", "concrete5/concrete5": "<9.2.8", "concrete5/core": "<8.5.8|>=9,<9.1", "contao-components/mediaelement": ">=2.14.2,<2.21.1", @@ -2294,11 +2292,11 @@ "doctrine/common": "<2.4.3|>=2.5,<2.5.1", "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2|>=3,<3.1.4", "doctrine/doctrine-bundle": "<1.5.2", - "doctrine/doctrine-module": "<=0.7.1", + "doctrine/doctrine-module": "<0.7.2", "doctrine/mongodb-odm": "<1.0.2", "doctrine/mongodb-odm-bundle": "<3.0.1", - "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", - "dolibarr/dolibarr": "<=19", + "doctrine/orm": ">=1,<1.2.4|>=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", + "dolibarr/dolibarr": "<19.0.2", "dompdf/dompdf": "<2.0.4", "doublethreedigital/guest-entries": "<3.1.2", "drupal/core": ">=6,<6.38|>=7,<7.96|>=8,<10.1.8|>=10.2,<10.2.2", @@ -2335,7 +2333,7 @@ "ezsystems/ezplatform-solr-search-engine": ">=1.7,<1.7.12|>=2,<2.0.2|>=3.3,<3.3.15", "ezsystems/ezplatform-user": ">=1,<1.0.1", "ezsystems/ezpublish-kernel": "<6.13.8.2-dev|>=7,<7.5.31", - "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.06,<=2019.03.5.1", + "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.03.5.1", "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", "ezsystems/repository-forms": ">=2.3,<2.3.2.1-dev|>=2.5,<2.5.15", "ezyang/htmlpurifier": "<4.1.1", @@ -2369,7 +2367,7 @@ "frappant/frp-form-answers": "<3.1.2|>=4,<4.0.2", "friendsofsymfony/oauth2-php": "<1.3", "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", - "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", + "friendsofsymfony/user-bundle": ">=1,<1.3.5", "friendsofsymfony1/swiftmailer": ">=4,<5.4.13|>=6,<6.2.5", "friendsofsymfony1/symfony1": ">=1.1,<1.15.19", "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", @@ -2381,7 +2379,8 @@ "funadmin/funadmin": "<=3.2|>=3.3.2,<=3.3.3", "gaoming13/wechat-php-sdk": "<=1.10.2", "genix/cms": "<=1.1.11", - "getgrav/grav": "<1.7.45", + "getformwork/formwork": "<1.13.1|==2.0.0.0-beta1", + "getgrav/grav": "<1.7.46", "getkirby/cms": "<4.1.1", "getkirby/kirby": "<=2.5.12", "getkirby/panel": "<2.5.14", @@ -2394,7 +2393,7 @@ "gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3", "gree/jose": "<2.2.1", "gregwar/rst": "<1.0.3", - "grumpydictator/firefly-iii": "<6.1.7", + "grumpydictator/firefly-iii": "<6.1.17", "gugoan/economizzer": "<=0.9.0.0-beta1", "guzzlehttp/guzzle": "<6.5.8|>=7,<7.4.5", "guzzlehttp/psr7": "<1.9.1|>=2,<2.4.5", @@ -2418,7 +2417,7 @@ "idno/known": "<=1.3.1", "ilicmiljan/secure-props": ">=1.2,<1.2.2", "illuminate/auth": "<5.5.10", - "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.99999|>=4.2,<=4.2.99999|>=5,<=5.0.99999|>=5.1,<=5.1.99999|>=5.2,<=5.2.99999|>=5.3,<=5.3.99999|>=5.4,<=5.4.99999|>=5.5,<=5.5.49|>=5.6,<=5.6.99999|>=5.7,<=5.7.99999|>=5.8,<=5.8.99999|>=6,<6.18.31|>=7,<7.22.4", + "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<6.18.31|>=7,<7.22.4", "illuminate/database": "<6.20.26|>=7,<7.30.5|>=8,<8.40", "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", "illuminate/view": "<6.20.42|>=7,<7.30.6|>=8,<8.75", @@ -2451,6 +2450,7 @@ "jsdecena/laracom": "<2.0.9", "jsmitty12/phpwhois": "<5.1", "juzaweb/cms": "<=3.4", + "jweiland/events2": "<8.3.8|>=9,<9.0.6", "kazist/phpwhois": "<=4.2.6", "kelvinmo/simplexrd": "<3.1.1", "kevinpapst/kimai2": "<1.16.7", @@ -2470,7 +2470,7 @@ "laravel/fortify": "<1.11.1", "laravel/framework": "<6.20.44|>=7,<7.30.6|>=8,<8.75", "laravel/laravel": ">=5.4,<5.4.22", - "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", + "laravel/socialite": ">=1,<2.0.10", "latte/latte": "<2.10.8", "lavalite/cms": "<=9|==10.1", "lcobucci/jwt": ">=3.4,<3.4.6|>=4,<4.0.4|>=4.1,<4.1.5", @@ -2488,7 +2488,7 @@ "lms/routes": "<2.1.1", "localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2", "luyadev/yii-helpers": "<1.2.1", - "magento/community-edition": "<2.4.3.0-patch3|>=2.4.4,<2.4.5", + "magento/community-edition": "<2.4.5|==2.4.5|>=2.4.5.0-patch1,<2.4.5.0-patch8|==2.4.6|>=2.4.6.0-patch1,<2.4.6.0-patch6|==2.4.7", "magento/core": "<=1.9.4.5", "magento/magento1ce": "<1.9.4.3-dev", "magento/magento1ee": ">=1,<1.14.4.3-dev", @@ -2521,7 +2521,7 @@ "mojo42/jirafeau": "<4.4", "mongodb/mongodb": ">=1,<1.9.2", "monolog/monolog": ">=1.8,<1.12", - "moodle/moodle": "<=4.3.3", + "moodle/moodle": "<4.3.5|>=4.4.0.0-beta,<4.4.1", "mos/cimage": "<0.7.19", "movim/moxl": ">=0.8,<=0.10", "movingbytes/social-network": "<=1.2.1", @@ -2539,8 +2539,8 @@ "neos/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", "neos/form": ">=1.2,<4.3.3|>=5,<5.0.9|>=5.1,<5.1.3", "neos/media-browser": "<7.3.19|>=8,<8.0.16|>=8.1,<8.1.11|>=8.2,<8.2.11|>=8.3,<8.3.9", - "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<5.3.10|>=7,<7.0.9|>=7.1,<7.1.7|>=7.2,<7.2.6|>=7.3,<7.3.4|>=8,<8.0.2", - "neos/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", + "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<5.3.10|>=7,<7.0.9|>=7.1,<7.1.7|>=7.2,<7.2.6|>=7.3,<7.3.4|>=8,<8.0.2", + "neos/swiftmailer": "<5.4.5", "netgen/tagsbundle": ">=3.4,<3.4.11|>=4,<4.0.15", "nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6", "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", @@ -2558,12 +2558,12 @@ "october/cms": "<1.0.469|==1.0.469|==1.0.471|==1.1.1", "october/october": "<=3.4.4", "october/rain": "<1.0.472|>=1.1,<1.1.2", - "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.34|>=3,<3.5.2", + "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.34|>=3,<3.5.15", "omeka/omeka-s": "<4.0.3", "onelogin/php-saml": "<2.10.4", "oneup/uploader-bundle": ">=1,<1.9.3|>=2,<2.1.5", "open-web-analytics/open-web-analytics": "<1.7.4", - "opencart/opencart": "<=3.0.3.7|>=4,<4.0.2.3-dev", + "opencart/opencart": "<=3.0.3.9|>=4", "openid/php-openid": "<2.3", "openmage/magento-lts": "<20.5", "opensolutions/vimbadmin": "<=3.0.15", @@ -2616,13 +2616,13 @@ "phpxmlrpc/extras": "<0.6.1", "phpxmlrpc/phpxmlrpc": "<4.9.2", "pi/pi": "<=2.5", - "pimcore/admin-ui-classic-bundle": "<1.3.4", + "pimcore/admin-ui-classic-bundle": "<=1.4.2", "pimcore/customer-management-framework-bundle": "<4.0.6", "pimcore/data-hub": "<1.2.4", "pimcore/demo": "<10.3", "pimcore/ecommerce-framework-bundle": "<1.0.10", "pimcore/perspective-editor": "<1.5.1", - "pimcore/pimcore": "<11.1.6.5-dev|>=11.2,<11.2.3", + "pimcore/pimcore": "<11.2.4", "pixelfed/pixelfed": "<0.11.11", "plotly/plotly.js": "<2.25.2", "pocketmine/bedrock-protocol": "<8.0.2", @@ -2687,7 +2687,7 @@ "silverstripe/admin": "<1.13.19|>=2,<2.1.8", "silverstripe/assets": ">=1,<1.11.1", "silverstripe/cms": "<4.11.3", - "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1", + "silverstripe/comments": ">=1.3,<3.1.1", "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", "silverstripe/framework": "<4.13.39|>=5,<5.1.11", "silverstripe/graphql": ">=2,<2.0.5|>=3,<3.8.2|>=4,<4.3.7|>=5,<5.1.3", @@ -2713,8 +2713,8 @@ "slim/psr7": "<1.4.1|>=1.5,<1.5.1|>=1.6,<1.6.1", "slim/slim": "<2.6", "slub/slub-events": "<3.0.3", - "smarty/smarty": "<3.1.48|>=4,<4.3.1", - "snipe/snipe-it": "<=6.2.2", + "smarty/smarty": "<4.5.3|>=5,<5.1.1", + "snipe/snipe-it": "<6.4.2", "socalnick/scn-social-auth": "<1.15.2", "socialiteproviders/steam": "<1.1", "spatie/browsershot": "<3.57.4", @@ -2724,11 +2724,13 @@ "spoonity/tcpdf": "<6.2.22", "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1", "ssddanbrown/bookstack": "<22.02.3", - "statamic/cms": "<4.46", + "statamic/cms": "<4.46|>=5.3,<5.6.2", "stormpath/sdk": "<9.9.99", "studio-42/elfinder": "<2.1.62", + "studiomitte/friendlycaptcha": "<0.1.4", "subhh/libconnect": "<7.0.8|>=8,<8.1", "sukohi/surpass": "<1", + "sulu/form-bundle": ">=2,<2.5.3", "sulu/sulu": "<1.6.44|>=2,<2.4.17|>=2.5,<2.5.13", "sumocoders/framework-user-bundle": "<1.4", "superbig/craft-audit": "<3.0.2", @@ -2740,8 +2742,8 @@ "sylius/grid-bundle": "<1.10.1", "sylius/paypal-plugin": ">=1,<1.2.4|>=1.3,<1.3.1", "sylius/resource-bundle": ">=1,<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", - "sylius/sylius": "<1.12.16|>=1.13.0.0-alpha1,<1.13.1", - "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", + "sylius/sylius": "<1.9.10|>=1.10,<1.10.11|>=1.11,<1.11.2|>=1.12.0.0-alpha1,<1.12.16|>=1.13.0.0-alpha1,<1.13.1", + "symbiote/silverstripe-multivaluefield": ">=3,<3.1", "symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4", "symbiote/silverstripe-seed": "<6.0.3", "symbiote/silverstripe-versionedfiles": "<=2.0.3", @@ -2792,7 +2794,7 @@ "thorsten/phpmyfaq": "<3.2.2", "tikiwiki/tiki-manager": "<=17.1", "timber/timber": ">=0.16.6,<1.23.1|>=1.24,<1.24.1|>=2,<2.1", - "tinymce/tinymce": "<7", + "tinymce/tinymce": "<7.2", "tinymighty/wiki-seo": "<1.2.2", "titon/framework": "<9.9.99", "tobiasbg/tablepress": "<=2.0.0.0-RC1", @@ -2829,12 +2831,14 @@ "uvdesk/core-framework": "<=1.1.1", "vanilla/safecurl": "<0.9.2", "verbb/comments": "<1.5.5", + "verbb/formie": "<2.1.6", "verbb/image-resizer": "<2.0.9", "verbb/knock-knock": "<1.2.8", "verot/class.upload.php": "<=2.1.6", "villagedefrance/opencart-overclocked": "<=1.11.1", "vova07/yii2-fileapi-widget": "<0.1.9", "vrana/adminer": "<4.8.1", + "vufind/vufind": ">=2,<9.1.1", "waldhacker/hcaptcha": "<2.1.2", "wallabag/tcpdf": "<6.2.22", "wallabag/wallabag": "<2.6.7", @@ -2853,14 +2857,14 @@ "winter/wn-dusk-plugin": "<2.1", "winter/wn-system-module": "<1.2.4", "wintercms/winter": "<=1.2.3", - "woocommerce/woocommerce": "<6.6", + "woocommerce/woocommerce": "<6.6|>=8.8,<8.8.5|>=8.9,<8.9.3", "wp-cli/wp-cli": ">=0.12,<2.5", "wp-graphql/wp-graphql": "<=1.14.5", "wp-premium/gravityforms": "<2.4.21", "wpanel/wpanel4-cms": "<=4.3.1", "wpcloud/wp-stateless": "<3.2", "wpglobus/wpglobus": "<=1.9.6", - "wwbn/avideo": "<=12.4", + "wwbn/avideo": "<14.3", "xataface/xataface": "<3", "xpressengine/xpressengine": "<3.0.15", "yab/quarx": "<2.4.5", @@ -2869,7 +2873,7 @@ "yidashi/yii2cmf": "<=2", "yii2mod/yii2-cms": "<1.9.2", "yiisoft/yii": "<1.1.29", - "yiisoft/yii2": "<2.0.38", + "yiisoft/yii2": "<2.0.50", "yiisoft/yii2-authclient": "<2.2.15", "yiisoft/yii2-bootstrap": "<2.0.4", "yiisoft/yii2-dev": "<2.0.43", @@ -2896,7 +2900,7 @@ "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", "zendframework/zend-mail": "<2.4.11|>=2.5,<2.7.2", "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1", - "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4", + "zendframework/zend-session": ">=2,<2.2.9|>=2.3,<2.3.4", "zendframework/zend-validator": ">=2.3,<2.3.6", "zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1", "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6", @@ -2954,7 +2958,7 @@ "type": "tidelift" } ], - "time": "2024-05-14T22:04:50+00:00" + "time": "2024-07-02T22:05:16+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -3686,16 +3690,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.2", + "version": "3.10.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", "shasum": "" }, "require": { @@ -3762,20 +3766,20 @@ "type": "open_collective" } ], - "time": "2024-04-23T20:25:34+00:00" + "time": "2024-05-22T21:24:41+00:00" }, { "name": "symfony/console", - "version": "v5.4.39", + "version": "v5.4.41", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f3e591c48688a0cfa1a3296205926c05e84b22b1" + "reference": "6473d441a913cb997123b59ff2dbe3d1cf9e11ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f3e591c48688a0cfa1a3296205926c05e84b22b1", - "reference": "f3e591c48688a0cfa1a3296205926c05e84b22b1", + "url": "https://api.github.com/repos/symfony/console/zipball/6473d441a913cb997123b59ff2dbe3d1cf9e11ba", + "reference": "6473d441a913cb997123b59ff2dbe3d1cf9e11ba", "shasum": "" }, "require": { @@ -3845,7 +3849,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.39" + "source": "https://github.com/symfony/console/tree/v5.4.41" }, "funding": [ { @@ -3861,7 +3865,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T08:26:06+00:00" + "time": "2024-06-28T07:48:55+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3932,16 +3936,16 @@ }, { "name": "symfony/finder", - "version": "v5.4.39", + "version": "v5.4.40", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "f6a96e4fcd468a25fede16ee665f50ced856bd0a" + "reference": "f51cff4687547641c7d8180d74932ab40b2205ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/f6a96e4fcd468a25fede16ee665f50ced856bd0a", - "reference": "f6a96e4fcd468a25fede16ee665f50ced856bd0a", + "url": "https://api.github.com/repos/symfony/finder/zipball/f51cff4687547641c7d8180d74932ab40b2205ce", + "reference": "f51cff4687547641c7d8180d74932ab40b2205ce", "shasum": "" }, "require": { @@ -3975,7 +3979,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.39" + "source": "https://github.com/symfony/finder/tree/v5.4.40" }, "funding": [ { @@ -3991,20 +3995,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T08:26:06+00:00" + "time": "2024-05-31T14:33:22+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "0424dff1c58f028c451efff2045f5d92410bd540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540", "shasum": "" }, "require": { @@ -4054,7 +4058,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" }, "funding": [ { @@ -4070,20 +4074,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", "shasum": "" }, "require": { @@ -4132,7 +4136,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" }, "funding": [ { @@ -4148,20 +4152,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", "shasum": "" }, "require": { @@ -4213,7 +4217,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" }, "funding": [ { @@ -4229,20 +4233,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", "shasum": "" }, "require": { @@ -4293,7 +4297,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" }, "funding": [ { @@ -4309,20 +4313,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" + "reference": "ec444d3f3f6505bb28d11afa41e75faadebc10a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", - "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/ec444d3f3f6505bb28d11afa41e75faadebc10a1", + "reference": "ec444d3f3f6505bb28d11afa41e75faadebc10a1", "shasum": "" }, "require": { @@ -4369,7 +4373,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.30.0" }, "funding": [ { @@ -4385,20 +4389,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", "shasum": "" }, "require": { @@ -4449,7 +4453,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" }, "funding": [ { @@ -4465,7 +4469,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/service-contracts", @@ -4552,16 +4556,16 @@ }, { "name": "symfony/string", - "version": "v6.4.7", + "version": "v6.4.9", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69" + "reference": "76792dbd99690a5ebef8050d9206c60c59e681d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ffeb9591c61f65a68d47f77d12b83fa530227a69", - "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69", + "url": "https://api.github.com/repos/symfony/string/zipball/76792dbd99690a5ebef8050d9206c60c59e681d7", + "reference": "76792dbd99690a5ebef8050d9206c60c59e681d7", "shasum": "" }, "require": { @@ -4618,7 +4622,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.7" + "source": "https://github.com/symfony/string/tree/v6.4.9" }, "funding": [ { @@ -4634,7 +4638,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-06-28T09:25:38+00:00" }, { "name": "szepeviktor/phpstan-wordpress", @@ -4962,16 +4966,16 @@ }, { "name": "wp-launchpad/framework-options", - "version": "v0.1.2", + "version": "v0.1.3", "source": { "type": "git", "url": "https://github.com/wp-launchpad/framework-options.git", - "reference": "0941149bc7ba628a1c4fdf380eeef69969ed5ced" + "reference": "2484621a54734c8f0e07fc78cde84fb74faae3fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-launchpad/framework-options/zipball/0941149bc7ba628a1c4fdf380eeef69969ed5ced", - "reference": "0941149bc7ba628a1c4fdf380eeef69969ed5ced", + "url": "https://api.github.com/repos/wp-launchpad/framework-options/zipball/2484621a54734c8f0e07fc78cde84fb74faae3fd", + "reference": "2484621a54734c8f0e07fc78cde84fb74faae3fd", "shasum": "" }, "require": { @@ -4980,6 +4984,7 @@ "wp-launchpad/options": "^0.1" }, "require-dev": { + "wp-launchpad/phpunit-wp-hooks": "^1.0", "wp-media/phpunit": "^3.0" }, "type": "library", @@ -4992,22 +4997,22 @@ "description": "Options library for the framework Launchpad", "support": { "issues": "https://github.com/wp-launchpad/framework-options/issues", - "source": "https://github.com/wp-launchpad/framework-options/tree/v0.1.2" + "source": "https://github.com/wp-launchpad/framework-options/tree/v0.1.3" }, - "time": "2024-05-09T13:30:49+00:00" + "time": "2024-07-03T09:48:16+00:00" }, { "name": "wp-launchpad/options", - "version": "v0.1.2", + "version": "v0.1.3", "source": { "type": "git", "url": "https://github.com/wp-launchpad/options.git", - "reference": "fd55e0a440e819a1bb77d9140491b1c5faf648f6" + "reference": "22a6c3c5c73feac79be61fa6cd6f7ca3e034623a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-launchpad/options/zipball/fd55e0a440e819a1bb77d9140491b1c5faf648f6", - "reference": "fd55e0a440e819a1bb77d9140491b1c5faf648f6", + "url": "https://api.github.com/repos/wp-launchpad/options/zipball/22a6c3c5c73feac79be61fa6cd6f7ca3e034623a", + "reference": "22a6c3c5c73feac79be61fa6cd6f7ca3e034623a", "shasum": "" }, "require": { @@ -5023,9 +5028,9 @@ "description": "Options library for Launchpad", "support": { "issues": "https://github.com/wp-launchpad/options/issues", - "source": "https://github.com/wp-launchpad/options/tree/v0.1.2" + "source": "https://github.com/wp-launchpad/options/tree/v0.1.3" }, - "time": "2024-05-09T13:05:37+00:00" + "time": "2024-05-21T18:28:15+00:00" }, { "name": "wp-media/phpunit", @@ -5220,5 +5225,5 @@ "platform-dev": { "php": "^7 || ^8" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } From 969ce4c5fc4aba6b7aedf6f37116b69232f06961 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 3 Jul 2024 17:09:53 +0200 Subject: [PATCH 31/40] Added back dependencies --- .github/workflows/deploy-tag.yml | 2 - .github/workflows/test_php8.yml | 2 +- .github/workflows/test_rocketcdn.yml | 2 +- .gitignore | 1 - composer.json | 2 +- composer.lock | 27 +- .../LaunchpadCore/Activation/Activation.php | 158 ++++++++++ .../Activation/ActivationInterface.php | 14 + .../ActivationServiceProviderInterface.php | 8 + .../HasActivatorServiceProviderInterface.php | 13 + .../Container/AbstractServiceProvider.php | 136 +++++++++ .../Container/HasInflectorInterface.php | 20 ++ .../InflectorServiceProviderTrait.php | 46 +++ .../IsOptimizableServiceProvider.php | 8 + .../LaunchpadCore/Container/PrefixAware.php | 23 ++ .../Container/PrefixAwareInterface.php | 13 + .../LaunchpadCore/Container/Registration.php | 95 ++++++ .../Container/ServiceProviderInterface.php | 44 +++ .../Deactivation/Deactivation.php | 158 ++++++++++ .../Deactivation/DeactivationInterface.php | 13 + .../DeactivationServiceProviderInterface.php | 8 + ...HasDeactivatorServiceProviderInterface.php | 13 + .../Dispatcher/DispatcherAwareInterface.php | 17 ++ .../Dispatcher/DispatcherAwareTrait.php | 26 ++ .../SubscriberSignaturesSanitizer.php | 55 ++++ .../ClassicSubscriberInterface.php | 24 ++ .../EventManagement/EventManager.php | 135 +++++++++ .../EventManagerAwareSubscriberInterface.php | 13 + .../OptimizedSubscriberInterface.php | 28 ++ .../EventManagement/SubscriberInterface.php | 8 + .../Wrapper/SubscriberWrapper.php | 71 +++++ .../Wrapper/WrappedSubscriber.php | 72 +++++ src/Dependencies/LaunchpadCore/Plugin.php | 267 +++++++++++++++++ src/Dependencies/LaunchpadCore/boot.php | 99 +++++++ .../LaunchpadDispatcher/Dispatcher.php | 102 +++++++ .../Interfaces/SanitizerInterface.php | 10 + .../Sanitizers/BoolSanitizer.php | 16 + .../Sanitizers/FloatSanitizer.php | 16 + .../Sanitizers/IntSanitizer.php | 15 + .../Sanitizers/StringSanitizer.php | 24 ++ .../LaunchpadDispatcher/Traits/IsDefault.php | 11 + .../Interfaces/OptionsAwareInterface.php | 16 + .../Interfaces/SettingsAwareInterface.php | 16 + .../Interfaces/TransientsAwareInterface.php | 16 + .../ServiceProvider.php | 77 +++++ .../Traits/OptionsAwareTrait.php | 26 ++ .../Traits/SettingsAwareTrait.php | 26 ++ .../Traits/TransientsAwareTrait.php | 26 ++ .../Interfaces/Actions/DeleteInterface.php | 15 + .../Interfaces/Actions/FetchInterface.php | 26 ++ .../Actions/FetchPrefixInterface.php | 15 + .../Interfaces/Actions/SetInterface.php | 17 ++ .../Interfaces/OptionsInterface.php | 14 + .../Interfaces/SettingsInterface.php | 26 ++ .../Interfaces/TransientsInterface.php | 25 ++ src/Dependencies/LaunchpadOptions/Options.php | 64 ++++ .../LaunchpadOptions/Settings.php | 142 +++++++++ .../Traits/PrefixedKeyTrait.php | 45 +++ .../LaunchpadOptions/Transients.php | 64 ++++ .../Argument/ArgumentResolverInterface.php | 28 ++ .../Argument/ArgumentResolverTrait.php | 120 ++++++++ .../League/Container/Argument/ClassName.php | 29 ++ .../Container/Argument/ClassNameInterface.php | 13 + .../Argument/ClassNameWithOptionalValue.php | 39 +++ .../League/Container/Argument/RawArgument.php | 29 ++ .../Argument/RawArgumentInterface.php | 13 + .../League/Container/Container.php | 248 ++++++++++++++++ .../Container/ContainerAwareInterface.php | 40 +++ .../League/Container/ContainerAwareTrait.php | 76 +++++ .../Container/Definition/Definition.php | 278 ++++++++++++++++++ .../Definition/DefinitionAggregate.php | 124 ++++++++ .../DefinitionAggregateInterface.php | 67 +++++ .../Definition/DefinitionInterface.php | 120 ++++++++ .../Exception/ContainerException.php | 10 + .../Container/Exception/NotFoundException.php | 10 + .../League/Container/Inflector/Inflector.php | 123 ++++++++ .../Inflector/InflectorAggregate.php | 58 ++++ .../Inflector/InflectorAggregateInterface.php | 27 ++ .../Inflector/InflectorInterface.php | 60 ++++ .../League/Container/ReflectionContainer.php | 131 +++++++++ .../AbstractServiceProvider.php | 46 +++ .../BootableServiceProviderInterface.php | 14 + .../ServiceProviderAggregate.php | 106 +++++++ .../ServiceProviderAggregateInterface.php | 36 +++ .../ServiceProviderInterface.php | 46 +++ .../Container/ContainerExceptionInterface.php | 12 + .../Psr/Container/ContainerInterface.php | 36 +++ .../Container/NotFoundExceptionInterface.php | 10 + 88 files changed, 4405 insertions(+), 15 deletions(-) create mode 100644 src/Dependencies/LaunchpadCore/Activation/Activation.php create mode 100644 src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Activation/ActivationServiceProviderInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Activation/HasActivatorServiceProviderInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Container/AbstractServiceProvider.php create mode 100644 src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php create mode 100644 src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php create mode 100644 src/Dependencies/LaunchpadCore/Container/PrefixAware.php create mode 100644 src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Container/Registration.php create mode 100644 src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Deactivation/Deactivation.php create mode 100644 src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Deactivation/DeactivationServiceProviderInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Deactivation/HasDeactivatorServiceProviderInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/DispatcherAwareInterface.php create mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/DispatcherAwareTrait.php create mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/EventManager.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/OptimizedSubscriberInterface.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/Wrapper/SubscriberWrapper.php create mode 100644 src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php create mode 100644 src/Dependencies/LaunchpadCore/Plugin.php create mode 100644 src/Dependencies/LaunchpadCore/boot.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Dispatcher.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/BoolSanitizer.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/FloatSanitizer.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/IntSanitizer.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/StringSanitizer.php create mode 100644 src/Dependencies/LaunchpadDispatcher/Traits/IsDefault.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/OptionsAwareInterface.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/SettingsAwareInterface.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/TransientsAwareInterface.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/ServiceProvider.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php create mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/FetchInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/FetchPrefixInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/SetInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/OptionsInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/SettingsInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php create mode 100644 src/Dependencies/LaunchpadOptions/Options.php create mode 100644 src/Dependencies/LaunchpadOptions/Settings.php create mode 100644 src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php create mode 100644 src/Dependencies/LaunchpadOptions/Transients.php create mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php create mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverTrait.php create mode 100644 src/Dependencies/League/Container/Argument/ClassName.php create mode 100644 src/Dependencies/League/Container/Argument/ClassNameInterface.php create mode 100644 src/Dependencies/League/Container/Argument/ClassNameWithOptionalValue.php create mode 100644 src/Dependencies/League/Container/Argument/RawArgument.php create mode 100644 src/Dependencies/League/Container/Argument/RawArgumentInterface.php create mode 100644 src/Dependencies/League/Container/Container.php create mode 100644 src/Dependencies/League/Container/ContainerAwareInterface.php create mode 100644 src/Dependencies/League/Container/ContainerAwareTrait.php create mode 100644 src/Dependencies/League/Container/Definition/Definition.php create mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregate.php create mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php create mode 100644 src/Dependencies/League/Container/Definition/DefinitionInterface.php create mode 100644 src/Dependencies/League/Container/Exception/ContainerException.php create mode 100644 src/Dependencies/League/Container/Exception/NotFoundException.php create mode 100644 src/Dependencies/League/Container/Inflector/Inflector.php create mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregate.php create mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php create mode 100644 src/Dependencies/League/Container/Inflector/InflectorInterface.php create mode 100644 src/Dependencies/League/Container/ReflectionContainer.php create mode 100644 src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php create mode 100644 src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php create mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregate.php create mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php create mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderInterface.php create mode 100644 src/Dependencies/Psr/Container/ContainerExceptionInterface.php create mode 100644 src/Dependencies/Psr/Container/ContainerInterface.php create mode 100644 src/Dependencies/Psr/Container/NotFoundExceptionInterface.php diff --git a/.github/workflows/deploy-tag.yml b/.github/workflows/deploy-tag.yml index 64fff3b..1ceeb23 100644 --- a/.github/workflows/deploy-tag.yml +++ b/.github/workflows/deploy-tag.yml @@ -9,8 +9,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - name: normal build - run: composer install - name: remove installers run: composer remove composer/installers - name: optimized build diff --git a/.github/workflows/test_php8.yml b/.github/workflows/test_php8.yml index a5cadb1..2a82dc9 100644 --- a/.github/workflows/test_php8.yml +++ b/.github/workflows/test_php8.yml @@ -61,7 +61,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --ignore-platform-reqs + run: composer install --prefer-dist --no-interaction --no-scripts --ignore-platform-reqs - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/.github/workflows/test_rocketcdn.yml b/.github/workflows/test_rocketcdn.yml index e51ab38..2523778 100644 --- a/.github/workflows/test_rocketcdn.yml +++ b/.github/workflows/test_rocketcdn.yml @@ -62,7 +62,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --ignore-platform-reqs + run: composer install --prefer-dist --no-interaction --no-scripts - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/.gitignore b/.gitignore index 8b92a69..0fd16bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ composer.phar /vendor/ -src/Dependencies # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file # composer.lock diff --git a/composer.json b/composer.json index fceff48..37d7c2a 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "require-dev": { "php": "^7 || ^8", "brain/monkey": "^2.0", - "coenjacobs/mozart": "^0.5.1", + "coenjacobs/mozart": "^0.7", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "league/container": "^3.3", "phpcompatibility/phpcompatibility-wp": "^2.0", diff --git a/composer.lock b/composer.lock index c680817..1470814 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "22246a4fde2b733124fb799855ae6182", + "content-hash": "05d14a7ac2d918dedecab2a7125d6243", "packages": [ { "name": "composer/installers", @@ -279,26 +279,29 @@ }, { "name": "coenjacobs/mozart", - "version": "0.5.1", + "version": "0.7.1", "source": { "type": "git", "url": "https://github.com/coenjacobs/mozart.git", - "reference": "4bdde231f3309d9299c87b2246166e87acc93653" + "reference": "dbcdeb992d20d9c8914eef090f9a0d684bb1102c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/coenjacobs/mozart/zipball/4bdde231f3309d9299c87b2246166e87acc93653", - "reference": "4bdde231f3309d9299c87b2246166e87acc93653", + "url": "https://api.github.com/repos/coenjacobs/mozart/zipball/dbcdeb992d20d9c8914eef090f9a0d684bb1102c", + "reference": "dbcdeb992d20d9c8914eef090f9a0d684bb1102c", "shasum": "" }, "require": { "league/flysystem": "^1.0", - "php": "^7.2", + "php": "^7.3|^8.0", "symfony/console": "^4|^5", "symfony/finder": "^4|^5" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "mheap/phpunit-github-actions-printer": "^1.4", + "phpunit/phpunit": "^8.5", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.4" }, "bin": [ "bin/mozart" @@ -322,9 +325,15 @@ "description": "Composes all dependencies as a package inside a WordPress plugin", "support": { "issues": "https://github.com/coenjacobs/mozart/issues", - "source": "https://github.com/coenjacobs/mozart/tree/0.5.1" + "source": "https://github.com/coenjacobs/mozart/tree/0.7.1" }, - "time": "2019-12-23T12:24:56+00:00" + "funding": [ + { + "url": "https://github.com/coenjacobs", + "type": "github" + } + ], + "time": "2021-02-02T21:37:03+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", diff --git a/src/Dependencies/LaunchpadCore/Activation/Activation.php b/src/Dependencies/LaunchpadCore/Activation/Activation.php new file mode 100644 index 0000000..47be36c --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Activation/Activation.php @@ -0,0 +1,158 @@ + $value ) { + self::$container->add( $key, $value ); + } + + $container->share( 'dispatcher', self::$dispatcher ); + + $container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ key_exists( 'prefix', self::$params ) ? self::$params['prefix'] : '' ] ); + $container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $container->get( 'dispatcher' ) ] ); + + $providers = array_filter( + self::$providers, + function ( $provider ) { + if ( is_string( $provider ) ) { + $provider = new $provider(); + } + + if ( ! $provider instanceof ActivationServiceProviderInterface && ( ! $provider instanceof HasInflectorInterface || count( $provider->get_inflectors() ) === 0 ) ) { + return false; + } + + return $provider; + } + ); + + /** + * Activation providers. + * + * @param AbstractServiceProvider[] $providers Providers. + * @return AbstractServiceProvider[] + */ + $providers = apply_filters( "{$container->get('prefix')}deactivate_providers", $providers ); + + $providers = array_map( + function ( $provider ) { + if ( is_string( $provider ) ) { + return new $provider(); + } + return $provider; + }, + $providers + ); + + foreach ( $providers as $provider ) { + self::$container->addServiceProvider( $provider ); + } + + foreach ( $providers as $service_provider ) { + if ( ! $service_provider instanceof HasInflectorInterface ) { + continue; + } + $service_provider->register_inflectors(); + } + + foreach ( $providers as $provider ) { + if ( ! $provider instanceof HasActivatorServiceProviderInterface ) { + continue; + } + + foreach ( $provider->get_activators() as $activator ) { + $activator_instance = self::$container->get( $activator ); + if ( ! $activator_instance instanceof ActivationInterface ) { + continue; + } + $activator_instance->activate(); + } + } + } +} diff --git a/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php b/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php new file mode 100644 index 0000000..784145d --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php @@ -0,0 +1,14 @@ +provides; + } + + /** + * Returns a boolean if checking whether this provider provides a specific + * service or returns an array of provided services if no argument passed. + * + * @param string $alias Class searched. + * + * @return boolean + */ + public function provides( string $alias ): bool { + if ( ! $this->loaded ) { + $this->loaded = true; + $this->define(); + } + + return parent::provides( $alias ); + } + + /** + * Return IDs from front subscribers. + * + * @return string[] + */ + public function get_front_subscribers(): array { + return []; + } + + /** + * Return IDs from admin subscribers. + * + * @return string[] + */ + public function get_admin_subscribers(): array { + return []; + } + + /** + * Return IDs from common subscribers. + * + * @return string[] + */ + public function get_common_subscribers(): array { + return []; + } + + /** + * Return IDs from init subscribers. + * + * @return string[] + */ + public function get_init_subscribers(): array { + return []; + } + + /** + * Register service into the provider. + * + * @param string $classname Class to register. + * @param callable|null $method Method called when registering. + * @param string $concrete Concrete class when necessary. + * @return Registration + */ + public function register_service( string $classname, callable $method = null, string $concrete = '' ): Registration { + + $registration = new Registration( $classname ); + + if( $method ) { + $registration->set_definition( $method ); + } + + + + if ( $concrete ) { + $registration->set_concrete( $concrete ); + } + + $this->services_to_load[] = $registration; + + if ( ! in_array( $classname, $this->provides, true ) ) { + $this->provides[] = $classname; + } + + return $registration; + } + + /** + * Define classes. + * + * @return mixed + */ + abstract protected function define(); + + /** + * Register classes provided by the service provider. + * + * @return void + */ + public function register() { + foreach ( $this->services_to_load as $registration ) { + $registration->register( $this->getLeagueContainer() ); + } + } +} diff --git a/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php b/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php new file mode 100644 index 0000000..90d2269 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php @@ -0,0 +1,20 @@ + + */ + public function get_inflectors(): array; + + /** + * Register inflectors. + * + * @return void + */ + public function register_inflectors(): void; +} diff --git a/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php b/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php new file mode 100644 index 0000000..2e20159 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php @@ -0,0 +1,46 @@ + + */ + public function get_inflectors(): array { + return []; + } + + /** + * Register inflectors. + * + * @return void + */ + public function register_inflectors(): void { + foreach ( $this->get_inflectors() as $class => $data ) { + if ( ! is_array( $data ) || ! key_exists( 'method', $data ) ) { + continue; + } + $method = $data['method']; + + if ( ! key_exists( 'args', $data ) || ! is_array( $data['args'] ) ) { + $this->getLeagueContainer()->inflector( $class )->invokeMethod( $method, [] ); + continue; + } + + $this->getLeagueContainer()->inflector( $class )->invokeMethod( $method, $data['args'] ); + } + } + + /** + * Get the container. + * + * @return Container + */ + abstract public function getLeagueContainer(): Container; // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid +} diff --git a/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php b/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php new file mode 100644 index 0000000..0fae980 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php @@ -0,0 +1,8 @@ +prefix = $prefix; + } +} diff --git a/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php b/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php new file mode 100644 index 0000000..78c6d4c --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php @@ -0,0 +1,13 @@ +id = $id; + $this->value = $id; + } + + /** + * Define a callback definition for the class. + * + * @param callable $definition Callback definition for the class. + * @return $this + */ + public function set_definition( callable $definition ): Registration { + $this->definition = $definition; + return $this; + } + + /** + * Set a concrete class. + * + * @param mixed $concrete Concrete class. + * @return $this + */ + public function set_concrete( $concrete ): Registration { + $this->value = $concrete; + return $this; + } + + /** + * Make a definition shared. + * + * @return $this + */ + public function share(): Registration { + $this->shared = true; + return $this; + } + + /** + * Register a definition on a container. + * + * @param Container $container Container to register on. + * @return void + */ + public function register( Container $container ) { + $class_registration = $container->add( $this->id, $this->value, $this->shared ); + + if ( ! $this->definition ) { + return; + } + + ( $this->definition )( $class_registration ); + } +} diff --git a/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php b/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php new file mode 100644 index 0000000..a5c1eee --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php @@ -0,0 +1,44 @@ + $value ) { + $container->add( $key, $value ); + } + + $container->share( 'dispatcher', self::$dispatcher ); + + $container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ key_exists( 'prefix', self::$params ) ? self::$params['prefix'] : '' ] ); + $container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $container->get( 'dispatcher' ) ] ); + + $providers = array_filter( + self::$providers, + function ( $provider ) { + if ( is_string( $provider ) ) { + $provider = new $provider(); + } + + if ( ! $provider instanceof DeactivationServiceProviderInterface && ( ! $provider instanceof HasInflectorInterface || count( $provider->get_inflectors() ) === 0 ) ) { + return false; + } + + return $provider; + } + ); + + $providers = array_map( + function ( $provider ) { + if ( is_string( $provider ) ) { + return new $provider(); + } + return $provider; + }, + $providers + ); + + foreach ( $providers as $provider ) { + $container->addServiceProvider( $provider ); + } + + foreach ( $providers as $service_provider ) { + if ( ! $service_provider instanceof HasInflectorInterface ) { + continue; + } + $service_provider->register_inflectors(); + } + + /** + * Deactivation providers. + * + * @param AbstractServiceProvider[] $providers Providers. + * @return AbstractServiceProvider[] + */ + $providers = apply_filters( "{$container->get('prefix')}deactivate_providers", $providers ); + + foreach ( $providers as $provider ) { + if ( ! $provider instanceof HasDeactivatorServiceProviderInterface ) { + continue; + } + + foreach ( $provider->get_deactivators() as $deactivator ) { + $deactivator_instance = self::$container->get( $deactivator ); + if ( ! $deactivator_instance instanceof DeactivationInterface ) { + continue; + } + $deactivator_instance->deactivate(); + } + } + } +} diff --git a/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php b/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php new file mode 100644 index 0000000..27cbb47 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php @@ -0,0 +1,13 @@ +dispatcher = $dispatcher; + } +} diff --git a/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php b/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php new file mode 100644 index 0000000..0cc03fa --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php @@ -0,0 +1,55 @@ +is_default = false; + + if ( ! is_array( $value ) ) { + $this->is_default = true; + return false; + } + + $output = []; + + foreach ( $value as $subscriber ) { + if ( ! is_string( $subscriber ) && ! is_object( $subscriber ) ) { + continue; + } + + $output [] = $subscriber; + } + + return $output; + } + + /** + * Should return default value. + * + * @param mixed $value Current value. + * @param mixed $original Original value. + * + * @return bool + */ + public function is_default( $value, $original ): bool { + return $this->is_default; + } +} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php new file mode 100644 index 0000000..c40d558 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php @@ -0,0 +1,24 @@ + 'method_name') + * * array('hook_name' => array('method_name', $priority)) + * * array('hook_name' => array('method_name', $priority, $accepted_args)) + * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) + * + * @return array + */ + public function get_subscribed_events(); +} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php b/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php new file mode 100644 index 0000000..f95a001 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php @@ -0,0 +1,135 @@ + + */ +class EventManager { + /** + * Adds a callback to a specific hook of the WordPress plugin API. + * + * @uses add_filter() + * + * @param string $hook_name Name of the hook. + * @param callable $callback Callback function. + * @param int $priority Priority. + * @param int $accepted_args Number of arguments. + */ + public function add_callback( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) { + add_filter( $hook_name, $callback, $priority, $accepted_args ); + } + + /** + * Add an event subscriber. + * + * The event manager registers all the hooks that the given subscriber + * wants to register with the WordPress Plugin API. + * + * @param ClassicSubscriberInterface $subscriber Subscriber_Interface implementation. + */ + public function add_subscriber( ClassicSubscriberInterface $subscriber ) { + if ( $subscriber instanceof EventManagerAwareSubscriberInterface ) { + $subscriber->set_event_manager( $this ); + } + + $events = $subscriber->get_subscribed_events(); + + if ( empty( $events ) ) { + return; + } + + foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { + $this->add_subscriber_callback( $subscriber, $hook_name, $parameters ); + } + } + + /** + * Checks the WordPress plugin API to see if the given hook has + * the given callback. The priority of the callback will be returned + * or false. If no callback is given will return true or false if + * there's any callbacks registered to the hook. + * + * @uses has_filter() + * + * @param string $hook_name Hook name. + * @param mixed $callback Callback. + * + * @return bool|int + */ + public function has_callback( $hook_name, $callback = false ) { + return has_filter( $hook_name, $callback ); + } + + /** + * Removes the given callback from the given hook. The WordPress plugin API only + * removes the hook if the callback and priority match a registered hook. + * + * @uses remove_filter() + * + * @param string $hook_name Hook name. + * @param callable $callback Callback. + * @param int $priority Priority. + * + * @return bool + */ + public function remove_callback( $hook_name, $callback, $priority = 10 ) { + return remove_filter( $hook_name, $callback, $priority ); + } + + /** + * Remove an event subscriber. + * + * The event manager removes all the hooks that the given subscriber + * wants to register with the WordPress Plugin API. + * + * @param SubscriberInterface $subscriber Subscriber_Interface implementation. + */ + public function remove_subscriber( SubscriberInterface $subscriber ) { + foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { + $this->remove_subscriber_callback( $subscriber, $hook_name, $parameters ); + } + } + + /** + * Adds the given subscriber's callback to a specific hook + * of the WordPress plugin API. + * + * @param SubscriberInterface $subscriber Subscriber_Interface implementation. + * @param string $hook_name Hook name. + * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. + */ + private function add_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { + if ( is_string( $parameters ) ) { + $this->add_callback( $hook_name, [ $subscriber, $parameters ] ); + } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { + foreach ( $parameters as $parameter ) { + $this->add_subscriber_callback( $subscriber, $hook_name, $parameter ); + } + } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { + $this->add_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10, isset( $parameters[2] ) ? $parameters[2] : 1 ); + } + } + + /** + * Removes the given subscriber's callback to a specific hook + * of the WordPress plugin API. + * + * @param SubscriberInterface $subscriber Subscriber_Interface implementation. + * @param string $hook_name Hook name. + * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. + */ + private function remove_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { + if ( is_string( $parameters ) ) { + $this->remove_callback( $hook_name, [ $subscriber, $parameters ] ); + } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { + foreach ( $parameters as $parameter ) { + $this->remove_subscriber_callback( $subscriber, $hook_name, $parameter ); + } + } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { + $this->remove_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10 ); + } + } +} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php new file mode 100644 index 0000000..1a6af03 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php @@ -0,0 +1,13 @@ + 'method_name') + * * array('hook_name' => array('method_name', $priority)) + * * array('hook_name' => array('method_name', $priority, $accepted_args)) + * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) + * + * @return array + */ + public static function get_subscribed_events(); +} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php new file mode 100644 index 0000000..9263f3c --- /dev/null +++ b/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php @@ -0,0 +1,8 @@ +prefix = $prefix; + } + + /** + * Wrap a subscriber will the common interface for subscribers. + * + * @param object $instance Any class subscriber. + * + * @return SubscriberInterface + * @throws ReflectionException Error is the class name is not valid. + */ + public function wrap( $instance ): SubscriberInterface { + if ( $instance instanceof OptimizedSubscriberInterface ) { + return new WrappedSubscriber( $instance, $instance->get_subscribed_events() ); + } + + $methods = get_class_methods( $instance ); + $reflection_class = new ReflectionClass( get_class( $instance ) ); + $events = []; + foreach ( $methods as $method ) { + $method_reflection = $reflection_class->getMethod( $method ); + $doc_comment = $method_reflection->getDocComment(); + if ( ! $doc_comment ) { + continue; + } + $pattern = '#@hook\s(?[a-zA-Z\\\-_$/]+)(\s(?[0-9]+))?#'; + + preg_match_all( $pattern, $doc_comment, $matches, PREG_PATTERN_ORDER ); + if ( ! $matches ) { + continue; + } + + foreach ( $matches[0] as $index => $match ) { + $hook = str_replace( '$prefix', $this->prefix, $matches['name'][ $index ] ); + + $events[ $hook ][] = [ + $method, + key_exists( 'priority', $matches ) && key_exists( $index, $matches['priority'] ) && '' !== $matches['priority'][ $index ] ? (int) $matches['priority'][ $index ] : 10, + $method_reflection->getNumberOfParameters(), + ]; + } + } + + return new WrappedSubscriber( $instance, $events ); + } +} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php b/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php new file mode 100644 index 0000000..cb953e4 --- /dev/null +++ b/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php @@ -0,0 +1,72 @@ +instance = $instance; + $this->events = $events; + } + + /** + * Returns an array of events that this subscriber wants to listen to. + * + * The array key is the event name. The value can be: + * + * * The method name + * * An array with the method name and priority + * * An array with the method name, priority and number of accepted arguments + * + * For instance: + * + * * array('hook_name' => 'method_name') + * * array('hook_name' => array('method_name', $priority)) + * * array('hook_name' => array('method_name', $priority, $accepted_args)) + * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) + * + * @return array + */ + public function get_subscribed_events(): array { + return $this->events; + } + + /** + * Delegate callbacks to the actual subscriber. + * + * @param string $name Name from the method. + * @param array $arguments Parameters from the method. + * + * @return mixed + */ + public function __call( $name, $arguments ) { + + if ( method_exists( $this, $name ) ) { + return $this->{$name}( ...$arguments ); + } + + return $this->instance->{$name}( ...$arguments ); + } +} diff --git a/src/Dependencies/LaunchpadCore/Plugin.php b/src/Dependencies/LaunchpadCore/Plugin.php new file mode 100644 index 0000000..94d5a6e --- /dev/null +++ b/src/Dependencies/LaunchpadCore/Plugin.php @@ -0,0 +1,267 @@ +container = $container; + $this->event_manager = $event_manager; + $this->subscriber_wrapper = $subscriber_wrapper; + $this->dispatcher = $dispatcher; + } + + /** + * Returns the Rocket container instance. + * + * @return ContainerInterface + */ + public function get_container() { + return $this->container; + } + + /** + * Loads the plugin into WordPress. + * + * @param array $params Parameters to pass to the container. + * @param array $providers List of providers from the plugin. + * + * @return void + * + * @throws ContainerExceptionInterface Error from the container. + * @throws NotFoundExceptionInterface Error when a class is not found on the container. + * @throws ReflectionException Error when a classname is invalid. + */ + public function load( array $params, array $providers = [] ) { + + foreach ( $params as $key => $value ) { + $this->container->share( $key, $value ); + } + + /** + * Runs before the plugin is loaded. + */ + $this->dispatcher->do_action( "{$this->container->get('prefix')}before_load" ); + + add_filter( "{$this->container->get('prefix')}container", [ $this, 'get_container' ] ); + + $this->container->share( 'event_manager', $this->event_manager ); + $this->container->share( 'dispatcher', $this->dispatcher ); + + $this->container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ $this->container->get( 'prefix' ) ] ); + $this->container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $this->container->get( 'dispatcher' ) ] ); + + $providers = array_map( + function ( $classname ) { + if ( is_string( $classname ) ) { + return new $classname(); + } + + return $classname; + }, + $providers + ); + + $providers = $this->optimize_service_providers( $providers ); + + foreach ( $providers as $service_provider ) { + $this->container->addServiceProvider( $service_provider ); + } + + foreach ( $providers as $service_provider ) { + if ( ! $service_provider instanceof HasInflectorInterface ) { + continue; + } + $service_provider->register_inflectors(); + } + + foreach ( $providers as $service_provider ) { + $this->load_init_subscribers( $service_provider ); + } + + foreach ( $providers as $service_provider ) { + $this->load_subscribers( $service_provider ); + } + + /** + * Runs after the plugin is loaded. + */ + $this->dispatcher->do_action( "{$this->container->get('prefix')}after_load" ); + } + + /** + * Optimize service providers to keep only the ones we need to load. + * + * @param ServiceProviderInterface[] $providers Providers given to the plugin. + * + * @return ServiceProviderInterface[] + * + * @throws ContainerExceptionInterface Error from the container. + * @throws NotFoundExceptionInterface Error when a class is not found on the container. + */ + protected function optimize_service_providers( array $providers ): array { + $optimized_providers = []; + + foreach ( $providers as $provider ) { + if ( ! $provider instanceof IsOptimizableServiceProvider ) { + $optimized_providers[] = $provider; + continue; + } + $subscribers = array_merge( $provider->get_common_subscribers(), $provider->get_init_subscribers(), is_admin() ? $provider->get_admin_subscribers() : $provider->get_front_subscribers() ); + + /** + * Plugin Subscribers from a provider. + * + * @param SubscriberInterface[] $subscribers Subscribers. + * @param AbstractServiceProvider $provider Provider. + * + * @return SubscriberInterface[] + */ + $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_provider_subscribers", new SubscriberSignaturesSanitizer(), $subscribers, $provider ); + + if ( count( $subscribers ) === 0 ) { + continue; + } + + $optimized_providers[] = $provider; + } + + return $optimized_providers; + } + + /** + * Load list of event subscribers from service provider. + * + * @param ServiceProviderInterface $service_provider_instance Instance of service provider. + * + * @return void + * + * @throws ContainerExceptionInterface Error from the container. + * @throws NotFoundExceptionInterface Error when a class is not found on the container. + * @throws ReflectionException Error when a classname is invalid. + */ + private function load_init_subscribers( ServiceProviderInterface $service_provider_instance ) { + $subscribers = $service_provider_instance->get_init_subscribers(); + + /** + * Plugin Init Subscribers. + * + * @param SubscriberInterface[] $subscribers Subscribers. + * + * @return SubscriberInterface[] + */ + $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_init_subscribers", new SubscriberSignaturesSanitizer(), $subscribers ); + + if ( empty( $subscribers ) ) { + return; + } + + foreach ( $subscribers as $subscriber ) { + $subscriber_object = $this->container->get( $subscriber ); + if ( ! $subscriber_object instanceof ClassicSubscriberInterface ) { + $subscriber_object = $this->subscriber_wrapper->wrap( $subscriber_object ); + } + + $this->event_manager->add_subscriber( $subscriber_object ); + } + } + + /** + * Load list of event subscribers from service provider. + * + * @param ServiceProviderInterface $service_provider_instance Instance of service provider. + * + * @return void + * + * @throws ContainerExceptionInterface Error from the container. + * @throws NotFoundExceptionInterface Error when a class is not found on the container. + * @throws ReflectionException Error when a classname is invalid. + */ + private function load_subscribers( ServiceProviderInterface $service_provider_instance ) { + + $subscribers = $service_provider_instance->get_common_subscribers(); + + if ( ! is_admin() ) { + $subscribers = array_merge( $subscribers, $service_provider_instance->get_front_subscribers() ); + } else { + $subscribers = array_merge( $subscribers, $service_provider_instance->get_admin_subscribers() ); + } + + /** + * Plugin Subscribers. + * + * @param SubscriberInterface[] $subscribers Subscribers. + * @param AbstractServiceProvider $service_provider_instance Provider. + * + * @return SubscriberInterface[] + */ + $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_subscribers", new SubscriberSignaturesSanitizer(), $subscribers, $service_provider_instance ); + + if ( empty( $subscribers ) ) { + return; + } + + foreach ( $subscribers as $subscriber ) { + $subscriber_object = $this->container->get( $subscriber ); + if ( ! $subscriber_object instanceof ClassicSubscriberInterface ) { + $subscriber_object = $this->subscriber_wrapper->wrap( $subscriber_object ); + } + + $this->event_manager->add_subscriber( $subscriber_object ); + } + } +} diff --git a/src/Dependencies/LaunchpadCore/boot.php b/src/Dependencies/LaunchpadCore/boot.php new file mode 100644 index 0000000..d17f37a --- /dev/null +++ b/src/Dependencies/LaunchpadCore/boot.php @@ -0,0 +1,99 @@ +load( $params, $providers ); + } + ); + + Deactivation::set_container( new Container() ); + Deactivation::set_dispatcher( new Dispatcher() ); + Deactivation::set_params( $params ); + Deactivation::set_providers( $providers ); + + register_deactivation_hook( $plugin_launcher_file, [ Deactivation::class, 'deactivate_plugin' ] ); + + Activation::set_container( new Container() ); + Activation::set_dispatcher( new Dispatcher() ); + Activation::set_params( $params ); + Activation::set_providers( $providers ); + + register_activation_hook( $plugin_launcher_file, [ Activation::class, 'activate_plugin' ] ); +} diff --git a/src/Dependencies/LaunchpadDispatcher/Dispatcher.php b/src/Dependencies/LaunchpadDispatcher/Dispatcher.php new file mode 100644 index 0000000..d155f3f --- /dev/null +++ b/src/Dependencies/LaunchpadDispatcher/Dispatcher.php @@ -0,0 +1,102 @@ +call_deprecated_actions($name, ...$parameters); + do_action($name, ...$parameters); + } + + public function apply_filters(string $name, SanitizerInterface $sanitizer, $default, ...$parameters) + { + $result_deprecated = $this->call_deprecated_filters($name, $default, ...$parameters); + + $result = apply_filters($name, $result_deprecated, ...$parameters); + + $sanitized_result = $sanitizer->sanitize($result); + + if( false === $sanitized_result && $sanitizer->is_default($sanitized_result, $result) ) { + return $default; + } + + return $sanitized_result; + } + + public function apply_string_filters(string $name, string $default, ...$parameters): string + { + return $this->apply_filters($name, new StringSanitizer(), $default, ...$parameters); + } + + public function apply_bool_filters(string $name, bool $default, ...$parameters): bool + { + return $this->apply_filters($name, new BoolSanitizer(), $default, ...$parameters); + } + + public function apply_int_filters(string $name, int $default, ...$parameters): int + { + return $this->apply_filters($name, new IntSanitizer(), $default, ...$parameters); + } + + public function apply_float_filters(string $name, float $default, ...$parameters): float + { + return $this->apply_filters($name, new FloatSanitizer(), $default, ...$parameters); + } + + public function add_deprecated_action(string $name, string $deprecated_name, string $version, string $message = '') + { + $this->deprecated_actions[$name][] = [ + 'name' => $deprecated_name, + 'version' => $version, + 'message' => $message + ]; + } + + public function add_deprecated_filter(string $name, string $deprecated_name, string $version, string $message = '') + { + $this->deprecated_filters[$name][] = [ + 'name' => $deprecated_name, + 'version' => $version, + 'message' => $message + ]; + } + + protected function call_deprecated_actions(string $name, ...$parameters) + { + if( ! key_exists($name, $this->deprecated_actions)) { + return; + } + + foreach ($this->deprecated_actions[$name] as $action) { + do_action_deprecated($action['name'], $parameters, $action['version'], $name, $action['message']); + $this->call_deprecated_actions($action['name'], ...$parameters); + } + } + + protected function call_deprecated_filters(string $name, $default, ...$parameters) + { + if( ! key_exists($name, $this->deprecated_filters)) { + return $default; + } + + foreach ($this->deprecated_filters[$name] as $filter) { + $filter_parameters = array_merge([$default], $parameters); + $default = apply_filters_deprecated($filter['name'], $filter_parameters, $filter['version'], $name, $filter['message']); + $default = $this->call_deprecated_filters($filter['name'], $default, ...$parameters); + } + + return $default; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php b/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php new file mode 100644 index 0000000..b784264 --- /dev/null +++ b/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php @@ -0,0 +1,10 @@ +register_service(OptionsInterface::class) + ->share() + ->set_concrete(Options::class) + ->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument('prefix'); + }); + + $this->register_service(TransientsInterface::class) + ->share() + ->set_concrete(Transients::class) + ->set_definition(function (DefinitionInterface $definition) { + $definition->addArgument('prefix'); + }); + + $this->register_service(SettingsInterface::class) + ->share() + ->set_concrete(Settings::class) + ->set_definition(function (DefinitionInterface $definition) { + $prefix = $this->container->get('prefix'); + $definition->addArguments([OptionsInterface::class, "{$prefix}settings"]); + }); + } + + /** + * Returns inflectors. + * + * @return array[] + */ + public function get_inflectors(): array + { + return [ + OptionsAwareInterface::class => [ + 'method' => 'set_options', + 'args' => [ + OptionsInterface::class, + ], + ], + TransientsAwareInterface::class => [ + 'method' => 'set_transients', + 'args' => [ + TransientsInterface::class, + ], + ], + SettingsAwareInterface::class => [ + 'method' => 'set_settings', + 'args' => [ + SettingsInterface::class, + ], + ], + ]; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php new file mode 100644 index 0000000..2ac1d50 --- /dev/null +++ b/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php @@ -0,0 +1,26 @@ +options = $options; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php new file mode 100644 index 0000000..33e407e --- /dev/null +++ b/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php @@ -0,0 +1,26 @@ +settings = $settings; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php new file mode 100644 index 0000000..0f10433 --- /dev/null +++ b/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php @@ -0,0 +1,26 @@ +transients = $transients; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php b/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php new file mode 100644 index 0000000..714f360 --- /dev/null +++ b/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php @@ -0,0 +1,15 @@ + $values Values to import. + * + * @return void + */ + public function import(array $values); + + /** + * Export settings values. + * + * @return array + */ + public function dumps(): array; +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php b/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php new file mode 100644 index 0000000..756dc2f --- /dev/null +++ b/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php @@ -0,0 +1,25 @@ +prefix = $prefix; + } + + /** + * Gets the option for the given name. Returns the default value if the value does not exist. + * + * @param string $name Name of the option to get. + * @param mixed $default Default value to return if the value does not exist. + * + * @return mixed + */ + public function get( string $name, $default = null ) { + $option = get_option( $this->get_full_key( $name ), $default ); + + if ( is_array( $default ) && ! is_array( $option ) ) { + $option = (array) $option; + } + + return $option; + } + + /** + * Sets the value of an option. Update the value if the option for the given name already exists. + * + * @param string $name Name of the option to set. + * @param mixed $value Value to set for the option. + * + * @return void + */ + public function set( string $name, $value ) { + update_option( $this->get_full_key( $name ), $value ); + } + + /** + * Deletes the option with the given name. + * + * @param string $name Name of the option to delete. + * + * @return void + */ + public function delete( string $name ) { + delete_option( $this->get_full_key( $name ) ); + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Settings.php b/src/Dependencies/LaunchpadOptions/Settings.php new file mode 100644 index 0000000..b3eb57a --- /dev/null +++ b/src/Dependencies/LaunchpadOptions/Settings.php @@ -0,0 +1,142 @@ +options = $options; + $this->settings_key = $settings_key; + $this->settings = (array) $this->options->get($settings_key, []); + } + + /** + * @inheritDoc + */ + public function get(string $name, $default = null) + { + /** + * Pre-filter any setting before read + * + * @param mixed $default The default value. + */ + $value = apply_filters( "pre_get_{$this->settings_key}_" . $name, null, $default ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound + + if ( null !== $value ) { + return $value; + } + + if( ! $this->has($name)) { + return $default; + } + + /** + * Filter any setting after read + * + * @param mixed $default The default value. + */ + return apply_filters( "get_{$this->settings_key}" . $name, $this->settings[$name], $default ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound + } + + /** + * @inheritDoc + */ + public function set(string $name, $value) + { + $this->settings[$name] = $value; + + $this->persist(); + } + + /** + * @inheritDoc + */ + public function delete(string $name) + { + unset($this->settings[$name]); + + $this->persist(); + } + + /** + * @inheritDoc + */ + public function has(string $name): bool + { + return key_exists($name, $this->settings); + } + + /** + * Persist the settings into the database. + * @return void + */ + protected function persist() + { + do_action("pre_persist_{$this->settings_key}", $this->settings); + + $this->options->set($this->settings_key, $this->settings); + + do_action("persist_{$this->settings_key}", $this->settings); + } + + /** + * Import multiple values at once. + * + * @param array $values Values to import. + * + * @return void + */ + public function import(array $values) + { + foreach ($values as $name => $value) { + $this->settings[$name] = $value; + } + + $this->persist(); + } + + /** + * Export settings values. + * + * @return array + */ + public function dumps(): array + { + $output = []; + + foreach ($this->settings as $name => $value) { + $output[$name] = $this->get($name); + } + + return $output; + } +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php b/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php new file mode 100644 index 0000000..89b6133 --- /dev/null +++ b/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php @@ -0,0 +1,45 @@ +prefix . $name; + } + + /** + * Checks if the option with the given name exists. + * + * @param string $name Name of the option to check. + * + * @return bool + */ + public function has( string $name ): bool { + return null !== $this->get( $name ); + } + + /** + * Gets the option for the given name. Returns the default value if the value does not exist. + * + * @param string $name Name of the option to get. + * @param mixed $default Default value to return if the value does not exist. + * + * @return mixed + */ + abstract public function get( string $name, $default = null ); +} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Transients.php b/src/Dependencies/LaunchpadOptions/Transients.php new file mode 100644 index 0000000..1baf132 --- /dev/null +++ b/src/Dependencies/LaunchpadOptions/Transients.php @@ -0,0 +1,64 @@ +prefix = $prefix; + } + + /** + * Gets the transient for the given name. Returns the default value if the value does not exist. + * + * @param string $name Name of the transient to get. + * @param mixed $default Default value to return if the value does not exist. + * + * @return mixed + */ + public function get(string $name, $default = null) + { + $transient = get_transient( $this->get_full_key( $name ), $default ); + + if ( is_array( $default ) && ! is_array( $transient ) ) { + $option = (array) $transient; + } + + return $transient; + } + + /** + * Sets the value of an transient. Update the value if the transient for the given name already exists. + * + * @param string $name Name of the transient to set. + * @param mixed $value Value to set for the transient. + * @param int $expiration Time until expiration in seconds. Default 0 (no expiration). + * + * @return void + */ + public function set(string $name, $value, int $expiration = 0) + { + set_transient( $this->get_full_key( $name ), $value, $expiration ); + } + + /** + * Deletes the transient with the given name. + * + * @param string $name Name of the transient to delete. + * + * @return void + */ + public function delete(string $name) + { + delete_transient( $this->get_full_key( $name ) ); + } +} \ No newline at end of file diff --git a/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php b/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php new file mode 100644 index 0000000..d6cabf4 --- /dev/null +++ b/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php @@ -0,0 +1,28 @@ +getValue(); + } elseif ($argument instanceof ClassNameInterface) { + $id = $argument->getClassName(); + } elseif (!is_string($argument)) { + return $argument; + } else { + $justStringValue = true; + $id = $argument; + } + + $container = null; + + try { + $container = $this->getLeagueContainer(); + } catch (ContainerException $e) { + if ($this instanceof ReflectionContainer) { + $container = $this; + } + } + + if ($container !== null) { + try { + return $container->get($id); + } catch (NotFoundException $exception) { + if ($argument instanceof ClassNameWithOptionalValue) { + return $argument->getOptionalValue(); + } + + if ($justStringValue) { + return $id; + } + + throw $exception; + } + } + + if ($argument instanceof ClassNameWithOptionalValue) { + return $argument->getOptionalValue(); + } + + // Just a string value. + return $id; + }, $arguments); + } + + /** + * {@inheritdoc} + */ + public function reflectArguments(ReflectionFunctionAbstract $method, array $args = []) : array + { + $arguments = array_map(function (ReflectionParameter $param) use ($method, $args) { + $name = $param->getName(); + $type = $param->getType(); + + if (array_key_exists($name, $args)) { + return new RawArgument($args[$name]); + } + + if ($type) { + if (PHP_VERSION_ID >= 70100) { + $typeName = $type->getName(); + } else { + $typeName = (string) $type; + } + + $typeName = ltrim($typeName, '?'); + + if ($param->isDefaultValueAvailable()) { + return new ClassNameWithOptionalValue($typeName, $param->getDefaultValue()); + } + + return new ClassName($typeName); + } + + if ($param->isDefaultValueAvailable()) { + return new RawArgument($param->getDefaultValue()); + } + + throw new NotFoundException(sprintf( + 'Unable to resolve a value for parameter (%s) in the function/method (%s)', + $name, + $method->getName() + )); + }, $method->getParameters()); + + return $this->resolveArguments($arguments); + } + + /** + * @return ContainerInterface + */ + abstract public function getContainer() : ContainerInterface; + + /** + * @return Container + */ + abstract public function getLeagueContainer() : Container; +} diff --git a/src/Dependencies/League/Container/Argument/ClassName.php b/src/Dependencies/League/Container/Argument/ClassName.php new file mode 100644 index 0000000..e283336 --- /dev/null +++ b/src/Dependencies/League/Container/Argument/ClassName.php @@ -0,0 +1,29 @@ +value = $value; + } + + /** + * {@inheritdoc} + */ + public function getClassName() : string + { + return $this->value; + } +} diff --git a/src/Dependencies/League/Container/Argument/ClassNameInterface.php b/src/Dependencies/League/Container/Argument/ClassNameInterface.php new file mode 100644 index 0000000..2e26f78 --- /dev/null +++ b/src/Dependencies/League/Container/Argument/ClassNameInterface.php @@ -0,0 +1,13 @@ +className = $className; + $this->optionalValue = $optionalValue; + } + + /** + * @inheritDoc + */ + public function getClassName(): string + { + return $this->className; + } + + public function getOptionalValue() + { + return $this->optionalValue; + } +} diff --git a/src/Dependencies/League/Container/Argument/RawArgument.php b/src/Dependencies/League/Container/Argument/RawArgument.php new file mode 100644 index 0000000..6c4a584 --- /dev/null +++ b/src/Dependencies/League/Container/Argument/RawArgument.php @@ -0,0 +1,29 @@ +value = $value; + } + + /** + * {@inheritdoc} + */ + public function getValue() + { + return $this->value; + } +} diff --git a/src/Dependencies/League/Container/Argument/RawArgumentInterface.php b/src/Dependencies/League/Container/Argument/RawArgumentInterface.php new file mode 100644 index 0000000..d81c312 --- /dev/null +++ b/src/Dependencies/League/Container/Argument/RawArgumentInterface.php @@ -0,0 +1,13 @@ +definitions = $definitions ?? new DefinitionAggregate; + $this->providers = $providers ?? new ServiceProviderAggregate; + $this->inflectors = $inflectors ?? new InflectorAggregate; + + if ($this->definitions instanceof ContainerAwareInterface) { + $this->definitions->setLeagueContainer($this); + } + + if ($this->providers instanceof ContainerAwareInterface) { + $this->providers->setLeagueContainer($this); + } + + if ($this->inflectors instanceof ContainerAwareInterface) { + $this->inflectors->setLeagueContainer($this); + } + } + + /** + * Add an item to the container. + * + * @param string $id + * @param mixed $concrete + * @param boolean $shared + * + * @return DefinitionInterface + */ + public function add(string $id, $concrete = null, bool $shared = null) : DefinitionInterface + { + $concrete = $concrete ?? $id; + $shared = $shared ?? $this->defaultToShared; + + return $this->definitions->add($id, $concrete, $shared); + } + + /** + * Proxy to add with shared as true. + * + * @param string $id + * @param mixed $concrete + * + * @return DefinitionInterface + */ + public function share(string $id, $concrete = null) : DefinitionInterface + { + return $this->add($id, $concrete, true); + } + + /** + * Whether the container should default to defining shared definitions. + * + * @param boolean $shared + * + * @return self + */ + public function defaultToShared(bool $shared = true) : ContainerInterface + { + $this->defaultToShared = $shared; + + return $this; + } + + /** + * Get a definition to extend. + * + * @param string $id [description] + * + * @return DefinitionInterface + */ + public function extend(string $id) : DefinitionInterface + { + if ($this->providers->provides($id)) { + $this->providers->register($id); + } + + if ($this->definitions->has($id)) { + return $this->definitions->getDefinition($id); + } + + throw new NotFoundException( + sprintf('Unable to extend alias (%s) as it is not being managed as a definition', $id) + ); + } + + /** + * Add a service provider. + * + * @param ServiceProviderInterface|string $provider + * + * @return self + */ + public function addServiceProvider($provider) : self + { + $this->providers->add($provider); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function get($id, bool $new = false) + { + if ($this->definitions->has($id)) { + $resolved = $this->definitions->resolve($id, $new); + return $this->inflectors->inflect($resolved); + } + + if ($this->definitions->hasTag($id)) { + $arrayOf = $this->definitions->resolveTagged($id, $new); + + array_walk($arrayOf, function (&$resolved) { + $resolved = $this->inflectors->inflect($resolved); + }); + + return $arrayOf; + } + + if ($this->providers->provides($id)) { + $this->providers->register($id); + + if (!$this->definitions->has($id) && !$this->definitions->hasTag($id)) { + throw new ContainerException(sprintf('Service provider lied about providing (%s) service', $id)); + } + + return $this->get($id, $new); + } + + foreach ($this->delegates as $delegate) { + if ($delegate->has($id)) { + $resolved = $delegate->get($id); + return $this->inflectors->inflect($resolved); + } + } + + throw new NotFoundException(sprintf('Alias (%s) is not being managed by the container or delegates', $id)); + } + + /** + * {@inheritdoc} + */ + public function has($id) + { + if ($this->definitions->has($id)) { + return true; + } + + if ($this->definitions->hasTag($id)) { + return true; + } + + if ($this->providers->provides($id)) { + return true; + } + + foreach ($this->delegates as $delegate) { + if ($delegate->has($id)) { + return true; + } + } + + return false; + } + + /** + * Allows for manipulation of specific types on resolution. + * + * @param string $type + * @param callable|null $callback + * + * @return InflectorInterface + */ + public function inflector(string $type, callable $callback = null) : InflectorInterface + { + return $this->inflectors->add($type, $callback); + } + + /** + * Delegate a backup container to be checked for services if it + * cannot be resolved via this container. + * + * @param ContainerInterface $container + * + * @return self + */ + public function delegate(ContainerInterface $container) : self + { + $this->delegates[] = $container; + + if ($container instanceof ContainerAwareInterface) { + $container->setLeagueContainer($this); + } + + return $this; + } +} diff --git a/src/Dependencies/League/Container/ContainerAwareInterface.php b/src/Dependencies/League/Container/ContainerAwareInterface.php new file mode 100644 index 0000000..8a9f8a6 --- /dev/null +++ b/src/Dependencies/League/Container/ContainerAwareInterface.php @@ -0,0 +1,40 @@ +container = $container; + + return $this; + } + + /** + * Get the container. + * + * @return ContainerInterface + */ + public function getContainer() : ContainerInterface + { + if ($this->container instanceof ContainerInterface) { + return $this->container; + } + + throw new ContainerException('No container implementation has been set.'); + } + + /** + * Set a container. + * + * @param Container $container + * + * @return self + */ + public function setLeagueContainer(Container $container) : ContainerAwareInterface + { + $this->container = $container; + $this->leagueContainer = $container; + + return $this; + } + + /** + * Get the container. + * + * @return Container + */ + public function getLeagueContainer() : Container + { + if ($this->leagueContainer instanceof Container) { + return $this->leagueContainer; + } + + throw new ContainerException('No container implementation has been set.'); + } +} diff --git a/src/Dependencies/League/Container/Definition/Definition.php b/src/Dependencies/League/Container/Definition/Definition.php new file mode 100644 index 0000000..ff5c0c7 --- /dev/null +++ b/src/Dependencies/League/Container/Definition/Definition.php @@ -0,0 +1,278 @@ +alias = $id; + $this->concrete = $concrete; + } + + /** + * {@inheritdoc} + */ + public function addTag(string $tag) : DefinitionInterface + { + $this->tags[$tag] = true; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function hasTag(string $tag) : bool + { + return isset($this->tags[$tag]); + } + + /** + * {@inheritdoc} + */ + public function setAlias(string $id) : DefinitionInterface + { + $this->alias = $id; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getAlias() : string + { + return $this->alias; + } + + /** + * {@inheritdoc} + */ + public function setShared(bool $shared = true) : DefinitionInterface + { + $this->shared = $shared; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isShared() : bool + { + return $this->shared; + } + + /** + * {@inheritdoc} + */ + public function getConcrete() + { + return $this->concrete; + } + + /** + * {@inheritdoc} + */ + public function setConcrete($concrete) : DefinitionInterface + { + $this->concrete = $concrete; + $this->resolved = null; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addArgument($arg) : DefinitionInterface + { + $this->arguments[] = $arg; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addArguments(array $args) : DefinitionInterface + { + foreach ($args as $arg) { + $this->addArgument($arg); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addMethodCall(string $method, array $args = []) : DefinitionInterface + { + $this->methods[] = [ + 'method' => $method, + 'arguments' => $args + ]; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addMethodCalls(array $methods = []) : DefinitionInterface + { + foreach ($methods as $method => $args) { + $this->addMethodCall($method, $args); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function resolve(bool $new = false) + { + $concrete = $this->concrete; + + if ($this->isShared() && $this->resolved !== null && $new === false) { + return $this->resolved; + } + + if (is_callable($concrete)) { + $concrete = $this->resolveCallable($concrete); + } + + if ($concrete instanceof RawArgumentInterface) { + $this->resolved = $concrete->getValue(); + + return $concrete->getValue(); + } + + if ($concrete instanceof ClassNameInterface) { + $concrete = $concrete->getClassName(); + } + + if (is_string($concrete) && class_exists($concrete)) { + $concrete = $this->resolveClass($concrete); + } + + if (is_object($concrete)) { + $concrete = $this->invokeMethods($concrete); + } + + if (is_string($concrete) && $this->getContainer()->has($concrete)) { + $concrete = $this->getContainer()->get($concrete); + } + + $this->resolved = $concrete; + + return $concrete; + } + + /** + * Resolve a callable. + * + * @param callable $concrete + * + * @return mixed + */ + protected function resolveCallable(callable $concrete) + { + $resolved = $this->resolveArguments($this->arguments); + + return call_user_func_array($concrete, $resolved); + } + + /** + * Resolve a class. + * + * @param string $concrete + * + * @return object + * + * @throws ReflectionException + */ + protected function resolveClass(string $concrete) + { + $resolved = $this->resolveArguments($this->arguments); + $reflection = new ReflectionClass($concrete); + + return $reflection->newInstanceArgs($resolved); + } + + /** + * Invoke methods on resolved instance. + * + * @param object $instance + * + * @return object + */ + protected function invokeMethods($instance) + { + foreach ($this->methods as $method) { + $args = $this->resolveArguments($method['arguments']); + + /** @var callable $callable */ + $callable = [$instance, $method['method']]; + call_user_func_array($callable, $args); + } + + return $instance; + } +} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregate.php b/src/Dependencies/League/Container/Definition/DefinitionAggregate.php new file mode 100644 index 0000000..73e1d4b --- /dev/null +++ b/src/Dependencies/League/Container/Definition/DefinitionAggregate.php @@ -0,0 +1,124 @@ +definitions = array_filter($definitions, function ($definition) { + return ($definition instanceof DefinitionInterface); + }); + } + + /** + * {@inheritdoc} + */ + public function add(string $id, $definition, bool $shared = false) : DefinitionInterface + { + if (!$definition instanceof DefinitionInterface) { + $definition = new Definition($id, $definition); + } + + $this->definitions[] = $definition + ->setAlias($id) + ->setShared($shared) + ; + + return $definition; + } + + /** + * {@inheritdoc} + */ + public function has(string $id) : bool + { + foreach ($this->getIterator() as $definition) { + if ($id === $definition->getAlias()) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function hasTag(string $tag) : bool + { + foreach ($this->getIterator() as $definition) { + if ($definition->hasTag($tag)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getDefinition(string $id) : DefinitionInterface + { + foreach ($this->getIterator() as $definition) { + if ($id === $definition->getAlias()) { + return $definition->setLeagueContainer($this->getLeagueContainer()); + } + } + + throw new NotFoundException(sprintf('Alias (%s) is not being handled as a definition.', $id)); + } + + /** + * {@inheritdoc} + */ + public function resolve(string $id, bool $new = false) + { + return $this->getDefinition($id)->resolve($new); + } + + /** + * {@inheritdoc} + */ + public function resolveTagged(string $tag, bool $new = false) : array + { + $arrayOf = []; + + foreach ($this->getIterator() as $definition) { + if ($definition->hasTag($tag)) { + $arrayOf[] = $definition->setLeagueContainer($this->getLeagueContainer())->resolve($new); + } + } + + return $arrayOf; + } + + /** + * {@inheritdoc} + */ + public function getIterator() : Generator + { + $count = count($this->definitions); + + for ($i = 0; $i < $count; $i++) { + yield $this->definitions[$i]; + } + } +} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php b/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php new file mode 100644 index 0000000..7069f2f --- /dev/null +++ b/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php @@ -0,0 +1,67 @@ +type = $type; + $this->callback = $callback; + } + + /** + * {@inheritdoc} + */ + public function getType() : string + { + return $this->type; + } + + /** + * {@inheritdoc} + */ + public function invokeMethod(string $name, array $args) : InflectorInterface + { + $this->methods[$name] = $args; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function invokeMethods(array $methods) : InflectorInterface + { + foreach ($methods as $name => $args) { + $this->invokeMethod($name, $args); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setProperty(string $property, $value) : InflectorInterface + { + $this->properties[$property] = $this->resolveArguments([$value])[0]; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setProperties(array $properties) : InflectorInterface + { + foreach ($properties as $property => $value) { + $this->setProperty($property, $value); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function inflect($object) + { + $properties = $this->resolveArguments(array_values($this->properties)); + $properties = array_combine(array_keys($this->properties), $properties); + + // array_combine() can technically return false + foreach ($properties ?: [] as $property => $value) { + $object->{$property} = $value; + } + + foreach ($this->methods as $method => $args) { + $args = $this->resolveArguments($args); + + /** @var callable $callable */ + $callable = [$object, $method]; + call_user_func_array($callable, $args); + } + + if ($this->callback !== null) { + call_user_func($this->callback, $object); + } + } +} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregate.php b/src/Dependencies/League/Container/Inflector/InflectorAggregate.php new file mode 100644 index 0000000..644668e --- /dev/null +++ b/src/Dependencies/League/Container/Inflector/InflectorAggregate.php @@ -0,0 +1,58 @@ +inflectors[] = $inflector; + + return $inflector; + } + + /** + * {@inheritdoc} + */ + public function getIterator() : Generator + { + $count = count($this->inflectors); + + for ($i = 0; $i < $count; $i++) { + yield $this->inflectors[$i]; + } + } + + /** + * {@inheritdoc} + */ + public function inflect($object) + { + foreach ($this->getIterator() as $inflector) { + $type = $inflector->getType(); + + if (! $object instanceof $type) { + continue; + } + + $inflector->setLeagueContainer($this->getLeagueContainer()); + $inflector->inflect($object); + } + + return $object; + } +} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php b/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php new file mode 100644 index 0000000..7309e01 --- /dev/null +++ b/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php @@ -0,0 +1,27 @@ +cacheResolutions === true && array_key_exists($id, $this->cache)) { + return $this->cache[$id]; + } + + if (! $this->has($id)) { + throw new NotFoundException( + sprintf('Alias (%s) is not an existing class and therefore cannot be resolved', $id) + ); + } + + $reflector = new ReflectionClass($id); + $construct = $reflector->getConstructor(); + + if ($construct && !$construct->isPublic()) { + throw new NotFoundException( + sprintf('Alias (%s) has a non-public constructor and therefore cannot be instantiated', $id) + ); + } + + $resolution = $construct === null + ? new $id + : $resolution = $reflector->newInstanceArgs($this->reflectArguments($construct, $args)) + ; + + if ($this->cacheResolutions === true) { + $this->cache[$id] = $resolution; + } + + return $resolution; + } + + /** + * {@inheritdoc} + */ + public function has($id) + { + return class_exists($id); + } + + /** + * Invoke a callable via the container. + * + * @param callable $callable + * @param array $args + * + * @return mixed + * + * @throws ReflectionException + */ + public function call(callable $callable, array $args = []) + { + if (is_string($callable) && strpos($callable, '::') !== false) { + $callable = explode('::', $callable); + } + + if (is_array($callable)) { + if (is_string($callable[0])) { + $callable[0] = $this->getContainer()->get($callable[0]); + } + + $reflection = new ReflectionMethod($callable[0], $callable[1]); + + if ($reflection->isStatic()) { + $callable[0] = null; + } + + return $reflection->invokeArgs($callable[0], $this->reflectArguments($reflection, $args)); + } + + if (is_object($callable)) { + $reflection = new ReflectionMethod($callable, '__invoke'); + + return $reflection->invokeArgs($callable, $this->reflectArguments($reflection, $args)); + } + + $reflection = new ReflectionFunction(\Closure::fromCallable($callable)); + + return $reflection->invokeArgs($this->reflectArguments($reflection, $args)); + } + + /** + * Whether the container should default to caching resolutions and returning + * the cache on following calls. + * + * @param boolean $option + * + * @return self + */ + public function cacheResolutions(bool $option = true) : ContainerInterface + { + $this->cacheResolutions = $option; + + return $this; + } +} diff --git a/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php b/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php new file mode 100644 index 0000000..1b356af --- /dev/null +++ b/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php @@ -0,0 +1,46 @@ +provides, true); + } + + /** + * {@inheritdoc} + */ + public function setIdentifier(string $id) : ServiceProviderInterface + { + $this->identifier = $id; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getIdentifier() : string + { + return $this->identifier ?? get_class($this); + } +} diff --git a/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php b/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php new file mode 100644 index 0000000..895f4be --- /dev/null +++ b/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php @@ -0,0 +1,14 @@ +getContainer()->has($provider)) { + $provider = $this->getContainer()->get($provider); + } elseif (is_string($provider) && class_exists($provider)) { + $provider = new $provider; + } + + if (in_array($provider, $this->providers, true)) { + return $this; + } + + if ($provider instanceof ContainerAwareInterface) { + $provider->setLeagueContainer($this->getLeagueContainer()); + } + + if ($provider instanceof BootableServiceProviderInterface) { + $provider->boot(); + } + + if ($provider instanceof ServiceProviderInterface) { + $this->providers[] = $provider; + + return $this; + } + + throw new ContainerException( + 'A service provider must be a fully qualified class name or instance ' . + 'of (\RocketCDN\Dependencies\League\Container\ServiceProvider\ServiceProviderInterface)' + ); + } + + /** + * {@inheritdoc} + */ + public function provides(string $service) : bool + { + foreach ($this->getIterator() as $provider) { + if ($provider->provides($service)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getIterator() : Generator + { + $count = count($this->providers); + + for ($i = 0; $i < $count; $i++) { + yield $this->providers[$i]; + } + } + + /** + * {@inheritdoc} + */ + public function register(string $service) + { + if (false === $this->provides($service)) { + throw new ContainerException( + sprintf('(%s) is not provided by a service provider', $service) + ); + } + + foreach ($this->getIterator() as $provider) { + if (in_array($provider->getIdentifier(), $this->registered, true)) { + continue; + } + + if ($provider->provides($service)) { + $this->registered[] = $provider->getIdentifier(); + $provider->register(); + } + } + } +} diff --git a/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php b/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php new file mode 100644 index 0000000..a0eb57e --- /dev/null +++ b/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php @@ -0,0 +1,36 @@ +leagueContainer property or the `getLeagueContainer` method + * from the ContainerAwareTrait. + * + * @return void + */ + public function register(); + + /** + * Set a custom id for the service provider. This enables + * registering the same service provider multiple times. + * + * @param string $id + * + * @return self + */ + public function setIdentifier(string $id) : ServiceProviderInterface; + + /** + * The id of the service provider uniquely identifies it, so + * that we can quickly determine if it has already been registered. + * Defaults to get_class($provider). + * + * @return string + */ + public function getIdentifier() : string; +} diff --git a/src/Dependencies/Psr/Container/ContainerExceptionInterface.php b/src/Dependencies/Psr/Container/ContainerExceptionInterface.php new file mode 100644 index 0000000..c0ddbc0 --- /dev/null +++ b/src/Dependencies/Psr/Container/ContainerExceptionInterface.php @@ -0,0 +1,12 @@ + Date: Thu, 4 Jul 2024 09:40:40 +0200 Subject: [PATCH 32/40] Updated lock file with 7.4 --- composer.lock | 133 ++++++++++++++++++++++++-------------------------- 1 file changed, 63 insertions(+), 70 deletions(-) diff --git a/composer.lock b/composer.lock index 1470814..cc31de4 100644 --- a/composer.lock +++ b/composer.lock @@ -753,26 +753,26 @@ }, { "name": "league/mime-type-detection", - "version": "1.15.0", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301" + "reference": "c7f2872fb273bf493811473dafc88d60ae829f48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", - "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/c7f2872fb273bf493811473dafc88d60ae829f48", + "reference": "c7f2872fb273bf493811473dafc88d60ae829f48", "shasum": "" }, "require": { "ext-fileinfo": "*", - "php": "^7.4 || ^8.0" + "php": "^7.2 || ^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.2", "phpstan/phpstan": "^0.12.68", - "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" + "phpunit/phpunit": "^8.5.8 || ^9.3" }, "type": "library", "autoload": { @@ -793,7 +793,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.15.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.12.0" }, "funding": [ { @@ -805,7 +805,7 @@ "type": "tidelift" } ], - "time": "2024-01-28T23:22:08+00:00" + "time": "2023-08-03T07:14:11+00:00" }, { "name": "mikey179/vfsstream", @@ -1425,35 +1425,28 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.1", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", - "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { - "doctrine/deprecations": "^1.1", "ext-filter": "*", - "php": "^7.4 || ^8.0", + "php": "^7.2 || ^8.0", "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.7", + "phpdocumentor/type-resolver": "^1.3", "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.5", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-webmozart-assert": "^1.2", - "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^5.13" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -1477,15 +1470,15 @@ }, { "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "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.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2024-05-21T05:55:05+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -2117,20 +2110,20 @@ }, { "name": "psr/container", - "version": "1.1.2", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", "shasum": "" }, "require": { - "php": ">=7.4.0" + "php": ">=7.2.0" }, "type": "library", "autoload": { @@ -2159,9 +2152,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/1.1.1" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-03-05T17:36:06+00:00" }, { "name": "roave/security-advisories", @@ -3878,25 +3871,25 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.5.0", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + "reference": "80d075412b557d41002320b96a096ca65aa2c98d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3925,7 +3918,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" }, "funding": [ { @@ -3941,7 +3934,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2023-01-24T14:02:46+00:00" }, { "name": "symfony/finder", @@ -4482,30 +4475,33 @@ }, { "name": "symfony/service-contracts", - "version": "v3.5.0", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" + "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a2329596ddc8fd568900e3fc76cba42489ecc7f3", + "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3", "shasum": "" }, "require": { - "php": ">=8.1", - "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.5|^3" + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" }, "conflict": { "ext-psr": "<1.1|>=2" }, + "suggest": { + "symfony/service-implementation": "" + }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -4515,10 +4511,7 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4545,7 +4538,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.3" }, "funding": [ { @@ -4561,38 +4554,38 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2023-04-21T15:04:16+00:00" }, { "name": "symfony/string", - "version": "v6.4.9", + "version": "v5.4.41", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "76792dbd99690a5ebef8050d9206c60c59e681d7" + "reference": "065a9611e0b1fd2197a867e1fb7f2238191b7096" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/76792dbd99690a5ebef8050d9206c60c59e681d7", - "reference": "76792dbd99690a5ebef8050d9206c60c59e681d7", + "url": "https://api.github.com/repos/symfony/string/zipball/065a9611e0b1fd2197a867e1fb7f2238191b7096", + "reference": "065a9611e0b1fd2197a867e1fb7f2238191b7096", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=7.2.5", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" }, "conflict": { - "symfony/translation-contracts": "<2.5" + "symfony/translation-contracts": ">=3.0" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0|^7.0", - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/intl": "^6.2|^7.0", - "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0|^7.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|^6.0" }, "type": "library", "autoload": { @@ -4631,7 +4624,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.9" + "source": "https://github.com/symfony/string/tree/v5.4.41" }, "funding": [ { @@ -4647,7 +4640,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:25:38+00:00" + "time": "2024-06-28T09:20:55+00:00" }, { "name": "szepeviktor/phpstan-wordpress", @@ -5234,5 +5227,5 @@ "platform-dev": { "php": "^7 || ^8" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.6.0" } From eeeaf8f63fe2c10b20ffee519a0069de9fa730e1 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Thu, 4 Jul 2024 09:45:23 +0200 Subject: [PATCH 33/40] Removed dependencies --- .github/workflows/test_php8.yml | 2 +- .github/workflows/test_rocketcdn.yml | 2 +- .gitignore | 1 + .../LaunchpadCore/Activation/Activation.php | 158 ---------- .../Activation/ActivationInterface.php | 14 - .../ActivationServiceProviderInterface.php | 8 - .../HasActivatorServiceProviderInterface.php | 13 - .../Container/AbstractServiceProvider.php | 136 --------- .../Container/HasInflectorInterface.php | 20 -- .../InflectorServiceProviderTrait.php | 46 --- .../IsOptimizableServiceProvider.php | 8 - .../LaunchpadCore/Container/PrefixAware.php | 23 -- .../Container/PrefixAwareInterface.php | 13 - .../LaunchpadCore/Container/Registration.php | 95 ------ .../Container/ServiceProviderInterface.php | 44 --- .../Deactivation/Deactivation.php | 158 ---------- .../Deactivation/DeactivationInterface.php | 13 - .../DeactivationServiceProviderInterface.php | 8 - ...HasDeactivatorServiceProviderInterface.php | 13 - .../Dispatcher/DispatcherAwareInterface.php | 17 -- .../Dispatcher/DispatcherAwareTrait.php | 26 -- .../SubscriberSignaturesSanitizer.php | 55 ---- .../ClassicSubscriberInterface.php | 24 -- .../EventManagement/EventManager.php | 135 --------- .../EventManagerAwareSubscriberInterface.php | 13 - .../OptimizedSubscriberInterface.php | 28 -- .../EventManagement/SubscriberInterface.php | 8 - .../Wrapper/SubscriberWrapper.php | 71 ----- .../Wrapper/WrappedSubscriber.php | 72 ----- src/Dependencies/LaunchpadCore/Plugin.php | 267 ----------------- src/Dependencies/LaunchpadCore/boot.php | 99 ------- .../LaunchpadDispatcher/Dispatcher.php | 102 ------- .../Interfaces/SanitizerInterface.php | 10 - .../Sanitizers/BoolSanitizer.php | 16 - .../Sanitizers/FloatSanitizer.php | 16 - .../Sanitizers/IntSanitizer.php | 15 - .../Sanitizers/StringSanitizer.php | 24 -- .../LaunchpadDispatcher/Traits/IsDefault.php | 11 - .../Interfaces/OptionsAwareInterface.php | 16 - .../Interfaces/SettingsAwareInterface.php | 16 - .../Interfaces/TransientsAwareInterface.php | 16 - .../ServiceProvider.php | 77 ----- .../Traits/OptionsAwareTrait.php | 26 -- .../Traits/SettingsAwareTrait.php | 26 -- .../Traits/TransientsAwareTrait.php | 26 -- .../Interfaces/Actions/DeleteInterface.php | 15 - .../Interfaces/Actions/FetchInterface.php | 26 -- .../Actions/FetchPrefixInterface.php | 15 - .../Interfaces/Actions/SetInterface.php | 17 -- .../Interfaces/OptionsInterface.php | 14 - .../Interfaces/SettingsInterface.php | 26 -- .../Interfaces/TransientsInterface.php | 25 -- src/Dependencies/LaunchpadOptions/Options.php | 64 ---- .../LaunchpadOptions/Settings.php | 142 --------- .../Traits/PrefixedKeyTrait.php | 45 --- .../LaunchpadOptions/Transients.php | 64 ---- .../Argument/ArgumentResolverInterface.php | 28 -- .../Argument/ArgumentResolverTrait.php | 120 -------- .../League/Container/Argument/ClassName.php | 29 -- .../Container/Argument/ClassNameInterface.php | 13 - .../Argument/ClassNameWithOptionalValue.php | 39 --- .../League/Container/Argument/RawArgument.php | 29 -- .../Argument/RawArgumentInterface.php | 13 - .../League/Container/Container.php | 248 ---------------- .../Container/ContainerAwareInterface.php | 40 --- .../League/Container/ContainerAwareTrait.php | 76 ----- .../Container/Definition/Definition.php | 278 ------------------ .../Definition/DefinitionAggregate.php | 124 -------- .../DefinitionAggregateInterface.php | 67 ----- .../Definition/DefinitionInterface.php | 120 -------- .../Exception/ContainerException.php | 10 - .../Container/Exception/NotFoundException.php | 10 - .../League/Container/Inflector/Inflector.php | 123 -------- .../Inflector/InflectorAggregate.php | 58 ---- .../Inflector/InflectorAggregateInterface.php | 27 -- .../Inflector/InflectorInterface.php | 60 ---- .../League/Container/ReflectionContainer.php | 131 --------- .../AbstractServiceProvider.php | 46 --- .../BootableServiceProviderInterface.php | 14 - .../ServiceProviderAggregate.php | 106 ------- .../ServiceProviderAggregateInterface.php | 36 --- .../ServiceProviderInterface.php | 46 --- .../Container/ContainerExceptionInterface.php | 12 - .../Psr/Container/ContainerInterface.php | 36 --- .../Container/NotFoundExceptionInterface.php | 10 - 85 files changed, 3 insertions(+), 4386 deletions(-) delete mode 100644 src/Dependencies/LaunchpadCore/Activation/Activation.php delete mode 100644 src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Activation/ActivationServiceProviderInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Activation/HasActivatorServiceProviderInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/AbstractServiceProvider.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/PrefixAware.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/Registration.php delete mode 100644 src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Deactivation/Deactivation.php delete mode 100644 src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Deactivation/DeactivationServiceProviderInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Deactivation/HasDeactivatorServiceProviderInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/DispatcherAwareInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/DispatcherAwareTrait.php delete mode 100644 src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/EventManager.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/OptimizedSubscriberInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/Wrapper/SubscriberWrapper.php delete mode 100644 src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php delete mode 100644 src/Dependencies/LaunchpadCore/Plugin.php delete mode 100644 src/Dependencies/LaunchpadCore/boot.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Dispatcher.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/BoolSanitizer.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/FloatSanitizer.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/IntSanitizer.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Sanitizers/StringSanitizer.php delete mode 100644 src/Dependencies/LaunchpadDispatcher/Traits/IsDefault.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/OptionsAwareInterface.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/SettingsAwareInterface.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Interfaces/TransientsAwareInterface.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/ServiceProvider.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php delete mode 100644 src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/FetchInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/FetchPrefixInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/Actions/SetInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/OptionsInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/SettingsInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php delete mode 100644 src/Dependencies/LaunchpadOptions/Options.php delete mode 100644 src/Dependencies/LaunchpadOptions/Settings.php delete mode 100644 src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php delete mode 100644 src/Dependencies/LaunchpadOptions/Transients.php delete mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php delete mode 100644 src/Dependencies/League/Container/Argument/ArgumentResolverTrait.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassName.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassNameInterface.php delete mode 100644 src/Dependencies/League/Container/Argument/ClassNameWithOptionalValue.php delete mode 100644 src/Dependencies/League/Container/Argument/RawArgument.php delete mode 100644 src/Dependencies/League/Container/Argument/RawArgumentInterface.php delete mode 100644 src/Dependencies/League/Container/Container.php delete mode 100644 src/Dependencies/League/Container/ContainerAwareInterface.php delete mode 100644 src/Dependencies/League/Container/ContainerAwareTrait.php delete mode 100644 src/Dependencies/League/Container/Definition/Definition.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregate.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/Definition/DefinitionInterface.php delete mode 100644 src/Dependencies/League/Container/Exception/ContainerException.php delete mode 100644 src/Dependencies/League/Container/Exception/NotFoundException.php delete mode 100644 src/Dependencies/League/Container/Inflector/Inflector.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregate.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/Inflector/InflectorInterface.php delete mode 100644 src/Dependencies/League/Container/ReflectionContainer.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregate.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php delete mode 100644 src/Dependencies/League/Container/ServiceProvider/ServiceProviderInterface.php delete mode 100644 src/Dependencies/Psr/Container/ContainerExceptionInterface.php delete mode 100644 src/Dependencies/Psr/Container/ContainerInterface.php delete mode 100644 src/Dependencies/Psr/Container/NotFoundExceptionInterface.php diff --git a/.github/workflows/test_php8.yml b/.github/workflows/test_php8.yml index 2a82dc9..a5cadb1 100644 --- a/.github/workflows/test_php8.yml +++ b/.github/workflows/test_php8.yml @@ -61,7 +61,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-scripts --ignore-platform-reqs + run: composer install --prefer-dist --no-interaction --ignore-platform-reqs - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/.github/workflows/test_rocketcdn.yml b/.github/workflows/test_rocketcdn.yml index 2523778..6642ac5 100644 --- a/.github/workflows/test_rocketcdn.yml +++ b/.github/workflows/test_rocketcdn.yml @@ -62,7 +62,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --prefer-dist --no-interaction --no-scripts + run: composer install --prefer-dist --no-interaction - name: Install tests run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }} diff --git a/.gitignore b/.gitignore index 0fd16bc..c167f3b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ composer.phar /vendor/ +/src/Dependencies # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file # composer.lock diff --git a/src/Dependencies/LaunchpadCore/Activation/Activation.php b/src/Dependencies/LaunchpadCore/Activation/Activation.php deleted file mode 100644 index 47be36c..0000000 --- a/src/Dependencies/LaunchpadCore/Activation/Activation.php +++ /dev/null @@ -1,158 +0,0 @@ - $value ) { - self::$container->add( $key, $value ); - } - - $container->share( 'dispatcher', self::$dispatcher ); - - $container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ key_exists( 'prefix', self::$params ) ? self::$params['prefix'] : '' ] ); - $container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $container->get( 'dispatcher' ) ] ); - - $providers = array_filter( - self::$providers, - function ( $provider ) { - if ( is_string( $provider ) ) { - $provider = new $provider(); - } - - if ( ! $provider instanceof ActivationServiceProviderInterface && ( ! $provider instanceof HasInflectorInterface || count( $provider->get_inflectors() ) === 0 ) ) { - return false; - } - - return $provider; - } - ); - - /** - * Activation providers. - * - * @param AbstractServiceProvider[] $providers Providers. - * @return AbstractServiceProvider[] - */ - $providers = apply_filters( "{$container->get('prefix')}deactivate_providers", $providers ); - - $providers = array_map( - function ( $provider ) { - if ( is_string( $provider ) ) { - return new $provider(); - } - return $provider; - }, - $providers - ); - - foreach ( $providers as $provider ) { - self::$container->addServiceProvider( $provider ); - } - - foreach ( $providers as $service_provider ) { - if ( ! $service_provider instanceof HasInflectorInterface ) { - continue; - } - $service_provider->register_inflectors(); - } - - foreach ( $providers as $provider ) { - if ( ! $provider instanceof HasActivatorServiceProviderInterface ) { - continue; - } - - foreach ( $provider->get_activators() as $activator ) { - $activator_instance = self::$container->get( $activator ); - if ( ! $activator_instance instanceof ActivationInterface ) { - continue; - } - $activator_instance->activate(); - } - } - } -} diff --git a/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php b/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php deleted file mode 100644 index 784145d..0000000 --- a/src/Dependencies/LaunchpadCore/Activation/ActivationInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -provides; - } - - /** - * Returns a boolean if checking whether this provider provides a specific - * service or returns an array of provided services if no argument passed. - * - * @param string $alias Class searched. - * - * @return boolean - */ - public function provides( string $alias ): bool { - if ( ! $this->loaded ) { - $this->loaded = true; - $this->define(); - } - - return parent::provides( $alias ); - } - - /** - * Return IDs from front subscribers. - * - * @return string[] - */ - public function get_front_subscribers(): array { - return []; - } - - /** - * Return IDs from admin subscribers. - * - * @return string[] - */ - public function get_admin_subscribers(): array { - return []; - } - - /** - * Return IDs from common subscribers. - * - * @return string[] - */ - public function get_common_subscribers(): array { - return []; - } - - /** - * Return IDs from init subscribers. - * - * @return string[] - */ - public function get_init_subscribers(): array { - return []; - } - - /** - * Register service into the provider. - * - * @param string $classname Class to register. - * @param callable|null $method Method called when registering. - * @param string $concrete Concrete class when necessary. - * @return Registration - */ - public function register_service( string $classname, callable $method = null, string $concrete = '' ): Registration { - - $registration = new Registration( $classname ); - - if( $method ) { - $registration->set_definition( $method ); - } - - - - if ( $concrete ) { - $registration->set_concrete( $concrete ); - } - - $this->services_to_load[] = $registration; - - if ( ! in_array( $classname, $this->provides, true ) ) { - $this->provides[] = $classname; - } - - return $registration; - } - - /** - * Define classes. - * - * @return mixed - */ - abstract protected function define(); - - /** - * Register classes provided by the service provider. - * - * @return void - */ - public function register() { - foreach ( $this->services_to_load as $registration ) { - $registration->register( $this->getLeagueContainer() ); - } - } -} diff --git a/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php b/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php deleted file mode 100644 index 90d2269..0000000 --- a/src/Dependencies/LaunchpadCore/Container/HasInflectorInterface.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ - public function get_inflectors(): array; - - /** - * Register inflectors. - * - * @return void - */ - public function register_inflectors(): void; -} diff --git a/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php b/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php deleted file mode 100644 index 2e20159..0000000 --- a/src/Dependencies/LaunchpadCore/Container/InflectorServiceProviderTrait.php +++ /dev/null @@ -1,46 +0,0 @@ - - */ - public function get_inflectors(): array { - return []; - } - - /** - * Register inflectors. - * - * @return void - */ - public function register_inflectors(): void { - foreach ( $this->get_inflectors() as $class => $data ) { - if ( ! is_array( $data ) || ! key_exists( 'method', $data ) ) { - continue; - } - $method = $data['method']; - - if ( ! key_exists( 'args', $data ) || ! is_array( $data['args'] ) ) { - $this->getLeagueContainer()->inflector( $class )->invokeMethod( $method, [] ); - continue; - } - - $this->getLeagueContainer()->inflector( $class )->invokeMethod( $method, $data['args'] ); - } - } - - /** - * Get the container. - * - * @return Container - */ - abstract public function getLeagueContainer(): Container; // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid -} diff --git a/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php b/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php deleted file mode 100644 index 0fae980..0000000 --- a/src/Dependencies/LaunchpadCore/Container/IsOptimizableServiceProvider.php +++ /dev/null @@ -1,8 +0,0 @@ -prefix = $prefix; - } -} diff --git a/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php b/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php deleted file mode 100644 index 78c6d4c..0000000 --- a/src/Dependencies/LaunchpadCore/Container/PrefixAwareInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -id = $id; - $this->value = $id; - } - - /** - * Define a callback definition for the class. - * - * @param callable $definition Callback definition for the class. - * @return $this - */ - public function set_definition( callable $definition ): Registration { - $this->definition = $definition; - return $this; - } - - /** - * Set a concrete class. - * - * @param mixed $concrete Concrete class. - * @return $this - */ - public function set_concrete( $concrete ): Registration { - $this->value = $concrete; - return $this; - } - - /** - * Make a definition shared. - * - * @return $this - */ - public function share(): Registration { - $this->shared = true; - return $this; - } - - /** - * Register a definition on a container. - * - * @param Container $container Container to register on. - * @return void - */ - public function register( Container $container ) { - $class_registration = $container->add( $this->id, $this->value, $this->shared ); - - if ( ! $this->definition ) { - return; - } - - ( $this->definition )( $class_registration ); - } -} diff --git a/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php b/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php deleted file mode 100644 index a5c1eee..0000000 --- a/src/Dependencies/LaunchpadCore/Container/ServiceProviderInterface.php +++ /dev/null @@ -1,44 +0,0 @@ - $value ) { - $container->add( $key, $value ); - } - - $container->share( 'dispatcher', self::$dispatcher ); - - $container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ key_exists( 'prefix', self::$params ) ? self::$params['prefix'] : '' ] ); - $container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $container->get( 'dispatcher' ) ] ); - - $providers = array_filter( - self::$providers, - function ( $provider ) { - if ( is_string( $provider ) ) { - $provider = new $provider(); - } - - if ( ! $provider instanceof DeactivationServiceProviderInterface && ( ! $provider instanceof HasInflectorInterface || count( $provider->get_inflectors() ) === 0 ) ) { - return false; - } - - return $provider; - } - ); - - $providers = array_map( - function ( $provider ) { - if ( is_string( $provider ) ) { - return new $provider(); - } - return $provider; - }, - $providers - ); - - foreach ( $providers as $provider ) { - $container->addServiceProvider( $provider ); - } - - foreach ( $providers as $service_provider ) { - if ( ! $service_provider instanceof HasInflectorInterface ) { - continue; - } - $service_provider->register_inflectors(); - } - - /** - * Deactivation providers. - * - * @param AbstractServiceProvider[] $providers Providers. - * @return AbstractServiceProvider[] - */ - $providers = apply_filters( "{$container->get('prefix')}deactivate_providers", $providers ); - - foreach ( $providers as $provider ) { - if ( ! $provider instanceof HasDeactivatorServiceProviderInterface ) { - continue; - } - - foreach ( $provider->get_deactivators() as $deactivator ) { - $deactivator_instance = self::$container->get( $deactivator ); - if ( ! $deactivator_instance instanceof DeactivationInterface ) { - continue; - } - $deactivator_instance->deactivate(); - } - } - } -} diff --git a/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php b/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php deleted file mode 100644 index 27cbb47..0000000 --- a/src/Dependencies/LaunchpadCore/Deactivation/DeactivationInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -dispatcher = $dispatcher; - } -} diff --git a/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php b/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php deleted file mode 100644 index 0cc03fa..0000000 --- a/src/Dependencies/LaunchpadCore/Dispatcher/Sanitizer/SubscriberSignaturesSanitizer.php +++ /dev/null @@ -1,55 +0,0 @@ -is_default = false; - - if ( ! is_array( $value ) ) { - $this->is_default = true; - return false; - } - - $output = []; - - foreach ( $value as $subscriber ) { - if ( ! is_string( $subscriber ) && ! is_object( $subscriber ) ) { - continue; - } - - $output [] = $subscriber; - } - - return $output; - } - - /** - * Should return default value. - * - * @param mixed $value Current value. - * @param mixed $original Original value. - * - * @return bool - */ - public function is_default( $value, $original ): bool { - return $this->is_default; - } -} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php deleted file mode 100644 index c40d558..0000000 --- a/src/Dependencies/LaunchpadCore/EventManagement/ClassicSubscriberInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - 'method_name') - * * array('hook_name' => array('method_name', $priority)) - * * array('hook_name' => array('method_name', $priority, $accepted_args)) - * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) - * - * @return array - */ - public function get_subscribed_events(); -} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php b/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php deleted file mode 100644 index f95a001..0000000 --- a/src/Dependencies/LaunchpadCore/EventManagement/EventManager.php +++ /dev/null @@ -1,135 +0,0 @@ - - */ -class EventManager { - /** - * Adds a callback to a specific hook of the WordPress plugin API. - * - * @uses add_filter() - * - * @param string $hook_name Name of the hook. - * @param callable $callback Callback function. - * @param int $priority Priority. - * @param int $accepted_args Number of arguments. - */ - public function add_callback( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) { - add_filter( $hook_name, $callback, $priority, $accepted_args ); - } - - /** - * Add an event subscriber. - * - * The event manager registers all the hooks that the given subscriber - * wants to register with the WordPress Plugin API. - * - * @param ClassicSubscriberInterface $subscriber Subscriber_Interface implementation. - */ - public function add_subscriber( ClassicSubscriberInterface $subscriber ) { - if ( $subscriber instanceof EventManagerAwareSubscriberInterface ) { - $subscriber->set_event_manager( $this ); - } - - $events = $subscriber->get_subscribed_events(); - - if ( empty( $events ) ) { - return; - } - - foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { - $this->add_subscriber_callback( $subscriber, $hook_name, $parameters ); - } - } - - /** - * Checks the WordPress plugin API to see if the given hook has - * the given callback. The priority of the callback will be returned - * or false. If no callback is given will return true or false if - * there's any callbacks registered to the hook. - * - * @uses has_filter() - * - * @param string $hook_name Hook name. - * @param mixed $callback Callback. - * - * @return bool|int - */ - public function has_callback( $hook_name, $callback = false ) { - return has_filter( $hook_name, $callback ); - } - - /** - * Removes the given callback from the given hook. The WordPress plugin API only - * removes the hook if the callback and priority match a registered hook. - * - * @uses remove_filter() - * - * @param string $hook_name Hook name. - * @param callable $callback Callback. - * @param int $priority Priority. - * - * @return bool - */ - public function remove_callback( $hook_name, $callback, $priority = 10 ) { - return remove_filter( $hook_name, $callback, $priority ); - } - - /** - * Remove an event subscriber. - * - * The event manager removes all the hooks that the given subscriber - * wants to register with the WordPress Plugin API. - * - * @param SubscriberInterface $subscriber Subscriber_Interface implementation. - */ - public function remove_subscriber( SubscriberInterface $subscriber ) { - foreach ( $subscriber->get_subscribed_events() as $hook_name => $parameters ) { - $this->remove_subscriber_callback( $subscriber, $hook_name, $parameters ); - } - } - - /** - * Adds the given subscriber's callback to a specific hook - * of the WordPress plugin API. - * - * @param SubscriberInterface $subscriber Subscriber_Interface implementation. - * @param string $hook_name Hook name. - * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. - */ - private function add_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { - if ( is_string( $parameters ) ) { - $this->add_callback( $hook_name, [ $subscriber, $parameters ] ); - } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { - foreach ( $parameters as $parameter ) { - $this->add_subscriber_callback( $subscriber, $hook_name, $parameter ); - } - } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { - $this->add_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10, isset( $parameters[2] ) ? $parameters[2] : 1 ); - } - } - - /** - * Removes the given subscriber's callback to a specific hook - * of the WordPress plugin API. - * - * @param SubscriberInterface $subscriber Subscriber_Interface implementation. - * @param string $hook_name Hook name. - * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array. - */ - private function remove_subscriber_callback( SubscriberInterface $subscriber, $hook_name, $parameters ) { - if ( is_string( $parameters ) ) { - $this->remove_callback( $hook_name, [ $subscriber, $parameters ] ); - } elseif ( is_array( $parameters ) && count( $parameters ) !== count( $parameters, COUNT_RECURSIVE ) ) { - foreach ( $parameters as $parameter ) { - $this->remove_subscriber_callback( $subscriber, $hook_name, $parameter ); - } - } elseif ( is_array( $parameters ) && isset( $parameters[0] ) ) { - $this->remove_callback( $hook_name, [ $subscriber, $parameters[0] ], isset( $parameters[1] ) ? $parameters[1] : 10 ); - } - } -} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php deleted file mode 100644 index 1a6af03..0000000 --- a/src/Dependencies/LaunchpadCore/EventManagement/EventManagerAwareSubscriberInterface.php +++ /dev/null @@ -1,13 +0,0 @@ - 'method_name') - * * array('hook_name' => array('method_name', $priority)) - * * array('hook_name' => array('method_name', $priority, $accepted_args)) - * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) - * - * @return array - */ - public static function get_subscribed_events(); -} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php b/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php deleted file mode 100644 index 9263f3c..0000000 --- a/src/Dependencies/LaunchpadCore/EventManagement/SubscriberInterface.php +++ /dev/null @@ -1,8 +0,0 @@ -prefix = $prefix; - } - - /** - * Wrap a subscriber will the common interface for subscribers. - * - * @param object $instance Any class subscriber. - * - * @return SubscriberInterface - * @throws ReflectionException Error is the class name is not valid. - */ - public function wrap( $instance ): SubscriberInterface { - if ( $instance instanceof OptimizedSubscriberInterface ) { - return new WrappedSubscriber( $instance, $instance->get_subscribed_events() ); - } - - $methods = get_class_methods( $instance ); - $reflection_class = new ReflectionClass( get_class( $instance ) ); - $events = []; - foreach ( $methods as $method ) { - $method_reflection = $reflection_class->getMethod( $method ); - $doc_comment = $method_reflection->getDocComment(); - if ( ! $doc_comment ) { - continue; - } - $pattern = '#@hook\s(?[a-zA-Z\\\-_$/]+)(\s(?[0-9]+))?#'; - - preg_match_all( $pattern, $doc_comment, $matches, PREG_PATTERN_ORDER ); - if ( ! $matches ) { - continue; - } - - foreach ( $matches[0] as $index => $match ) { - $hook = str_replace( '$prefix', $this->prefix, $matches['name'][ $index ] ); - - $events[ $hook ][] = [ - $method, - key_exists( 'priority', $matches ) && key_exists( $index, $matches['priority'] ) && '' !== $matches['priority'][ $index ] ? (int) $matches['priority'][ $index ] : 10, - $method_reflection->getNumberOfParameters(), - ]; - } - } - - return new WrappedSubscriber( $instance, $events ); - } -} diff --git a/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php b/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php deleted file mode 100644 index cb953e4..0000000 --- a/src/Dependencies/LaunchpadCore/EventManagement/Wrapper/WrappedSubscriber.php +++ /dev/null @@ -1,72 +0,0 @@ -instance = $instance; - $this->events = $events; - } - - /** - * Returns an array of events that this subscriber wants to listen to. - * - * The array key is the event name. The value can be: - * - * * The method name - * * An array with the method name and priority - * * An array with the method name, priority and number of accepted arguments - * - * For instance: - * - * * array('hook_name' => 'method_name') - * * array('hook_name' => array('method_name', $priority)) - * * array('hook_name' => array('method_name', $priority, $accepted_args)) - * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2))) - * - * @return array - */ - public function get_subscribed_events(): array { - return $this->events; - } - - /** - * Delegate callbacks to the actual subscriber. - * - * @param string $name Name from the method. - * @param array $arguments Parameters from the method. - * - * @return mixed - */ - public function __call( $name, $arguments ) { - - if ( method_exists( $this, $name ) ) { - return $this->{$name}( ...$arguments ); - } - - return $this->instance->{$name}( ...$arguments ); - } -} diff --git a/src/Dependencies/LaunchpadCore/Plugin.php b/src/Dependencies/LaunchpadCore/Plugin.php deleted file mode 100644 index 94d5a6e..0000000 --- a/src/Dependencies/LaunchpadCore/Plugin.php +++ /dev/null @@ -1,267 +0,0 @@ -container = $container; - $this->event_manager = $event_manager; - $this->subscriber_wrapper = $subscriber_wrapper; - $this->dispatcher = $dispatcher; - } - - /** - * Returns the Rocket container instance. - * - * @return ContainerInterface - */ - public function get_container() { - return $this->container; - } - - /** - * Loads the plugin into WordPress. - * - * @param array $params Parameters to pass to the container. - * @param array $providers List of providers from the plugin. - * - * @return void - * - * @throws ContainerExceptionInterface Error from the container. - * @throws NotFoundExceptionInterface Error when a class is not found on the container. - * @throws ReflectionException Error when a classname is invalid. - */ - public function load( array $params, array $providers = [] ) { - - foreach ( $params as $key => $value ) { - $this->container->share( $key, $value ); - } - - /** - * Runs before the plugin is loaded. - */ - $this->dispatcher->do_action( "{$this->container->get('prefix')}before_load" ); - - add_filter( "{$this->container->get('prefix')}container", [ $this, 'get_container' ] ); - - $this->container->share( 'event_manager', $this->event_manager ); - $this->container->share( 'dispatcher', $this->dispatcher ); - - $this->container->inflector( PrefixAwareInterface::class )->invokeMethod( 'set_prefix', [ $this->container->get( 'prefix' ) ] ); - $this->container->inflector( DispatcherAwareInterface::class )->invokeMethod( 'set_dispatcher', [ $this->container->get( 'dispatcher' ) ] ); - - $providers = array_map( - function ( $classname ) { - if ( is_string( $classname ) ) { - return new $classname(); - } - - return $classname; - }, - $providers - ); - - $providers = $this->optimize_service_providers( $providers ); - - foreach ( $providers as $service_provider ) { - $this->container->addServiceProvider( $service_provider ); - } - - foreach ( $providers as $service_provider ) { - if ( ! $service_provider instanceof HasInflectorInterface ) { - continue; - } - $service_provider->register_inflectors(); - } - - foreach ( $providers as $service_provider ) { - $this->load_init_subscribers( $service_provider ); - } - - foreach ( $providers as $service_provider ) { - $this->load_subscribers( $service_provider ); - } - - /** - * Runs after the plugin is loaded. - */ - $this->dispatcher->do_action( "{$this->container->get('prefix')}after_load" ); - } - - /** - * Optimize service providers to keep only the ones we need to load. - * - * @param ServiceProviderInterface[] $providers Providers given to the plugin. - * - * @return ServiceProviderInterface[] - * - * @throws ContainerExceptionInterface Error from the container. - * @throws NotFoundExceptionInterface Error when a class is not found on the container. - */ - protected function optimize_service_providers( array $providers ): array { - $optimized_providers = []; - - foreach ( $providers as $provider ) { - if ( ! $provider instanceof IsOptimizableServiceProvider ) { - $optimized_providers[] = $provider; - continue; - } - $subscribers = array_merge( $provider->get_common_subscribers(), $provider->get_init_subscribers(), is_admin() ? $provider->get_admin_subscribers() : $provider->get_front_subscribers() ); - - /** - * Plugin Subscribers from a provider. - * - * @param SubscriberInterface[] $subscribers Subscribers. - * @param AbstractServiceProvider $provider Provider. - * - * @return SubscriberInterface[] - */ - $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_provider_subscribers", new SubscriberSignaturesSanitizer(), $subscribers, $provider ); - - if ( count( $subscribers ) === 0 ) { - continue; - } - - $optimized_providers[] = $provider; - } - - return $optimized_providers; - } - - /** - * Load list of event subscribers from service provider. - * - * @param ServiceProviderInterface $service_provider_instance Instance of service provider. - * - * @return void - * - * @throws ContainerExceptionInterface Error from the container. - * @throws NotFoundExceptionInterface Error when a class is not found on the container. - * @throws ReflectionException Error when a classname is invalid. - */ - private function load_init_subscribers( ServiceProviderInterface $service_provider_instance ) { - $subscribers = $service_provider_instance->get_init_subscribers(); - - /** - * Plugin Init Subscribers. - * - * @param SubscriberInterface[] $subscribers Subscribers. - * - * @return SubscriberInterface[] - */ - $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_init_subscribers", new SubscriberSignaturesSanitizer(), $subscribers ); - - if ( empty( $subscribers ) ) { - return; - } - - foreach ( $subscribers as $subscriber ) { - $subscriber_object = $this->container->get( $subscriber ); - if ( ! $subscriber_object instanceof ClassicSubscriberInterface ) { - $subscriber_object = $this->subscriber_wrapper->wrap( $subscriber_object ); - } - - $this->event_manager->add_subscriber( $subscriber_object ); - } - } - - /** - * Load list of event subscribers from service provider. - * - * @param ServiceProviderInterface $service_provider_instance Instance of service provider. - * - * @return void - * - * @throws ContainerExceptionInterface Error from the container. - * @throws NotFoundExceptionInterface Error when a class is not found on the container. - * @throws ReflectionException Error when a classname is invalid. - */ - private function load_subscribers( ServiceProviderInterface $service_provider_instance ) { - - $subscribers = $service_provider_instance->get_common_subscribers(); - - if ( ! is_admin() ) { - $subscribers = array_merge( $subscribers, $service_provider_instance->get_front_subscribers() ); - } else { - $subscribers = array_merge( $subscribers, $service_provider_instance->get_admin_subscribers() ); - } - - /** - * Plugin Subscribers. - * - * @param SubscriberInterface[] $subscribers Subscribers. - * @param AbstractServiceProvider $service_provider_instance Provider. - * - * @return SubscriberInterface[] - */ - $subscribers = $this->dispatcher->apply_filters( "{$this->container->get('prefix')}load_subscribers", new SubscriberSignaturesSanitizer(), $subscribers, $service_provider_instance ); - - if ( empty( $subscribers ) ) { - return; - } - - foreach ( $subscribers as $subscriber ) { - $subscriber_object = $this->container->get( $subscriber ); - if ( ! $subscriber_object instanceof ClassicSubscriberInterface ) { - $subscriber_object = $this->subscriber_wrapper->wrap( $subscriber_object ); - } - - $this->event_manager->add_subscriber( $subscriber_object ); - } - } -} diff --git a/src/Dependencies/LaunchpadCore/boot.php b/src/Dependencies/LaunchpadCore/boot.php deleted file mode 100644 index d17f37a..0000000 --- a/src/Dependencies/LaunchpadCore/boot.php +++ /dev/null @@ -1,99 +0,0 @@ -load( $params, $providers ); - } - ); - - Deactivation::set_container( new Container() ); - Deactivation::set_dispatcher( new Dispatcher() ); - Deactivation::set_params( $params ); - Deactivation::set_providers( $providers ); - - register_deactivation_hook( $plugin_launcher_file, [ Deactivation::class, 'deactivate_plugin' ] ); - - Activation::set_container( new Container() ); - Activation::set_dispatcher( new Dispatcher() ); - Activation::set_params( $params ); - Activation::set_providers( $providers ); - - register_activation_hook( $plugin_launcher_file, [ Activation::class, 'activate_plugin' ] ); -} diff --git a/src/Dependencies/LaunchpadDispatcher/Dispatcher.php b/src/Dependencies/LaunchpadDispatcher/Dispatcher.php deleted file mode 100644 index d155f3f..0000000 --- a/src/Dependencies/LaunchpadDispatcher/Dispatcher.php +++ /dev/null @@ -1,102 +0,0 @@ -call_deprecated_actions($name, ...$parameters); - do_action($name, ...$parameters); - } - - public function apply_filters(string $name, SanitizerInterface $sanitizer, $default, ...$parameters) - { - $result_deprecated = $this->call_deprecated_filters($name, $default, ...$parameters); - - $result = apply_filters($name, $result_deprecated, ...$parameters); - - $sanitized_result = $sanitizer->sanitize($result); - - if( false === $sanitized_result && $sanitizer->is_default($sanitized_result, $result) ) { - return $default; - } - - return $sanitized_result; - } - - public function apply_string_filters(string $name, string $default, ...$parameters): string - { - return $this->apply_filters($name, new StringSanitizer(), $default, ...$parameters); - } - - public function apply_bool_filters(string $name, bool $default, ...$parameters): bool - { - return $this->apply_filters($name, new BoolSanitizer(), $default, ...$parameters); - } - - public function apply_int_filters(string $name, int $default, ...$parameters): int - { - return $this->apply_filters($name, new IntSanitizer(), $default, ...$parameters); - } - - public function apply_float_filters(string $name, float $default, ...$parameters): float - { - return $this->apply_filters($name, new FloatSanitizer(), $default, ...$parameters); - } - - public function add_deprecated_action(string $name, string $deprecated_name, string $version, string $message = '') - { - $this->deprecated_actions[$name][] = [ - 'name' => $deprecated_name, - 'version' => $version, - 'message' => $message - ]; - } - - public function add_deprecated_filter(string $name, string $deprecated_name, string $version, string $message = '') - { - $this->deprecated_filters[$name][] = [ - 'name' => $deprecated_name, - 'version' => $version, - 'message' => $message - ]; - } - - protected function call_deprecated_actions(string $name, ...$parameters) - { - if( ! key_exists($name, $this->deprecated_actions)) { - return; - } - - foreach ($this->deprecated_actions[$name] as $action) { - do_action_deprecated($action['name'], $parameters, $action['version'], $name, $action['message']); - $this->call_deprecated_actions($action['name'], ...$parameters); - } - } - - protected function call_deprecated_filters(string $name, $default, ...$parameters) - { - if( ! key_exists($name, $this->deprecated_filters)) { - return $default; - } - - foreach ($this->deprecated_filters[$name] as $filter) { - $filter_parameters = array_merge([$default], $parameters); - $default = apply_filters_deprecated($filter['name'], $filter_parameters, $filter['version'], $name, $filter['message']); - $default = $this->call_deprecated_filters($filter['name'], $default, ...$parameters); - } - - return $default; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php b/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php deleted file mode 100644 index b784264..0000000 --- a/src/Dependencies/LaunchpadDispatcher/Interfaces/SanitizerInterface.php +++ /dev/null @@ -1,10 +0,0 @@ -register_service(OptionsInterface::class) - ->share() - ->set_concrete(Options::class) - ->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument('prefix'); - }); - - $this->register_service(TransientsInterface::class) - ->share() - ->set_concrete(Transients::class) - ->set_definition(function (DefinitionInterface $definition) { - $definition->addArgument('prefix'); - }); - - $this->register_service(SettingsInterface::class) - ->share() - ->set_concrete(Settings::class) - ->set_definition(function (DefinitionInterface $definition) { - $prefix = $this->container->get('prefix'); - $definition->addArguments([OptionsInterface::class, "{$prefix}settings"]); - }); - } - - /** - * Returns inflectors. - * - * @return array[] - */ - public function get_inflectors(): array - { - return [ - OptionsAwareInterface::class => [ - 'method' => 'set_options', - 'args' => [ - OptionsInterface::class, - ], - ], - TransientsAwareInterface::class => [ - 'method' => 'set_transients', - 'args' => [ - TransientsInterface::class, - ], - ], - SettingsAwareInterface::class => [ - 'method' => 'set_settings', - 'args' => [ - SettingsInterface::class, - ], - ], - ]; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php deleted file mode 100644 index 2ac1d50..0000000 --- a/src/Dependencies/LaunchpadFrameworkOptions/Traits/OptionsAwareTrait.php +++ /dev/null @@ -1,26 +0,0 @@ -options = $options; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php deleted file mode 100644 index 33e407e..0000000 --- a/src/Dependencies/LaunchpadFrameworkOptions/Traits/SettingsAwareTrait.php +++ /dev/null @@ -1,26 +0,0 @@ -settings = $settings; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php b/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php deleted file mode 100644 index 0f10433..0000000 --- a/src/Dependencies/LaunchpadFrameworkOptions/Traits/TransientsAwareTrait.php +++ /dev/null @@ -1,26 +0,0 @@ -transients = $transients; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php b/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php deleted file mode 100644 index 714f360..0000000 --- a/src/Dependencies/LaunchpadOptions/Interfaces/Actions/DeleteInterface.php +++ /dev/null @@ -1,15 +0,0 @@ - $values Values to import. - * - * @return void - */ - public function import(array $values); - - /** - * Export settings values. - * - * @return array - */ - public function dumps(): array; -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php b/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php deleted file mode 100644 index 756dc2f..0000000 --- a/src/Dependencies/LaunchpadOptions/Interfaces/TransientsInterface.php +++ /dev/null @@ -1,25 +0,0 @@ -prefix = $prefix; - } - - /** - * Gets the option for the given name. Returns the default value if the value does not exist. - * - * @param string $name Name of the option to get. - * @param mixed $default Default value to return if the value does not exist. - * - * @return mixed - */ - public function get( string $name, $default = null ) { - $option = get_option( $this->get_full_key( $name ), $default ); - - if ( is_array( $default ) && ! is_array( $option ) ) { - $option = (array) $option; - } - - return $option; - } - - /** - * Sets the value of an option. Update the value if the option for the given name already exists. - * - * @param string $name Name of the option to set. - * @param mixed $value Value to set for the option. - * - * @return void - */ - public function set( string $name, $value ) { - update_option( $this->get_full_key( $name ), $value ); - } - - /** - * Deletes the option with the given name. - * - * @param string $name Name of the option to delete. - * - * @return void - */ - public function delete( string $name ) { - delete_option( $this->get_full_key( $name ) ); - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Settings.php b/src/Dependencies/LaunchpadOptions/Settings.php deleted file mode 100644 index b3eb57a..0000000 --- a/src/Dependencies/LaunchpadOptions/Settings.php +++ /dev/null @@ -1,142 +0,0 @@ -options = $options; - $this->settings_key = $settings_key; - $this->settings = (array) $this->options->get($settings_key, []); - } - - /** - * @inheritDoc - */ - public function get(string $name, $default = null) - { - /** - * Pre-filter any setting before read - * - * @param mixed $default The default value. - */ - $value = apply_filters( "pre_get_{$this->settings_key}_" . $name, null, $default ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound - - if ( null !== $value ) { - return $value; - } - - if( ! $this->has($name)) { - return $default; - } - - /** - * Filter any setting after read - * - * @param mixed $default The default value. - */ - return apply_filters( "get_{$this->settings_key}" . $name, $this->settings[$name], $default ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound - } - - /** - * @inheritDoc - */ - public function set(string $name, $value) - { - $this->settings[$name] = $value; - - $this->persist(); - } - - /** - * @inheritDoc - */ - public function delete(string $name) - { - unset($this->settings[$name]); - - $this->persist(); - } - - /** - * @inheritDoc - */ - public function has(string $name): bool - { - return key_exists($name, $this->settings); - } - - /** - * Persist the settings into the database. - * @return void - */ - protected function persist() - { - do_action("pre_persist_{$this->settings_key}", $this->settings); - - $this->options->set($this->settings_key, $this->settings); - - do_action("persist_{$this->settings_key}", $this->settings); - } - - /** - * Import multiple values at once. - * - * @param array $values Values to import. - * - * @return void - */ - public function import(array $values) - { - foreach ($values as $name => $value) { - $this->settings[$name] = $value; - } - - $this->persist(); - } - - /** - * Export settings values. - * - * @return array - */ - public function dumps(): array - { - $output = []; - - foreach ($this->settings as $name => $value) { - $output[$name] = $this->get($name); - } - - return $output; - } -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php b/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php deleted file mode 100644 index 89b6133..0000000 --- a/src/Dependencies/LaunchpadOptions/Traits/PrefixedKeyTrait.php +++ /dev/null @@ -1,45 +0,0 @@ -prefix . $name; - } - - /** - * Checks if the option with the given name exists. - * - * @param string $name Name of the option to check. - * - * @return bool - */ - public function has( string $name ): bool { - return null !== $this->get( $name ); - } - - /** - * Gets the option for the given name. Returns the default value if the value does not exist. - * - * @param string $name Name of the option to get. - * @param mixed $default Default value to return if the value does not exist. - * - * @return mixed - */ - abstract public function get( string $name, $default = null ); -} \ No newline at end of file diff --git a/src/Dependencies/LaunchpadOptions/Transients.php b/src/Dependencies/LaunchpadOptions/Transients.php deleted file mode 100644 index 1baf132..0000000 --- a/src/Dependencies/LaunchpadOptions/Transients.php +++ /dev/null @@ -1,64 +0,0 @@ -prefix = $prefix; - } - - /** - * Gets the transient for the given name. Returns the default value if the value does not exist. - * - * @param string $name Name of the transient to get. - * @param mixed $default Default value to return if the value does not exist. - * - * @return mixed - */ - public function get(string $name, $default = null) - { - $transient = get_transient( $this->get_full_key( $name ), $default ); - - if ( is_array( $default ) && ! is_array( $transient ) ) { - $option = (array) $transient; - } - - return $transient; - } - - /** - * Sets the value of an transient. Update the value if the transient for the given name already exists. - * - * @param string $name Name of the transient to set. - * @param mixed $value Value to set for the transient. - * @param int $expiration Time until expiration in seconds. Default 0 (no expiration). - * - * @return void - */ - public function set(string $name, $value, int $expiration = 0) - { - set_transient( $this->get_full_key( $name ), $value, $expiration ); - } - - /** - * Deletes the transient with the given name. - * - * @param string $name Name of the transient to delete. - * - * @return void - */ - public function delete(string $name) - { - delete_transient( $this->get_full_key( $name ) ); - } -} \ No newline at end of file diff --git a/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php b/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php deleted file mode 100644 index d6cabf4..0000000 --- a/src/Dependencies/League/Container/Argument/ArgumentResolverInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -getValue(); - } elseif ($argument instanceof ClassNameInterface) { - $id = $argument->getClassName(); - } elseif (!is_string($argument)) { - return $argument; - } else { - $justStringValue = true; - $id = $argument; - } - - $container = null; - - try { - $container = $this->getLeagueContainer(); - } catch (ContainerException $e) { - if ($this instanceof ReflectionContainer) { - $container = $this; - } - } - - if ($container !== null) { - try { - return $container->get($id); - } catch (NotFoundException $exception) { - if ($argument instanceof ClassNameWithOptionalValue) { - return $argument->getOptionalValue(); - } - - if ($justStringValue) { - return $id; - } - - throw $exception; - } - } - - if ($argument instanceof ClassNameWithOptionalValue) { - return $argument->getOptionalValue(); - } - - // Just a string value. - return $id; - }, $arguments); - } - - /** - * {@inheritdoc} - */ - public function reflectArguments(ReflectionFunctionAbstract $method, array $args = []) : array - { - $arguments = array_map(function (ReflectionParameter $param) use ($method, $args) { - $name = $param->getName(); - $type = $param->getType(); - - if (array_key_exists($name, $args)) { - return new RawArgument($args[$name]); - } - - if ($type) { - if (PHP_VERSION_ID >= 70100) { - $typeName = $type->getName(); - } else { - $typeName = (string) $type; - } - - $typeName = ltrim($typeName, '?'); - - if ($param->isDefaultValueAvailable()) { - return new ClassNameWithOptionalValue($typeName, $param->getDefaultValue()); - } - - return new ClassName($typeName); - } - - if ($param->isDefaultValueAvailable()) { - return new RawArgument($param->getDefaultValue()); - } - - throw new NotFoundException(sprintf( - 'Unable to resolve a value for parameter (%s) in the function/method (%s)', - $name, - $method->getName() - )); - }, $method->getParameters()); - - return $this->resolveArguments($arguments); - } - - /** - * @return ContainerInterface - */ - abstract public function getContainer() : ContainerInterface; - - /** - * @return Container - */ - abstract public function getLeagueContainer() : Container; -} diff --git a/src/Dependencies/League/Container/Argument/ClassName.php b/src/Dependencies/League/Container/Argument/ClassName.php deleted file mode 100644 index e283336..0000000 --- a/src/Dependencies/League/Container/Argument/ClassName.php +++ /dev/null @@ -1,29 +0,0 @@ -value = $value; - } - - /** - * {@inheritdoc} - */ - public function getClassName() : string - { - return $this->value; - } -} diff --git a/src/Dependencies/League/Container/Argument/ClassNameInterface.php b/src/Dependencies/League/Container/Argument/ClassNameInterface.php deleted file mode 100644 index 2e26f78..0000000 --- a/src/Dependencies/League/Container/Argument/ClassNameInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -className = $className; - $this->optionalValue = $optionalValue; - } - - /** - * @inheritDoc - */ - public function getClassName(): string - { - return $this->className; - } - - public function getOptionalValue() - { - return $this->optionalValue; - } -} diff --git a/src/Dependencies/League/Container/Argument/RawArgument.php b/src/Dependencies/League/Container/Argument/RawArgument.php deleted file mode 100644 index 6c4a584..0000000 --- a/src/Dependencies/League/Container/Argument/RawArgument.php +++ /dev/null @@ -1,29 +0,0 @@ -value = $value; - } - - /** - * {@inheritdoc} - */ - public function getValue() - { - return $this->value; - } -} diff --git a/src/Dependencies/League/Container/Argument/RawArgumentInterface.php b/src/Dependencies/League/Container/Argument/RawArgumentInterface.php deleted file mode 100644 index d81c312..0000000 --- a/src/Dependencies/League/Container/Argument/RawArgumentInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -definitions = $definitions ?? new DefinitionAggregate; - $this->providers = $providers ?? new ServiceProviderAggregate; - $this->inflectors = $inflectors ?? new InflectorAggregate; - - if ($this->definitions instanceof ContainerAwareInterface) { - $this->definitions->setLeagueContainer($this); - } - - if ($this->providers instanceof ContainerAwareInterface) { - $this->providers->setLeagueContainer($this); - } - - if ($this->inflectors instanceof ContainerAwareInterface) { - $this->inflectors->setLeagueContainer($this); - } - } - - /** - * Add an item to the container. - * - * @param string $id - * @param mixed $concrete - * @param boolean $shared - * - * @return DefinitionInterface - */ - public function add(string $id, $concrete = null, bool $shared = null) : DefinitionInterface - { - $concrete = $concrete ?? $id; - $shared = $shared ?? $this->defaultToShared; - - return $this->definitions->add($id, $concrete, $shared); - } - - /** - * Proxy to add with shared as true. - * - * @param string $id - * @param mixed $concrete - * - * @return DefinitionInterface - */ - public function share(string $id, $concrete = null) : DefinitionInterface - { - return $this->add($id, $concrete, true); - } - - /** - * Whether the container should default to defining shared definitions. - * - * @param boolean $shared - * - * @return self - */ - public function defaultToShared(bool $shared = true) : ContainerInterface - { - $this->defaultToShared = $shared; - - return $this; - } - - /** - * Get a definition to extend. - * - * @param string $id [description] - * - * @return DefinitionInterface - */ - public function extend(string $id) : DefinitionInterface - { - if ($this->providers->provides($id)) { - $this->providers->register($id); - } - - if ($this->definitions->has($id)) { - return $this->definitions->getDefinition($id); - } - - throw new NotFoundException( - sprintf('Unable to extend alias (%s) as it is not being managed as a definition', $id) - ); - } - - /** - * Add a service provider. - * - * @param ServiceProviderInterface|string $provider - * - * @return self - */ - public function addServiceProvider($provider) : self - { - $this->providers->add($provider); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function get($id, bool $new = false) - { - if ($this->definitions->has($id)) { - $resolved = $this->definitions->resolve($id, $new); - return $this->inflectors->inflect($resolved); - } - - if ($this->definitions->hasTag($id)) { - $arrayOf = $this->definitions->resolveTagged($id, $new); - - array_walk($arrayOf, function (&$resolved) { - $resolved = $this->inflectors->inflect($resolved); - }); - - return $arrayOf; - } - - if ($this->providers->provides($id)) { - $this->providers->register($id); - - if (!$this->definitions->has($id) && !$this->definitions->hasTag($id)) { - throw new ContainerException(sprintf('Service provider lied about providing (%s) service', $id)); - } - - return $this->get($id, $new); - } - - foreach ($this->delegates as $delegate) { - if ($delegate->has($id)) { - $resolved = $delegate->get($id); - return $this->inflectors->inflect($resolved); - } - } - - throw new NotFoundException(sprintf('Alias (%s) is not being managed by the container or delegates', $id)); - } - - /** - * {@inheritdoc} - */ - public function has($id) - { - if ($this->definitions->has($id)) { - return true; - } - - if ($this->definitions->hasTag($id)) { - return true; - } - - if ($this->providers->provides($id)) { - return true; - } - - foreach ($this->delegates as $delegate) { - if ($delegate->has($id)) { - return true; - } - } - - return false; - } - - /** - * Allows for manipulation of specific types on resolution. - * - * @param string $type - * @param callable|null $callback - * - * @return InflectorInterface - */ - public function inflector(string $type, callable $callback = null) : InflectorInterface - { - return $this->inflectors->add($type, $callback); - } - - /** - * Delegate a backup container to be checked for services if it - * cannot be resolved via this container. - * - * @param ContainerInterface $container - * - * @return self - */ - public function delegate(ContainerInterface $container) : self - { - $this->delegates[] = $container; - - if ($container instanceof ContainerAwareInterface) { - $container->setLeagueContainer($this); - } - - return $this; - } -} diff --git a/src/Dependencies/League/Container/ContainerAwareInterface.php b/src/Dependencies/League/Container/ContainerAwareInterface.php deleted file mode 100644 index 8a9f8a6..0000000 --- a/src/Dependencies/League/Container/ContainerAwareInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -container = $container; - - return $this; - } - - /** - * Get the container. - * - * @return ContainerInterface - */ - public function getContainer() : ContainerInterface - { - if ($this->container instanceof ContainerInterface) { - return $this->container; - } - - throw new ContainerException('No container implementation has been set.'); - } - - /** - * Set a container. - * - * @param Container $container - * - * @return self - */ - public function setLeagueContainer(Container $container) : ContainerAwareInterface - { - $this->container = $container; - $this->leagueContainer = $container; - - return $this; - } - - /** - * Get the container. - * - * @return Container - */ - public function getLeagueContainer() : Container - { - if ($this->leagueContainer instanceof Container) { - return $this->leagueContainer; - } - - throw new ContainerException('No container implementation has been set.'); - } -} diff --git a/src/Dependencies/League/Container/Definition/Definition.php b/src/Dependencies/League/Container/Definition/Definition.php deleted file mode 100644 index ff5c0c7..0000000 --- a/src/Dependencies/League/Container/Definition/Definition.php +++ /dev/null @@ -1,278 +0,0 @@ -alias = $id; - $this->concrete = $concrete; - } - - /** - * {@inheritdoc} - */ - public function addTag(string $tag) : DefinitionInterface - { - $this->tags[$tag] = true; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasTag(string $tag) : bool - { - return isset($this->tags[$tag]); - } - - /** - * {@inheritdoc} - */ - public function setAlias(string $id) : DefinitionInterface - { - $this->alias = $id; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getAlias() : string - { - return $this->alias; - } - - /** - * {@inheritdoc} - */ - public function setShared(bool $shared = true) : DefinitionInterface - { - $this->shared = $shared; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function isShared() : bool - { - return $this->shared; - } - - /** - * {@inheritdoc} - */ - public function getConcrete() - { - return $this->concrete; - } - - /** - * {@inheritdoc} - */ - public function setConcrete($concrete) : DefinitionInterface - { - $this->concrete = $concrete; - $this->resolved = null; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addArgument($arg) : DefinitionInterface - { - $this->arguments[] = $arg; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addArguments(array $args) : DefinitionInterface - { - foreach ($args as $arg) { - $this->addArgument($arg); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addMethodCall(string $method, array $args = []) : DefinitionInterface - { - $this->methods[] = [ - 'method' => $method, - 'arguments' => $args - ]; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addMethodCalls(array $methods = []) : DefinitionInterface - { - foreach ($methods as $method => $args) { - $this->addMethodCall($method, $args); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function resolve(bool $new = false) - { - $concrete = $this->concrete; - - if ($this->isShared() && $this->resolved !== null && $new === false) { - return $this->resolved; - } - - if (is_callable($concrete)) { - $concrete = $this->resolveCallable($concrete); - } - - if ($concrete instanceof RawArgumentInterface) { - $this->resolved = $concrete->getValue(); - - return $concrete->getValue(); - } - - if ($concrete instanceof ClassNameInterface) { - $concrete = $concrete->getClassName(); - } - - if (is_string($concrete) && class_exists($concrete)) { - $concrete = $this->resolveClass($concrete); - } - - if (is_object($concrete)) { - $concrete = $this->invokeMethods($concrete); - } - - if (is_string($concrete) && $this->getContainer()->has($concrete)) { - $concrete = $this->getContainer()->get($concrete); - } - - $this->resolved = $concrete; - - return $concrete; - } - - /** - * Resolve a callable. - * - * @param callable $concrete - * - * @return mixed - */ - protected function resolveCallable(callable $concrete) - { - $resolved = $this->resolveArguments($this->arguments); - - return call_user_func_array($concrete, $resolved); - } - - /** - * Resolve a class. - * - * @param string $concrete - * - * @return object - * - * @throws ReflectionException - */ - protected function resolveClass(string $concrete) - { - $resolved = $this->resolveArguments($this->arguments); - $reflection = new ReflectionClass($concrete); - - return $reflection->newInstanceArgs($resolved); - } - - /** - * Invoke methods on resolved instance. - * - * @param object $instance - * - * @return object - */ - protected function invokeMethods($instance) - { - foreach ($this->methods as $method) { - $args = $this->resolveArguments($method['arguments']); - - /** @var callable $callable */ - $callable = [$instance, $method['method']]; - call_user_func_array($callable, $args); - } - - return $instance; - } -} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregate.php b/src/Dependencies/League/Container/Definition/DefinitionAggregate.php deleted file mode 100644 index 73e1d4b..0000000 --- a/src/Dependencies/League/Container/Definition/DefinitionAggregate.php +++ /dev/null @@ -1,124 +0,0 @@ -definitions = array_filter($definitions, function ($definition) { - return ($definition instanceof DefinitionInterface); - }); - } - - /** - * {@inheritdoc} - */ - public function add(string $id, $definition, bool $shared = false) : DefinitionInterface - { - if (!$definition instanceof DefinitionInterface) { - $definition = new Definition($id, $definition); - } - - $this->definitions[] = $definition - ->setAlias($id) - ->setShared($shared) - ; - - return $definition; - } - - /** - * {@inheritdoc} - */ - public function has(string $id) : bool - { - foreach ($this->getIterator() as $definition) { - if ($id === $definition->getAlias()) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function hasTag(string $tag) : bool - { - foreach ($this->getIterator() as $definition) { - if ($definition->hasTag($tag)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getDefinition(string $id) : DefinitionInterface - { - foreach ($this->getIterator() as $definition) { - if ($id === $definition->getAlias()) { - return $definition->setLeagueContainer($this->getLeagueContainer()); - } - } - - throw new NotFoundException(sprintf('Alias (%s) is not being handled as a definition.', $id)); - } - - /** - * {@inheritdoc} - */ - public function resolve(string $id, bool $new = false) - { - return $this->getDefinition($id)->resolve($new); - } - - /** - * {@inheritdoc} - */ - public function resolveTagged(string $tag, bool $new = false) : array - { - $arrayOf = []; - - foreach ($this->getIterator() as $definition) { - if ($definition->hasTag($tag)) { - $arrayOf[] = $definition->setLeagueContainer($this->getLeagueContainer())->resolve($new); - } - } - - return $arrayOf; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->definitions); - - for ($i = 0; $i < $count; $i++) { - yield $this->definitions[$i]; - } - } -} diff --git a/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php b/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php deleted file mode 100644 index 7069f2f..0000000 --- a/src/Dependencies/League/Container/Definition/DefinitionAggregateInterface.php +++ /dev/null @@ -1,67 +0,0 @@ -type = $type; - $this->callback = $callback; - } - - /** - * {@inheritdoc} - */ - public function getType() : string - { - return $this->type; - } - - /** - * {@inheritdoc} - */ - public function invokeMethod(string $name, array $args) : InflectorInterface - { - $this->methods[$name] = $args; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function invokeMethods(array $methods) : InflectorInterface - { - foreach ($methods as $name => $args) { - $this->invokeMethod($name, $args); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setProperty(string $property, $value) : InflectorInterface - { - $this->properties[$property] = $this->resolveArguments([$value])[0]; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setProperties(array $properties) : InflectorInterface - { - foreach ($properties as $property => $value) { - $this->setProperty($property, $value); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function inflect($object) - { - $properties = $this->resolveArguments(array_values($this->properties)); - $properties = array_combine(array_keys($this->properties), $properties); - - // array_combine() can technically return false - foreach ($properties ?: [] as $property => $value) { - $object->{$property} = $value; - } - - foreach ($this->methods as $method => $args) { - $args = $this->resolveArguments($args); - - /** @var callable $callable */ - $callable = [$object, $method]; - call_user_func_array($callable, $args); - } - - if ($this->callback !== null) { - call_user_func($this->callback, $object); - } - } -} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregate.php b/src/Dependencies/League/Container/Inflector/InflectorAggregate.php deleted file mode 100644 index 644668e..0000000 --- a/src/Dependencies/League/Container/Inflector/InflectorAggregate.php +++ /dev/null @@ -1,58 +0,0 @@ -inflectors[] = $inflector; - - return $inflector; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->inflectors); - - for ($i = 0; $i < $count; $i++) { - yield $this->inflectors[$i]; - } - } - - /** - * {@inheritdoc} - */ - public function inflect($object) - { - foreach ($this->getIterator() as $inflector) { - $type = $inflector->getType(); - - if (! $object instanceof $type) { - continue; - } - - $inflector->setLeagueContainer($this->getLeagueContainer()); - $inflector->inflect($object); - } - - return $object; - } -} diff --git a/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php b/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php deleted file mode 100644 index 7309e01..0000000 --- a/src/Dependencies/League/Container/Inflector/InflectorAggregateInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -cacheResolutions === true && array_key_exists($id, $this->cache)) { - return $this->cache[$id]; - } - - if (! $this->has($id)) { - throw new NotFoundException( - sprintf('Alias (%s) is not an existing class and therefore cannot be resolved', $id) - ); - } - - $reflector = new ReflectionClass($id); - $construct = $reflector->getConstructor(); - - if ($construct && !$construct->isPublic()) { - throw new NotFoundException( - sprintf('Alias (%s) has a non-public constructor and therefore cannot be instantiated', $id) - ); - } - - $resolution = $construct === null - ? new $id - : $resolution = $reflector->newInstanceArgs($this->reflectArguments($construct, $args)) - ; - - if ($this->cacheResolutions === true) { - $this->cache[$id] = $resolution; - } - - return $resolution; - } - - /** - * {@inheritdoc} - */ - public function has($id) - { - return class_exists($id); - } - - /** - * Invoke a callable via the container. - * - * @param callable $callable - * @param array $args - * - * @return mixed - * - * @throws ReflectionException - */ - public function call(callable $callable, array $args = []) - { - if (is_string($callable) && strpos($callable, '::') !== false) { - $callable = explode('::', $callable); - } - - if (is_array($callable)) { - if (is_string($callable[0])) { - $callable[0] = $this->getContainer()->get($callable[0]); - } - - $reflection = new ReflectionMethod($callable[0], $callable[1]); - - if ($reflection->isStatic()) { - $callable[0] = null; - } - - return $reflection->invokeArgs($callable[0], $this->reflectArguments($reflection, $args)); - } - - if (is_object($callable)) { - $reflection = new ReflectionMethod($callable, '__invoke'); - - return $reflection->invokeArgs($callable, $this->reflectArguments($reflection, $args)); - } - - $reflection = new ReflectionFunction(\Closure::fromCallable($callable)); - - return $reflection->invokeArgs($this->reflectArguments($reflection, $args)); - } - - /** - * Whether the container should default to caching resolutions and returning - * the cache on following calls. - * - * @param boolean $option - * - * @return self - */ - public function cacheResolutions(bool $option = true) : ContainerInterface - { - $this->cacheResolutions = $option; - - return $this; - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php b/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php deleted file mode 100644 index 1b356af..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/AbstractServiceProvider.php +++ /dev/null @@ -1,46 +0,0 @@ -provides, true); - } - - /** - * {@inheritdoc} - */ - public function setIdentifier(string $id) : ServiceProviderInterface - { - $this->identifier = $id; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getIdentifier() : string - { - return $this->identifier ?? get_class($this); - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php b/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php deleted file mode 100644 index 895f4be..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/BootableServiceProviderInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -getContainer()->has($provider)) { - $provider = $this->getContainer()->get($provider); - } elseif (is_string($provider) && class_exists($provider)) { - $provider = new $provider; - } - - if (in_array($provider, $this->providers, true)) { - return $this; - } - - if ($provider instanceof ContainerAwareInterface) { - $provider->setLeagueContainer($this->getLeagueContainer()); - } - - if ($provider instanceof BootableServiceProviderInterface) { - $provider->boot(); - } - - if ($provider instanceof ServiceProviderInterface) { - $this->providers[] = $provider; - - return $this; - } - - throw new ContainerException( - 'A service provider must be a fully qualified class name or instance ' . - 'of (\RocketCDN\Dependencies\League\Container\ServiceProvider\ServiceProviderInterface)' - ); - } - - /** - * {@inheritdoc} - */ - public function provides(string $service) : bool - { - foreach ($this->getIterator() as $provider) { - if ($provider->provides($service)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getIterator() : Generator - { - $count = count($this->providers); - - for ($i = 0; $i < $count; $i++) { - yield $this->providers[$i]; - } - } - - /** - * {@inheritdoc} - */ - public function register(string $service) - { - if (false === $this->provides($service)) { - throw new ContainerException( - sprintf('(%s) is not provided by a service provider', $service) - ); - } - - foreach ($this->getIterator() as $provider) { - if (in_array($provider->getIdentifier(), $this->registered, true)) { - continue; - } - - if ($provider->provides($service)) { - $this->registered[] = $provider->getIdentifier(); - $provider->register(); - } - } - } -} diff --git a/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php b/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php deleted file mode 100644 index a0eb57e..0000000 --- a/src/Dependencies/League/Container/ServiceProvider/ServiceProviderAggregateInterface.php +++ /dev/null @@ -1,36 +0,0 @@ -leagueContainer property or the `getLeagueContainer` method - * from the ContainerAwareTrait. - * - * @return void - */ - public function register(); - - /** - * Set a custom id for the service provider. This enables - * registering the same service provider multiple times. - * - * @param string $id - * - * @return self - */ - public function setIdentifier(string $id) : ServiceProviderInterface; - - /** - * The id of the service provider uniquely identifies it, so - * that we can quickly determine if it has already been registered. - * Defaults to get_class($provider). - * - * @return string - */ - public function getIdentifier() : string; -} diff --git a/src/Dependencies/Psr/Container/ContainerExceptionInterface.php b/src/Dependencies/Psr/Container/ContainerExceptionInterface.php deleted file mode 100644 index c0ddbc0..0000000 --- a/src/Dependencies/Psr/Container/ContainerExceptionInterface.php +++ /dev/null @@ -1,12 +0,0 @@ - Date: Thu, 4 Jul 2024 09:48:02 +0200 Subject: [PATCH 34/40] Added deploy script updated --- .github/workflows/deploy-tag.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-tag.yml b/.github/workflows/deploy-tag.yml index 1ceeb23..e3c11f7 100644 --- a/.github/workflows/deploy-tag.yml +++ b/.github/workflows/deploy-tag.yml @@ -11,6 +11,8 @@ jobs: - uses: actions/checkout@master - name: remove installers run: composer remove composer/installers + - name: regular build + run: composer install - name: optimized build run: composer install -o --no-dev --no-scripts - name: WordPress Plugin Deploy From 7156097df592afdd7956191b01fecaaafbac60c7 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Fri, 5 Jul 2024 09:41:03 +0200 Subject: [PATCH 35/40] Added a fix for undefined constant when clearing the cache --- src/Admin/AdminBar/AdminBar.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Admin/AdminBar/AdminBar.php b/src/Admin/AdminBar/AdminBar.php index 132044a..2e982db 100644 --- a/src/Admin/AdminBar/AdminBar.php +++ b/src/Admin/AdminBar/AdminBar.php @@ -6,7 +6,6 @@ use RocketCDN\API\Client; use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Interfaces\OptionsAwareInterface; use RocketCDN\Dependencies\LaunchpadFrameworkOptions\Traits\OptionsAwareTrait; -use RocketCDN\Options\Options; class AdminBar implements OptionsAwareInterface { use OptionsAwareTrait; @@ -166,7 +165,7 @@ public function purge_cache() { * @return void */ protected function exit() { - WP_ROCKET_CDN_IS_TESTING ? wp_die() : exit; + defined('WP_ROCKET_CDN_IS_TESTING') && constant('WP_ROCKET_CDN_IS_TESTING') ? wp_die() : exit; } /** From 22702349ceec37688a9e562414d527f2ed565d55 Mon Sep 17 00:00:00 2001 From: Cyrille C <18537428+CrochetFeve0251@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:10:49 +0200 Subject: [PATCH 36/40] Update readme.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rémy Perona --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 6fe510d..7525273 100644 --- a/readme.txt +++ b/readme.txt @@ -208,7 +208,7 @@ You can report any security bugs found in the source code of the site-reviews pl == Changelog == -= 1.0.5 = += 1.0.6 = - Launchpad framework integration = 1.0.5 = From 9df0375a1cedbc05913bc1f12994ed32bd740746 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Fri, 5 Jul 2024 13:12:31 +0200 Subject: [PATCH 37/40] Fixed linter --- src/Admin/AdminBar/AdminBar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Admin/AdminBar/AdminBar.php b/src/Admin/AdminBar/AdminBar.php index 2e982db..f023edb 100644 --- a/src/Admin/AdminBar/AdminBar.php +++ b/src/Admin/AdminBar/AdminBar.php @@ -165,7 +165,7 @@ public function purge_cache() { * @return void */ protected function exit() { - defined('WP_ROCKET_CDN_IS_TESTING') && constant('WP_ROCKET_CDN_IS_TESTING') ? wp_die() : exit; + defined( 'WP_ROCKET_CDN_IS_TESTING' ) && constant( 'WP_ROCKET_CDN_IS_TESTING' ) ? wp_die() : exit; } /** From f1c2dba75d6af2d15146d1b661238247ebb6e2ae Mon Sep 17 00:00:00 2001 From: Ahmed Saeed Date: Wed, 20 Jul 2022 09:38:35 -0400 Subject: [PATCH 38/40] exclude admin_url from srcset rewrite --- src/Front/CDN.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Front/CDN.php b/src/Front/CDN.php index f12e51a..5617874 100644 --- a/src/Front/CDN.php +++ b/src/Front/CDN.php @@ -101,6 +101,10 @@ private function rewrite_srcset( string $html ): string { return $html; } foreach ( $srcsets as $srcset ) { + if ( stristr( $srcset[0], admin_url() ) ) { + continue; + } + $sources = explode( ',', $srcset['sources'] ); $sources = array_unique( array_map( 'trim', $sources ) ); $cdn_srcset = $srcset['sources']; From 4e053d14455eb37664e8cba6b2d73347ec996961 Mon Sep 17 00:00:00 2001 From: Ahmed Saeed Date: Mon, 1 Aug 2022 04:38:30 -0400 Subject: [PATCH 39/40] move the code to rewrite_url method --- src/Front/CDN.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Front/CDN.php b/src/Front/CDN.php index 5617874..823daae 100644 --- a/src/Front/CDN.php +++ b/src/Front/CDN.php @@ -101,10 +101,6 @@ private function rewrite_srcset( string $html ): string { return $html; } foreach ( $srcsets as $srcset ) { - if ( stristr( $srcset[0], admin_url() ) ) { - continue; - } - $sources = explode( ',', $srcset['sources'] ); $sources = array_unique( array_map( 'trim', $sources ) ); $cdn_srcset = $srcset['sources']; @@ -128,6 +124,10 @@ private function rewrite_srcset( string $html ): string { * @return string */ public function rewrite_url( string $url ): string { + if ( false !== stripos( $url, admin_url() ) ) { + return $url; + } + $cdn_url = $this->options->get( 'cdn_url' ); if ( ! $cdn_url ) { From dc22f81abebc5387b44976264ae6d7a72d94b01d Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Tue, 23 Jul 2024 15:12:59 +0200 Subject: [PATCH 40/40] Fixed tests --- tests/Fixtures/src/Front/CDN/rewriteUrl.php | 14 ++++++++++---- tests/Unit/src/Front/CDN/rewriteUrl.php | 9 ++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/Fixtures/src/Front/CDN/rewriteUrl.php b/tests/Fixtures/src/Front/CDN/rewriteUrl.php index 4841bb6..a412a87 100644 --- a/tests/Fixtures/src/Front/CDN/rewriteUrl.php +++ b/tests/Fixtures/src/Front/CDN/rewriteUrl.php @@ -3,6 +3,7 @@ 'testNoCdnShouldReturnUrl' => [ 'config' => [ 'homeurl' => 'http://example.org', + 'admin_url' => 'http://example.org/wp-admin/', 'host' => 'example.org', 'cdn' => null, 'url' => 'http://example.org/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', @@ -16,6 +17,7 @@ 'testCdnShouldReturnUrlWithCdn' => [ 'config' => [ 'homeurl' => 'http://example.org', + 'admin_url' => 'http://example.org/wp-admin/', 'host' => 'example.org', 'url' => 'http://example.org/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', 'cdn' => 'cdn', @@ -29,6 +31,7 @@ 'testCdnNoHostShouldReturnUrlWithCdn' => [ 'config' => [ 'homeurl' => 'http://example.org', + 'admin_url' => 'http://example.org/wp-admin/', 'host' => 'example.org', 'url' => '/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', 'cdn' => 'cdn', @@ -36,16 +39,19 @@ ], 'expected' => 'cdn/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', ], - 'testCdnNoSchemeShouldReturnUrlWithCdn' => [ +'testCdnAndAdminShouldReturnNotUrlWithCdn' => [ 'config' => [ + 'is_admin' => true, 'homeurl' => 'http://example.org', + 'admin_url' => 'http://example.org/wp-admin/', 'host' => 'example.org', - 'url' => 'example.org/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', + 'url' => 'http://example.org/wp-admin/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', 'cdn' => 'cdn', 'parsed_url' => [ - 'host' => 'example.org', + 'host' => 'example.org', + 'scheme' => 'http', ], ], - 'expected' => 'cdn/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', + 'expected' => 'http://example.org/wp-admin/wp-content/uploads/2018/03/sticker-mule-189122-unsplash-1568x1046.jpg', ], ]; diff --git a/tests/Unit/src/Front/CDN/rewriteUrl.php b/tests/Unit/src/Front/CDN/rewriteUrl.php index 8b50313..ba41142 100644 --- a/tests/Unit/src/Front/CDN/rewriteUrl.php +++ b/tests/Unit/src/Front/CDN/rewriteUrl.php @@ -30,12 +30,19 @@ protected function setUp(): void { * @dataProvider configTestData */ public function testShouldReturnExpected( $config, $expected ) { - $this->options->expects()->get( 'cdn_url' )->andReturn( $config['cdn'] ); + + if( ! key_exists('is_admin', $config) || ! $config['is_admin']) { + $this->options->expects()->get( 'cdn_url' )->andReturn( $config['cdn'] ); + } Functions\expect( 'home_url' ) ->with() ->andReturn( $config['homeurl'] ); + Functions\expect( 'admin_url' ) + ->with() + ->andReturn( $config['admin_url'] ); + Functions\expect( 'wp_parse_url' ) ->with( $config['url'] )->andReturnUsing( function( $arg1, $arg2 = null ) use ( $config ) {