From 2236b3cfbe176fd719ffd01a11e6ba3d6cc863d4 Mon Sep 17 00:00:00 2001 From: Alex P Date: Thu, 17 Feb 2022 18:18:33 +0200 Subject: [PATCH] Add plugin info retrieval --- composer.json | 4 +- composer.lock | 705 ++++++++++++++++++++++------------ src/FilePathPluginFactory.php | 134 +++++++ src/Plugin.php | 180 +++++++++ src/PluginModule.php | 5 +- src/extensions.php | 12 + src/services.php | 21 + 7 files changed, 816 insertions(+), 245 deletions(-) create mode 100644 src/FilePathPluginFactory.php create mode 100644 src/Plugin.php create mode 100644 src/extensions.php create mode 100644 src/services.php diff --git a/composer.json b/composer.json index f92d4dbff..95a6b1141 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,9 @@ "dhii/containers": "^0.1.0-alpha1", "psr/log": "^1.1", "ralouphie/getallheaders": "^3.0", - "wikimedia/composer-merge-plugin": "^1.4" + "wikimedia/composer-merge-plugin": "^1.4", + "wp-oop/wordpress-interface": "^0.1.0-alpha1", + "dhii/versions": "^0.1.0-alpha1" }, "require-dev": { "woocommerce/woocommerce-sniffs": "^0.1.0", diff --git a/composer.lock b/composer.lock index 1c8ca84eb..f23fe5a12 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": "5ec79a51fc5a2f5576f38dd6e4e87b2d", + "content-hash": "d1d10b7eb9134d3da165ae72ac76f540", "packages": [ { "name": "container-interop/service-provider", @@ -35,10 +35,6 @@ ], "description": "Promoting container interoperability through standard service providers", "homepage": "https://github.com/container-interop/service-provider", - "support": { - "issues": "https://github.com/container-interop/service-provider/issues", - "source": "https://github.com/container-interop/service-provider/tree/master" - }, "time": "2017-09-20T14:13:36+00:00" }, { @@ -148,6 +144,57 @@ ], "time": "2021-10-06T11:13:51+00:00" }, + { + "name": "dhii/human-readable-interface", + "version": "v0.2.0-alpha1", + "source": { + "type": "git", + "url": "https://github.com/Dhii/human-readable-interface.git", + "reference": "2b49d664f117faf72fb7af402ad21c0c27c62b6b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/human-readable-interface/zipball/2b49d664f117faf72fb7af402ad21c0c27c62b6b", + "reference": "2b49d664f117faf72fb7af402ad21c0c27c62b6b", + "shasum": "" + }, + "require": { + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0 | ^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "symfony/polyfill-php80": "^1.19", + "vimeo/psalm": "^3.11.7 | ^4.0" + }, + "suggest": { + "dhii/i18n-interface": "For internationalizing and translating human readable strings.", + "symfony/polyfill-php80": "To add Stringable interface" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Util\\String\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + } + ], + "description": "Interfaces for human readable string interoperation.", + "time": "2021-03-05T00:36:01+00:00" + }, { "name": "dhii/module-interface", "version": "v0.3.0-alpha2", @@ -194,12 +241,142 @@ } ], "description": "Interfaces for modules", - "support": { - "issues": "https://github.com/Dhii/module-interface/issues", - "source": "https://github.com/Dhii/module-interface/tree/v0.3.0-alpha2" - }, "time": "2021-08-23T08:23:01+00:00" }, + { + "name": "dhii/package-interface", + "version": "v0.1.0-alpha4", + "source": { + "type": "git", + "url": "https://github.com/Dhii/package-interface.git", + "reference": "bcc73f4285eead9b482dbb89662b723abf49298b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/package-interface/zipball/bcc73f4285eead9b482dbb89662b723abf49298b", + "reference": "bcc73f4285eead9b482dbb89662b723abf49298b", + "shasum": "" + }, + "require": { + "dhii/validation-interface": "^0.3-alpha1", + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "symfony/polyfill-php80": "^1.19", + "vimeo/psalm": "^4.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Dhii\\Package\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "Interfaces for package-related interop", + "time": "2021-12-08T15:57:36+00:00" + }, + { + "name": "dhii/validation-interface", + "version": "v0.3.0-alpha3", + "source": { + "type": "git", + "url": "https://github.com/Dhii/validation-interface.git", + "reference": "0e73c7bf3d2421ceb79331c60a9bc1b1d5eb65a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/validation-interface/zipball/0e73c7bf3d2421ceb79331c60a9bc1b1d5eb65a6", + "reference": "0e73c7bf3d2421ceb79331c60a9bc1b1d5eb65a6", + "shasum": "" + }, + "require": { + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "symfony/polyfill-mbstring": "1.20", + "symfony/polyfill-php80": "^1.19", + "vimeo/psalm": "^3.11.7 | ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Validation\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "A base interface for validators", + "time": "2021-01-14T16:19:20+00:00" + }, + { + "name": "dhii/versions", + "version": "v0.1.0-alpha3", + "source": { + "type": "git", + "url": "https://github.com/Dhii/versions.git", + "reference": "120b22b248d0b46e41bac93bf3394516c9d55730" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/versions/zipball/120b22b248d0b46e41bac93bf3394516c9d55730", + "reference": "120b22b248d0b46e41bac93bf3394516c9d55730", + "shasum": "" + }, + "require": { + "dhii/package-interface": "^0.1.0-alpha3", + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "symfony/polyfill-php80": "^1.19", + "vimeo/psalm": "^4.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Dhii\\Versions\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "Implementation for dealing with SemVer-compliant versions", + "time": "2021-12-08T16:54:50+00:00" + }, { "name": "psr/container", "version": "1.0.0", @@ -247,10 +424,6 @@ "container-interop", "psr" ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/master" - }, "time": "2017-02-14T16:28:37+00:00" }, { @@ -298,9 +471,6 @@ "psr", "psr-3" ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, "time": "2021-05-03T11:20:27+00:00" }, { @@ -341,10 +511,6 @@ } ], "description": "A polyfill for getallheaders.", - "support": { - "issues": "https://github.com/ralouphie/getallheaders/issues", - "source": "https://github.com/ralouphie/getallheaders/tree/develop" - }, "time": "2019-03-08T08:55:37+00:00" }, { @@ -395,6 +561,54 @@ ], "description": "Composer plugin to merge multiple composer.json files", "time": "2017-04-25T02:31:25+00:00" + }, + { + "name": "wp-oop/wordpress-interface", + "version": "v0.1.0-alpha2", + "source": { + "type": "git", + "url": "https://github.com/wp-oop/wordpress-interface.git", + "reference": "5e40acb49b76702f409bb5bcd2ea5459c9b946f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-oop/wordpress-interface/zipball/5e40acb49b76702f409bb5bcd2ea5459c9b946f5", + "reference": "5e40acb49b76702f409bb5bcd2ea5459c9b946f5", + "shasum": "" + }, + "require": { + "dhii/human-readable-interface": "^0.2.0-alpha1", + "dhii/package-interface": "^0.1-alpha3", + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "vimeo/psalm": "^4.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-task/initial-interfaces": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "WpOop\\WordPress\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "Interfaces for interop within WordPress", + "time": "2021-04-30T09:37:37+00:00" } ], "packages-dev": [ @@ -556,16 +770,16 @@ }, { "name": "antecedent/patchwork", - "version": "2.1.17", + "version": "2.1.21", "source": { "type": "git", "url": "https://github.com/antecedent/patchwork.git", - "reference": "df5aba175a44c2996ced4edf8ec9f9081b5348c0" + "reference": "25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/antecedent/patchwork/zipball/df5aba175a44c2996ced4edf8ec9f9081b5348c0", - "reference": "df5aba175a44c2996ced4edf8ec9f9081b5348c0", + "url": "https://api.github.com/repos/antecedent/patchwork/zipball/25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d", + "reference": "25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d", "shasum": "" }, "require": { @@ -596,31 +810,31 @@ "runkit", "testing" ], - "time": "2021-10-21T14:22:43+00:00" + "time": "2022-02-07T07:28:34+00:00" }, { "name": "brain/monkey", - "version": "2.6.0", + "version": "2.6.1", "source": { "type": "git", "url": "https://github.com/Brain-WP/BrainMonkey.git", - "reference": "7042140000b4b18034c0c0010d86274a00f25442" + "reference": "a31c84515bb0d49be9310f52ef1733980ea8ffbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/7042140000b4b18034c0c0010d86274a00f25442", - "reference": "7042140000b4b18034c0c0010d86274a00f25442", + "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/a31c84515bb0d49be9310f52ef1733980ea8ffbb", + "reference": "a31c84515bb0d49be9310f52ef1733980ea8ffbb", "shasum": "" }, "require": { - "antecedent/patchwork": "^2.0", - "mockery/mockery": ">=0.9 <2", + "antecedent/patchwork": "^2.1.17", + "mockery/mockery": "^1.3.5 || ^1.4.4", "php": ">=5.6.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || ^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", "phpcompatibility/php-compatibility": "^9.3.0", - "phpunit/phpunit": "^5.7.9 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^5.7.26 || ^6.0 || ^7.0 || >=8.0 <8.5.12 || ^8.5.14 || ^9.0" }, "type": "library", "extra": { @@ -630,12 +844,12 @@ } }, "autoload": { - "psr-4": { - "Brain\\Monkey\\": "src/" - }, "files": [ "inc/api.php" - ] + ], + "psr-4": { + "Brain\\Monkey\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -662,20 +876,20 @@ "test", "testing" ], - "time": "2020-10-13T17:56:14+00:00" + "time": "2021-11-11T15:53:55+00:00" }, { "name": "composer/package-versions-deprecated", - "version": "1.11.99.4", + "version": "1.11.99.5", "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b174585d1fe49ceed21928a945138948cb394600" + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", - "reference": "b174585d1fe49ceed21928a945138948cb394600", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", "shasum": "" }, "require": { @@ -731,27 +945,94 @@ "type": "tidelift" } ], - "time": "2021-09-13T08:41:34+00:00" + "time": "2022-01-17T14:14:24+00:00" }, { - "name": "composer/semver", - "version": "3.2.6", + "name": "composer/pcre", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "83e511e247de329283478496f7a1e114c9517506" + "url": "https://github.com/composer/pcre.git", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/83e511e247de329283478496f7a1e114c9517506", - "reference": "83e511e247de329283478496f7a1e114c9517506", + "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.54", + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-21T20:24:37+00:00" + }, + { + "name": "composer/semver", + "version": "3.2.9", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/a951f614bd64dcd26137bc9b7b2637ddcfc57649", + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", @@ -807,29 +1088,31 @@ "type": "tidelift" } ], - "time": "2021-10-25T11:34:17+00:00" + "time": "2022-02-04T13:58:43+00:00" }, { "name": "composer/xdebug-handler", - "version": "2.0.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339" + "reference": "0c1a3925ec58a4ec98e992b9c7d171e9e184be0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339", - "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/0c1a3925ec58a4ec98e992b9c7d171e9e184be0a", + "reference": "0c1a3925ec58a4ec98e992b9c7d171e9e184be0a", "shasum": "" }, "require": { + "composer/pcre": "^1", "php": "^5.3.2 || ^7.0 || ^8.0", "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" }, "type": "library", "autoload": { @@ -866,31 +1149,31 @@ "type": "tidelift" } ], - "time": "2021-07-31T17:03:58+00:00" + "time": "2022-01-04T17:06:45+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.1", + "version": "v0.7.2", "source": { "type": "git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c" + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", - "phpcompatibility/php-compatibility": "^9.0", - "sensiolabs/security-checker": "^4.1.0" + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0" }, "type": "composer-plugin", "extra": { @@ -911,6 +1194,10 @@ "email": "franck.nijhof@dealerdirect.com", "homepage": "http://www.frenck.nl", "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -922,6 +1209,7 @@ "codesniffer", "composer", "installer", + "phpcbf", "phpcs", "plugin", "qa", @@ -932,7 +1220,7 @@ "stylecheck", "tests" ], - "time": "2020-12-07T18:04:37+00:00" + "time": "2022-02-04T12:51:07+00:00" }, { "name": "dnoegel/php-xdg-base-dir", @@ -1016,20 +1304,6 @@ "constructor", "instantiate" ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], "time": "2020-11-10T18:47:58+00:00" }, { @@ -1283,12 +1557,6 @@ "object", "object graph" ], - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], "time": "2020-11-13T09:40:50+00:00" }, { @@ -1339,16 +1607,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.13.0", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -1387,7 +1655,7 @@ "parser", "php" ], - "time": "2021-09-20T12:20:58+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "openlss/lib-array2xml", @@ -1542,16 +1810,16 @@ }, { "name": "php-stubs/woocommerce-stubs", - "version": "v5.8.0", + "version": "v5.9.0", "source": { "type": "git", "url": "https://github.com/php-stubs/woocommerce-stubs.git", - "reference": "e3978c519fb1e51585e8c86b489b802aa0c64cee" + "reference": "a7204cfbb5fa90720773122cb68530087de5bc78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/woocommerce-stubs/zipball/e3978c519fb1e51585e8c86b489b802aa0c64cee", - "reference": "e3978c519fb1e51585e8c86b489b802aa0c64cee", + "url": "https://api.github.com/repos/php-stubs/woocommerce-stubs/zipball/a7204cfbb5fa90720773122cb68530087de5bc78", + "reference": "a7204cfbb5fa90720773122cb68530087de5bc78", "shasum": "" }, "require": { @@ -1578,28 +1846,31 @@ "woocommerce", "wordpress" ], - "time": "2021-10-15T14:13:09+00:00" + "time": "2021-11-05T10:02:27+00:00" }, { "name": "php-stubs/wordpress-stubs", - "version": "v5.8.1", + "version": "v5.9.0", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "8b333464d3183bccde2fdbb814e3cae592434943" + "reference": "0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/8b333464d3183bccde2fdbb814e3cae592434943", - "reference": "8b333464d3183bccde2fdbb814e3cae592434943", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b", + "reference": "0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b", "shasum": "" }, "replace": { "giacocorsiglia/wordpress-stubs": "*" }, "require-dev": { - "giacocorsiglia/stubs-generator": "^0.5.0", - "php": "~7.1" + "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" }, "suggest": { "paragonie/sodium_compat": "Pure PHP implementation of libsodium", @@ -1618,7 +1889,7 @@ "static analysis", "wordpress" ], - "time": "2021-09-09T22:10:19+00:00" + "time": "2022-01-26T00:27:45+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -1732,16 +2003,16 @@ }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.2", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "a792ab623069f0ce971b2417edef8d9632e32f75" + "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/a792ab623069f0ce971b2417edef8d9632e32f75", - "reference": "a792ab623069f0ce971b2417edef8d9632e32f75", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308", + "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308", "shasum": "" }, "require": { @@ -1778,7 +2049,7 @@ "standards", "wordpress" ], - "time": "2021-07-21T11:09:57+00:00" + "time": "2021-12-30T16:37:40+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2056,16 +2327,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "2.0.4", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05" + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/28af674ff175d0768a5a978e6de83f697d4a7f05", - "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", "shasum": "" }, "require": { @@ -2108,7 +2379,7 @@ "type": "github" } ], - "time": "2021-07-19T06:46:01+00:00" + "time": "2021-12-02T12:42:26+00:00" }, { "name": "phpunit/php-text-template", @@ -2198,12 +2469,6 @@ "keywords": [ "timer" ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T08:20:02+00:00" }, { @@ -2253,12 +2518,6 @@ "keywords": [ "tokenizer" ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "abandoned": true, "time": "2021-07-26T12:15:06+00:00" }, @@ -2389,12 +2648,6 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T08:15:22+00:00" }, { @@ -2459,12 +2712,6 @@ "compare", "equality" ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T08:04:30+00:00" }, { @@ -2521,12 +2768,6 @@ "unidiff", "unified diff" ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:59:04+00:00" }, { @@ -2580,26 +2821,20 @@ "environment", "hhvm" ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:53:42+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.3", + "version": "3.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e" + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", "shasum": "" }, "require": { @@ -2608,7 +2843,7 @@ }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -2659,7 +2894,7 @@ "type": "github" } ], - "time": "2020-11-30T07:47:53+00:00" + "time": "2021-11-11T13:51:24+00:00" }, { "name": "sebastian/global-state", @@ -2757,12 +2992,6 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:40:27+00:00" }, { @@ -2808,12 +3037,6 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:37:18+00:00" }, { @@ -2867,12 +3090,6 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:34:24+00:00" }, { @@ -2915,12 +3132,6 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:30:19+00:00" }, { @@ -2968,16 +3179,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.1", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e" + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e", - "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", "shasum": "" }, "require": { @@ -3015,20 +3226,20 @@ "phpcs", "standards" ], - "time": "2021-10-11T04:00:11+00:00" + "time": "2021-12-12T21:44:58+00:00" }, { "name": "symfony/console", - "version": "v4.4.30", + "version": "v4.4.37", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a3f7189a0665ee33b50e9e228c46f50f5acbed22" + "reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a3f7189a0665ee33b50e9e228c46f50f5acbed22", - "reference": "a3f7189a0665ee33b50e9e228c46f50f5acbed22", + "url": "https://api.github.com/repos/symfony/console/zipball/0259f01dbf9d77badddbbf4c2abb681f24c9cac6", + "reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6", "shasum": "" }, "require": { @@ -3102,25 +3313,28 @@ "type": "tidelift" } ], - "time": "2021-08-25T19:27:26+00:00" + "time": "2022-01-26T16:15:26+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -3178,25 +3392,28 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, @@ -3211,12 +3428,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3255,20 +3472,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", "shasum": "" }, "require": { @@ -3285,12 +3502,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3331,20 +3548,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-06-05T21:20:04+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", "shasum": "" }, "require": { @@ -3361,12 +3578,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3411,20 +3628,20 @@ "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2021-09-13T13:58:33+00:00" }, { "name": "symfony/service-contracts", - "version": "v1.1.9", + "version": "v1.1.11", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "b776d18b303a39f56c63747bcb977ad4b27aca26" + "reference": "633df678bec3452e04a7b0337c9bcfe7354124b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/b776d18b303a39f56c63747bcb977ad4b27aca26", - "reference": "b776d18b303a39f56c63747bcb977ad4b27aca26", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/633df678bec3452e04a7b0337c9bcfe7354124b3", + "reference": "633df678bec3452e04a7b0337c9bcfe7354124b3", "shasum": "" }, "require": { @@ -3437,7 +3654,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-main": "1.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -3487,7 +3704,7 @@ "type": "tidelift" } ], - "time": "2020-07-06T13:19:58+00:00" + "time": "2021-11-04T13:32:43+00:00" }, { "name": "theseer/tokenizer", @@ -3531,16 +3748,16 @@ }, { "name": "vimeo/psalm", - "version": "4.11.2", + "version": "4.20.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "6fba5eb554f9507b72932f9c75533d8af593688d" + "reference": "f82a70e7edfc6cf2705e9374c8a0b6a974a779ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/6fba5eb554f9507b72932f9c75533d8af593688d", - "reference": "6fba5eb554f9507b72932f9c75533d8af593688d", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/f82a70e7edfc6cf2705e9374c8a0b6a974a779ed", + "reference": "f82a70e7edfc6cf2705e9374c8a0b6a974a779ed", "shasum": "" }, "require": { @@ -3548,7 +3765,7 @@ "amphp/byte-stream": "^1.5", "composer/package-versions-deprecated": "^1.8.0", "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.1 || ^2.0", + "composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0", "dnoegel/php-xdg-base-dir": "^0.1.1", "ext-ctype": "*", "ext-dom": "*", @@ -3564,7 +3781,7 @@ "openlss/lib-array2xml": "^1.0", "php": "^7.1|^8", "sebastian/diff": "^3.0 || ^4.0", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0", "webmozart/path-util": "^2.3" }, "provide": { @@ -3582,11 +3799,12 @@ "psalm/plugin-phpunit": "^0.16", "slevomat/coding-standard": "^7.0", "squizlabs/php_codesniffer": "^3.5", - "symfony/process": "^4.3 || ^5.0", + "symfony/process": "^4.3 || ^5.0 || ^6.0", "weirdan/prophecy-shim": "^1.0 || ^2.0" }, "suggest": { - "ext-igbinary": "^2.0.5" + "ext-curl": "In order to send data to shepherd", + "ext-igbinary": "^2.0.5 is required, used to serialize caching data" }, "bin": [ "psalm", @@ -3605,13 +3823,13 @@ } }, "autoload": { - "psr-4": { - "Psalm\\": "src/Psalm/" - }, "files": [ "src/functions.php", "src/spl_object_id.php" - ] + ], + "psr-4": { + "Psalm\\": "src/Psalm/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3628,7 +3846,7 @@ "inspection", "php" ], - "time": "2021-10-26T17:28:17+00:00" + "time": "2022-02-03T17:03:47+00:00" }, { "name": "webmozart/assert", @@ -3723,20 +3941,21 @@ } ], "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "abandoned": "symfony/filesystem", "time": "2015-12-17T08:42:14+00:00" }, { "name": "woocommerce/woocommerce-sniffs", - "version": "0.1.1", + "version": "0.1.2", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-sniffs.git", - "reference": "eb604d751b61c42f31ff1aa24113c7c0de438553" + "reference": "5566270d280a300bc24bd0cb055a8b9325afdd6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/eb604d751b61c42f31ff1aa24113c7c0de438553", - "reference": "eb604d751b61c42f31ff1aa24113c7c0de438553", + "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/5566270d280a300bc24bd0cb055a8b9325afdd6b", + "reference": "5566270d280a300bc24bd0cb055a8b9325afdd6b", "shasum": "" }, "require": { @@ -3763,7 +3982,7 @@ "woocommerce", "wordpress" ], - "time": "2021-07-29T17:25:16+00:00" + "time": "2022-01-21T20:13:23+00:00" }, { "name": "wp-coding-standards/wpcs", diff --git a/src/FilePathPluginFactory.php b/src/FilePathPluginFactory.php new file mode 100644 index 000000000..c1527e0a2 --- /dev/null +++ b/src/FilePathPluginFactory.php @@ -0,0 +1,134 @@ +version_factory = $version_factory; + } + + /** + * Extracts plugin info from plugin file path. + * + * @param string $filePath The plugin file path. + */ + public function createPluginFromFilePath( string $filePath ): PluginInterface { + if ( ! is_readable( $filePath ) ) { + throw new RuntimeException( + sprintf( + 'Plugin file "%1$s" does not exist or is not readable', + $filePath + ) + ); + } + + $plugin_data = get_plugin_data( $filePath ); + if ( empty( $plugin_data ) ) { + throw new UnexpectedValueException( + sprintf( + 'Plugin file "%1$s" does not have a valid plugin header', + $filePath + ) + ); + } + + $plugin_data = array_merge( + array( + 'Name' => '', + 'Version' => '0.1.0-alpha1+default', + 'Title' => '', + 'Description' => '', + 'TextDomain' => '', + 'RequiresWP' => '5.0', + 'RequiresPHP' => '7.1', + ), + $plugin_data + ); + + $base_dir = dirname( $filePath ); + $base_name = plugin_basename( $filePath ); + $slug = $this->get_plugin_slug( $base_name ); + $text_domain = ! empty( $plugin_data['TextDomain'] ) ? $plugin_data['TextDomain'] : $slug; + + return new Plugin( + $plugin_data['Name'], + $this->create_version( $plugin_data['Version'] ), + $base_dir, + $base_name, + $plugin_data['Title'], + $plugin_data['Description'], + $text_domain, + $this->create_version( $plugin_data['RequiresPHP'] ), + $this->create_version( $plugin_data['RequiresWP'] ) + ); + } + + /** + * Creates a new version from a version string. + * + * @param string $version_string The SemVer-compliant version string. + * + * @return VersionInterface The new version. + * + * @throws Exception If version string is malformed. + */ + protected function create_version( string $version_string ): VersionInterface { + return $this->version_factory->createVersionFromString( $version_string ); + } + + /** + * Retrieves a plugin slug from its basename. + * + * @param string $base_name The plugin's basename. + * + * @return string The plugin's slug. + */ + protected function get_plugin_slug( string $base_name ): string { + $directory_separator = '/'; + + // If plugin is in a directory, use directory name. + if ( strstr( $base_name, $directory_separator ) !== false ) { + $parts = explode( $directory_separator, $base_name ); + if ( $parts ) { + return $parts[0]; + } + } + + // If plugin is not in a directory, return plugin file basename. + return basename( $base_name ); + } +} diff --git a/src/Plugin.php b/src/Plugin.php new file mode 100644 index 000000000..b889cffad --- /dev/null +++ b/src/Plugin.php @@ -0,0 +1,180 @@ +name = $name; + $this->description = $description; + $this->version = $version; + $this->base_dir = $base_dir; + $this->base_name = $base_name; + $this->title = $title; + $this->text_domain = $text_domain; + $this->min_php_version = $min_php_version; + $this->min_wp_version = $min_wp_version; + } + + /** + * The plugin name. + */ + public function getName(): string { + return $this->name; + } + + /** + * The plugin description. + */ + public function getDescription(): string { + return $this->description; + } + + /** + * The plugin version. + */ + public function getVersion(): VersionInterface { + return $this->version; + } + + /** + * The path to the plugin base directory. + */ + public function getBaseDir(): string { + return $this->base_dir; + } + + /** + * The plugin base name. + */ + public function getBaseName(): string { + return $this->base_name; + } + + /** + * The text domain of this plugin. + */ + public function getTextDomain(): string { + return $this->text_domain; + } + + /** + * The plugin title. + */ + public function getTitle(): string { + return $this->title; + } + + /** + * The minimal version of PHP required by this plugin. + */ + public function getMinPhpVersion(): VersionInterface { + return $this->min_php_version; + } + + /** + * The minimal version of WP required by this plugin. + */ + public function getMinWpVersion(): VersionInterface { + return $this->min_wp_version; + } +} diff --git a/src/PluginModule.php b/src/PluginModule.php index 7f405db42..8ed310f4a 100644 --- a/src/PluginModule.php +++ b/src/PluginModule.php @@ -23,7 +23,10 @@ class PluginModule implements ModuleInterface { * {@inheritDoc} */ public function setup(): ServiceProviderInterface { - return new ServiceProvider( array(), array() ); + return new ServiceProvider( + require __DIR__ . '/services.php', + require __DIR__ . '/extensions.php' + ); } /** diff --git a/src/extensions.php b/src/extensions.php new file mode 100644 index 000000000..63d0bdc0f --- /dev/null +++ b/src/extensions.php @@ -0,0 +1,12 @@ + function( ContainerInterface $container ) : PluginInterface { + $factory = new FilePathPluginFactory( new StringVersionFactory() ); + return $factory->createPluginFromFilePath( dirname( realpath( __FILE__ ), 2 ) . '/woocommerce-paypal-payments.php' ); + }, +);