From 22bb247638401b773eb804feb0bd743a74618669 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Wed, 27 Jan 2021 08:54:40 +0100 Subject: [PATCH] Bump 2.2.0 --- .github/workflows/deployment.yml | 23 + .github/workflows/tests.yml | 25 + .gitignore | 13 +- .travis.yml | 23 - assets/supporters.json | 3 +- composer.json | 21 +- composer.lock | 5133 +++++++---------- humbug.json.dist | 30 - includes/language.php | 2 +- infection.json.dist | 90 + package.json | 4 +- phpunit.xml.dist | 34 +- readme.txt | 5 +- scripts/build.sh | 2 +- scripts/deploy.sh | 19 +- scripts/humbug.sh | 13 - scripts/phpunit.sh | 9 - src/Access/AccessHandler.php | 86 +- src/Cache/Cache.php | 51 +- src/Cache/CacheProviderFactory.php | 15 +- src/Cache/CacheProviderInterface.php | 21 +- src/Cache/FileSystemCacheProvider.php | 67 +- src/Command/GroupCommand.php | 82 +- src/Command/ObjectCommand.php | 78 +- src/Config/BooleanConfigParameter.php | 26 +- src/Config/Config.php | 40 +- src/Config/ConfigFactory.php | 8 +- src/Config/ConfigParameter.php | 24 +- src/Config/ConfigParameterFactory.php | 33 +- src/Config/ConfigParameterInterface.php | 9 +- src/Config/MainConfig.php | 138 +- src/Config/SelectionConfigParameter.php | 22 +- src/Config/StringConfigParameter.php | 15 +- src/Config/WordpressConfig.php | 34 +- src/Controller/Backend/AboutController.php | 19 +- src/Controller/Backend/BackendController.php | 37 +- src/Controller/Backend/CacheController.php | 4 +- .../Backend/ControllerTabNavigationTrait.php | 48 +- .../Backend/DynamicGroupsController.php | 12 +- src/Controller/Backend/ObjectController.php | 147 +- src/Controller/Backend/ObjectInformation.php | 31 +- .../Backend/ObjectInformationFactory.php | 6 +- .../Backend/PostObjectController.php | 50 +- src/Controller/Backend/SettingsController.php | 153 +- src/Controller/Backend/SetupController.php | 34 +- .../Backend/TermObjectController.php | 33 +- .../Backend/UserGroupController.php | 85 +- .../Backend/UserObjectController.php | 29 +- src/Controller/BaseControllerTrait.php | 39 +- src/Controller/Controller.php | 53 +- src/Controller/ControllerFactory.php | 86 +- .../Frontend/AdminOutputControllerTrait.php | 38 +- src/Controller/Frontend/ContentController.php | 17 +- .../Frontend/FrontendController.php | 32 +- .../Frontend/LoginControllerTrait.php | 57 +- src/Controller/Frontend/PostController.php | 174 +- .../Frontend/RedirectController.php | 114 +- .../Frontend/ShortCodeController.php | 46 +- src/Controller/Frontend/TermController.php | 104 +- src/Database/Database.php | 163 +- src/File/ApacheFileProtection.php | 58 +- src/File/FileHandler.php | 108 +- src/File/FileObject.php | 20 +- src/File/FileObjectFactory.php | 13 +- src/File/FileProtection.php | 47 +- src/File/FileProtectionFactory.php | 18 +- src/File/FileProtectionInterface.php | 27 +- src/File/NginxFileProtection.php | 42 +- src/Form/Form.php | 5 +- src/Form/FormElement.php | 14 +- src/Form/FormFactory.php | 75 +- src/Form/FormHelper.php | 92 +- src/Form/Input.php | 3 + src/Form/LabelTrait.php | 5 +- src/Form/MultipleFormElement.php | 23 +- src/Form/MultipleFormElementValue.php | 14 +- src/Form/Radio.php | 3 + src/Form/Select.php | 3 + src/Form/Textarea.php | 3 + src/Form/ValueSetFormElement.php | 16 +- src/Form/ValueSetFormElementValue.php | 11 +- src/Form/ValueTrait.php | 3 + src/Object/ObjectHandler.php | 108 +- src/Object/ObjectMapHandler.php | 56 +- ...issingObjectMembershipHandlerException.php | 7 +- .../MissingObjectTypeException.php | 7 +- .../ObjectMembershipHandler.php | 104 +- .../ObjectMembershipHandlerFactory.php | 40 +- .../ObjectMembershipWithMapHandler.php | 37 +- .../PostMembershipHandler.php | 64 +- .../RoleMembershipHandler.php | 46 +- .../TermMembershipHandler.php | 58 +- .../UserMembershipHandler.php | 49 +- src/Setup/Database/Column.php | 31 +- src/Setup/Database/DatabaseHandler.php | 99 +- src/Setup/Database/DatabaseObjectFactory.php | 26 +- src/Setup/Database/DatabaseUpdate.php | 6 +- .../Database/MissingColumnsException.php | 6 +- src/Setup/Database/Table.php | 22 +- src/Setup/SetupHandler.php | 29 +- src/Setup/Update/DatabaseUpdate1.php | 45 +- src/Setup/Update/DatabaseUpdate2.php | 9 +- src/Setup/Update/DatabaseUpdate3.php | 8 +- src/Setup/Update/DatabaseUpdate4.php | 9 +- src/Setup/Update/DatabaseUpdate5.php | 13 +- src/Setup/Update/DatabaseUpdate6.php | 9 +- src/Setup/Update/UpdateFactory.php | 9 +- src/Setup/Update/UpdateInterface.php | 7 +- src/User/UserHandler.php | 49 +- src/UserAccessManager.php | 68 +- src/UserGroup/AbstractUserGroup.php | 225 +- src/UserGroup/AssignmentInformation.php | 18 +- .../AssignmentInformationFactory.php | 9 +- src/UserGroup/DynamicUserGroup.php | 52 +- src/UserGroup/UserGroup.php | 42 +- .../UserGroupAssignmentException.php | 7 +- src/UserGroup/UserGroupAssignmentHandler.php | 72 +- src/UserGroup/UserGroupFactory.php | 30 +- src/UserGroup/UserGroupHandler.php | 78 +- src/UserGroup/UserGroupTypeException.php | 7 +- src/Util/DateUtil.php | 39 +- src/Util/Util.php | 33 +- src/View/AdminAbout.php | 5 +- src/View/AdminForm/Input.php | 5 +- src/View/AdminForm/Radio.php | 20 +- src/View/AdminForm/Select.php | 7 +- src/View/AdminForm/Textarea.php | 9 +- src/View/AdminSettings.php | 21 +- src/View/AdminUserGroup.php | 7 +- src/View/BulkEditForm.php | 5 +- src/View/GroupInfo.php | 14 +- src/View/GroupSelectionForm.php | 213 +- src/View/InfoBox.php | 2 +- src/View/LoginWidget.php | 5 +- src/View/MediaAjaxEditForm.php | 14 +- src/View/ObjectColumn.php | 5 +- src/View/PostEditForm.php | 5 +- src/View/SteadyBanner.php | 2 +- src/View/TabList.php | 43 +- src/View/TermEditForm.php | 5 +- src/View/UserColumn.php | 5 +- .../UserGroups/DefaultUserGroupEditForm.php | 22 +- src/View/UserGroups/UserGroupEditForm.php | 7 +- src/View/UserGroups/UserGroupList.php | 10 +- src/View/UserProfileEditForm.php | 5 +- src/Widget/LoginWidget.php | 17 +- src/Widget/WidgetFactory.php | 11 +- src/Wrapper/Php.php | 121 +- src/Wrapper/Wordpress.php | 834 ++- src/Wrapper/WordpressCli.php | 43 +- tests/StringMatchIgnoreWhitespace.php | 41 + tests/Unit/Access/AccessHandlerTest.php | 90 +- tests/Unit/Cache/CacheProviderFactoryTest.php | 5 +- tests/Unit/Cache/CacheTest.php | 184 +- .../Cache/FileSystemCacheProviderTest.php | 25 +- tests/Unit/Command/GroupCommandTest.php | 98 +- tests/Unit/Command/ObjectCommandTest.php | 23 +- .../Config/BooleanConfigParameterTest.php | 34 +- tests/Unit/Config/ConfigFactoryTest.php | 5 +- .../Config/ConfigParameterFactoryTest.php | 13 +- tests/Unit/Config/ConfigParameterTest.php | 25 +- tests/Unit/Config/ConfigTest.php | 50 +- tests/Unit/Config/MainConfigTest.php | 290 +- .../Config/SelectionConfigParameterTest.php | 18 +- .../Unit/Config/StringConfigParameterTest.php | 15 +- tests/Unit/Config/WordpressConfigTest.php | 5 +- .../Backend/AboutControllerTest.php | 10 +- .../Backend/BackendControllerTest.php | 35 +- .../Backend/CacheControllerTest.php | 1 + .../ControllerTabNavigationTraitTest.php | 7 +- .../Backend/DynamicGroupsControllerTest.php | 16 +- .../Backend/ObjectControllerTest.php | 50 +- .../Backend/ObjectControllerTestCase.php | 54 +- .../Backend/ObjectInformationFactoryTest.php | 8 +- .../Backend/ObjectInformationTest.php | 4 +- .../Backend/PostObjectControllerTest.php | 41 +- .../Backend/SettingsControllerTest.php | 127 +- .../Backend/SetupControllerTest.php | 45 +- .../Backend/TermObjectControllerTest.php | 18 +- .../Backend/UserGroupControllerTest.php | 44 +- .../Backend/UserObjectControllerTest.php | 13 +- .../Controller/BaseControllerTraitTest.php | 22 +- .../Unit/Controller/ControllerFactoryTest.php | 20 +- tests/Unit/Controller/ControllerTest.php | 34 +- tests/Unit/Controller/DummyController.php | 1 + .../AdminOutputControllerTraitTest.php | 12 +- .../Frontend/ContentControllerTest.php | 26 +- .../Frontend/FrontendControllerTest.php | 9 +- .../Frontend/LoginControllerTraitTest.php | 13 +- .../Frontend/PostControllerTest.php | 132 +- .../Frontend/RedirectControllerTest.php | 124 +- .../Frontend/ShortCodeControllerTest.php | 15 +- .../Frontend/TermControllerTest.php | 76 +- tests/Unit/Database/DatabaseTest.php | 28 +- tests/Unit/File/ApacheFileProtectionTest.php | 92 +- tests/Unit/File/FileHandlerTest.php | 27 +- tests/Unit/File/FileObjectFactoryTest.php | 8 +- tests/Unit/File/FileObjectTest.php | 4 +- tests/Unit/File/FileProtectionFactoryTest.php | 6 +- tests/Unit/File/FileProtectionTest.php | 45 +- tests/Unit/File/NginxFileProtectionTest.php | 37 +- tests/Unit/Form/FormElementTest.php | 21 +- tests/Unit/Form/FormFactoryTest.php | 16 +- tests/Unit/Form/FormHelperTest.php | 112 +- tests/Unit/Form/FormTest.php | 26 +- tests/Unit/Form/InputTest.php | 4 +- tests/Unit/Form/LabelTraitTest.php | 6 +- tests/Unit/Form/MultipleFormElementTest.php | 23 +- .../Form/MultipleFormElementValueTest.php | 31 +- tests/Unit/Form/RadioTest.php | 6 +- tests/Unit/Form/SelectTest.php | 4 +- tests/Unit/Form/TextareaTest.php | 4 +- tests/Unit/Form/ValueSetFormElementTest.php | 20 +- .../Form/ValueSetFormElementValueTest.php | 10 +- tests/Unit/Form/ValueTraitTest.php | 6 +- tests/Unit/HandlerTestCase.php | 59 +- tests/Unit/Object/ObjectHandlerTest.php | 63 +- tests/Unit/Object/ObjectMapHandlerTest.php | 35 +- .../ObjectMembershipHandlerFactoryTest.php | 15 +- .../ObjectMembershipHandlerTest.php | 32 +- .../ObjectMembershipHandlerTestCase.php | 20 +- .../ObjectMembershipWithMapHandlerTest.php | 15 +- .../PostObjectMembershipHandlerTest.php | 37 +- .../RoleMembershipHandlerTest.php | 15 +- .../TermObjectMembershipHandlerTest.php | 33 +- .../UserObjectMembershipHandlerTest.php | 48 +- tests/Unit/Setup/Database/ColumnTest.php | 4 +- .../Setup/Database/DatabaseHandlerTest.php | 54 +- .../Database/DatabaseObjectFactoryTest.php | 11 +- .../Setup/Database/DatabaseUpdateTest.php | 5 +- tests/Unit/Setup/Database/TableTest.php | 7 +- tests/Unit/Setup/SetupHandlerTest.php | 4 + .../Unit/Setup/Update/DatabaseUpdate1Test.php | 6 +- .../Unit/Setup/Update/DatabaseUpdate2Test.php | 3 +- .../Unit/Setup/Update/DatabaseUpdate3Test.php | 1 + .../Unit/Setup/Update/DatabaseUpdate4Test.php | 3 +- .../Unit/Setup/Update/DatabaseUpdate5Test.php | 8 +- .../Unit/Setup/Update/DatabaseUpdate6Test.php | 3 +- tests/Unit/Setup/Update/UpdateFactoryTest.php | 5 +- tests/Unit/User/UserHandlerTest.php | 13 +- tests/Unit/UserAccessManagerTest.php | 11 +- tests/Unit/UserAccessManagerTestCase.php | 257 +- .../Unit/UserGroup/AbstractUserGroupTest.php | 170 +- .../AssignmentInformationFactoryTest.php | 8 +- .../UserGroup/AssignmentInformationTest.php | 24 +- tests/Unit/UserGroup/DynamicUserGroupTest.php | 34 +- .../UserGroupAssignmentHandlerTest.php | 37 +- tests/Unit/UserGroup/UserGroupFactoryTest.php | 13 +- tests/Unit/UserGroup/UserGroupHandlerTest.php | 130 +- tests/Unit/UserGroup/UserGroupTest.php | 55 +- tests/Unit/Util/DateUtilTest.php | 1 + tests/Unit/Util/UtilTest.php | 31 +- tests/Unit/Widget/LoginWidgetTest.php | 31 +- tests/Unit/Widget/WidgetFactoryTest.php | 5 +- tests/bootstrap.php | 32 +- tests/defines.php | 4 +- user-access-manager.php | 4 +- 257 files changed, 7446 insertions(+), 7821 deletions(-) create mode 100644 .github/workflows/deployment.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml delete mode 100644 humbug.json.dist create mode 100644 infection.json.dist delete mode 100755 scripts/humbug.sh delete mode 100755 scripts/phpunit.sh create mode 100644 tests/StringMatchIgnoreWhitespace.php diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 00000000..1b125e26 --- /dev/null +++ b/.github/workflows/deployment.yml @@ -0,0 +1,23 @@ +name: Deployment +on: + release: + types: [published] +jobs: + tests: + name: Deploy to wordpress + runs-on: ubuntu-latest + environment: + name: Deployment + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install gettext + run: | + sudo apt-get update + sudo apt-get install gettext + - name: Build + run: ./scripts/build.sh + - name: Deploy plugin + env: + WP_ORG_PASSWORD: ${{ secrets.WP_ORG_PASSWORD }} + run: ./scripts/deploy.sh "${WP_ORG_PASSWORD}" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..52a61343 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,25 @@ +name: Tests +on: [push] +jobs: + tests: + name: Run tests + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup php + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + - name: Install composer dependencies + run: composer install + - name: "Run php code sniffer" + run: ./vendor/bin/phpcs -p --standard=PSR2 ./src + - name: "Run PHPUnit unit test" + run: | + ./vendor/bin/phpunit --coverage-clover=coverage.clover + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --format=php-clover coverage.clover + rm ocular.phar + - name: "Run infection mutation tests" + run: ./vendor/bin/infection --threads=8 \ No newline at end of file diff --git a/.gitignore b/.gitignore index dd4d7717..1a40b1e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,15 @@ builds vendor tmp -humbuglog.txt -humbuglog.json +.htaccess .htpasswd node_modules -coverage.clover \ No newline at end of file +coverage.clover +.phpunit.result.cache +infection.txt +serializeCacheKey.cache +supporters.json +uam.conf +infection.json +.htaccess +.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e4cbaeeb..00000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -sudo: required -dist: trusty -language: php -php: - - 7.0 -before_install: - - sudo rm -rf ~/.nvm - curl -sL "https://deb.nodesource.com/setup_7.x" | sudo -E bash - - - sudo apt-get install -y nodejs -install: - - composer install - - npm install -script: - - ./vendor/bin/phpcs -p --standard=PSR2 ./src ./tests --ignore=./tests/bootstrap.php - - ./scripts/phpunit.sh - - ./scripts/humbug.sh - - ./scripts/build.sh -deploy: - provider: script - skip_cleanup: true - script: ./scripts/deploy.sh - on: - tags: true - php: 7.0 \ No newline at end of file diff --git a/assets/supporters.json b/assets/supporters.json index 01fda0e0..67e6ba80 100644 --- a/assets/supporters.json +++ b/assets/supporters.json @@ -28,8 +28,7 @@ "michel.weimerskirch", "arjenbreur", "jpr105", - "nwoetzel (https://github.com/nwoetzel)", - "simonnygh (https://github.com/simonnygh)" + "nwoetzel (https://github.com/nwoetzel)" ], "top-supporters": [], "supporters": [] diff --git a/composer.json b/composer.json index 192e91e7..e8bfb5f9 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { - "name": "UserAccessManager", + "name": "gmalex/user-access-manager", "description": "User Access Manager plugin for Wordpress", "type": "wordpress-plugin", "license": "GPL-2.0", - "version": "2.1.13", + "version": "2.2.0", "authors": [ { "name": "Alexander Schneider", @@ -11,17 +11,16 @@ } ], "require": { - "php": ">=5.4" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~5.7", - "etsy/phpunit-extensions": "~0.7", - "wp-cli/wp-cli": "~1.0", - "adlawson/vfs": "~0.12", - "humbug/humbug": "~1.0@dev", - "squizlabs/php_codesniffer": "~2.8", - "johnpbloch/wordpress-core": "^4.8", - "php-vcr/php-vcr": "^1.3" + "phpunit/phpunit": "^9.5", + "wp-cli/wp-cli": "^v2.4.1", + "adlawson/vfs": "^0.12", + "infection/infection": "^0.21", + "squizlabs/php_codesniffer": "^3.5", + "johnpbloch/wordpress-core": "^5.6", + "php-vcr/php-vcr": "^1.5" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 6e2df30d..bb57e2b2 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": "5fed1642e2f2a1b3dee8ac105972659f", + "content-hash": "18e2d22b515be2ebbe84a4ecc7ae29f5", "packages": [], "packages-dev": [ { @@ -61,36 +61,39 @@ "wrapper", "write" ], + "support": { + "issues": "https://github.com/adlawson/php-vfs/issues", + "source": "https://github.com/adlawson/php-vfs/tree/develop" + }, "time": "2016-02-20T12:46:01+00:00" }, { "name": "beberlei/assert", - "version": "v3.2.7", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/beberlei/assert.git", - "reference": "d63a6943fc4fd1a2aedb65994e3548715105abcf" + "reference": "5367e3895976b49704ae671f75bc5f0ba1b986ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/beberlei/assert/zipball/d63a6943fc4fd1a2aedb65994e3548715105abcf", - "reference": "d63a6943fc4fd1a2aedb65994e3548715105abcf", + "url": "https://api.github.com/repos/beberlei/assert/zipball/5367e3895976b49704ae671f75bc5f0ba1b986ab", + "reference": "5367e3895976b49704ae671f75bc5f0ba1b986ab", "shasum": "" }, "require": { "ext-ctype": "*", + "ext-intl": "*", "ext-json": "*", "ext-mbstring": "*", "ext-simplexml": "*", - "php": "^7" + "php": "^7.0 || ^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "*", - "phpstan/phpstan-shim": "*", - "phpunit/phpunit": ">=6.0.0 <8" - }, - "suggest": { - "ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles" + "phpstan/phpstan": "*", + "phpunit/phpunit": ">=6.0.0", + "yoast/phpunit-polyfills": "^0.1.0" }, "type": "library", "autoload": { @@ -123,42 +126,37 @@ "assertion", "validation" ], - "time": "2019-12-19T17:51:41+00:00" + "support": { + "issues": "https://github.com/beberlei/assert/issues", + "source": "https://github.com/beberlei/assert/tree/v3.3.0" + }, + "time": "2020-11-13T20:02:54+00:00" }, { - "name": "composer/ca-bundle", - "version": "1.2.9", + "name": "composer/xdebug-handler", + "version": "1.4.5", "source": { "type": "git", - "url": "https://github.com/composer/ca-bundle.git", - "reference": "78a0e288fdcebf92aa2318a8d3656168da6ac1a5" + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "f28d44c286812c714741478d968104c5e604a1d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/78a0e288fdcebf92aa2318a8d3656168da6ac1a5", - "reference": "78a0e288fdcebf92aa2318a8d3656168da6ac1a5", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f28d44c286812c714741478d968104c5e604a1d4", + "reference": "f28d44c286812c714741478d968104c5e604a1d4", "shasum": "" }, "require": { - "ext-openssl": "*", - "ext-pcre": "*", - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.55", - "psr/log": "^1.0", - "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - } - }, "autoload": { "psr-4": { - "Composer\\CaBundle\\": "src" + "Composer\\XdebugHandler\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -167,19 +165,20 @@ ], "authors": [ { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" } ], - "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "description": "Restarts a process without Xdebug.", "keywords": [ - "cabundle", - "cacert", - "certificate", - "ssl", - "tls" + "Xdebug", + "performance" ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/1.4.5" + }, "funding": [ { "url": "https://packagist.com", @@ -194,61 +193,38 @@ "type": "tidelift" } ], - "time": "2021-01-12T12:10:35+00:00" + "time": "2020-11-13T08:04:11+00:00" }, { - "name": "composer/composer", - "version": "1.10.19", + "name": "doctrine/instantiator", + "version": "1.4.0", "source": { "type": "git", - "url": "https://github.com/composer/composer.git", - "reference": "196601d50c08c3fae389a417a7689367fcf37cef" + "url": "https://github.com/doctrine/instantiator.git", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/196601d50c08c3fae389a417a7689367fcf37cef", - "reference": "196601d50c08c3fae389a417a7689367fcf37cef", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { - "composer/ca-bundle": "^1.0", - "composer/semver": "^1.0", - "composer/spdx-licenses": "^1.2", - "composer/xdebug-handler": "^1.1", - "justinrainbow/json-schema": "^5.2.10", - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0", - "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", - "symfony/console": "^2.7 || ^3.0 || ^4.0 || ^5.0", - "symfony/filesystem": "^2.7 || ^3.0 || ^4.0 || ^5.0", - "symfony/finder": "^2.7 || ^3.0 || ^4.0 || ^5.0", - "symfony/process": "^2.7 || ^3.0 || ^4.0 || ^5.0" - }, - "conflict": { - "symfony/console": "2.8.38" + "php": "^7.1 || ^8.0" }, "require-dev": { - "phpspec/prophecy": "^1.10", - "symfony/phpunit-bridge": "^4.2" - }, - "suggest": { - "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", - "ext-zip": "Enabling the zip extension allows you to unzip archives", - "ext-zlib": "Allow gzip compression of HTTP requests" + "doctrine/coding-standard": "^8.0", + "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" }, - "bin": [ - "bin/composer" - ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, "autoload": { "psr-4": { - "Composer\\": "src/Composer" + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "notification-url": "https://packagist.org/downloads/", @@ -257,495 +233,340 @@ ], "authors": [ { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" } ], - "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.", - "homepage": "https://getcomposer.org/", + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ - "autoload", - "dependency", - "package" + "constructor", + "instantiate" ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + }, "funding": [ { - "url": "https://packagist.com", + "url": "https://www.doctrine-project.org/sponsorship.html", "type": "custom" }, { - "url": "https://github.com/composer", - "type": "github" + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" }, { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", "type": "tidelift" } ], - "time": "2020-12-04T08:14:16+00:00" + "time": "2020-11-10T18:47:58+00:00" }, { - "name": "composer/semver", - "version": "1.7.2", + "name": "infection/abstract-testframework-adapter", + "version": "0.3.1", "source": { "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "647490bbcaf7fc4891c58f47b825eb99d19c377a" + "url": "https://github.com/infection/abstract-testframework-adapter.git", + "reference": "c52539339f28d6b67625ff24496289b3e6d66025" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/647490bbcaf7fc4891c58f47b825eb99d19c377a", - "reference": "647490bbcaf7fc4891c58f47b825eb99d19c377a", + "url": "https://api.github.com/repos/infection/abstract-testframework-adapter/zipball/c52539339f28d6b67625ff24496289b3e6d66025", + "reference": "c52539339f28d6b67625ff24496289b3e6d66025", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5" + "ergebnis/composer-normalize": "^2.8", + "friendsofphp/php-cs-fixer": "^2.16", + "phpunit/phpunit": "^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, "autoload": { "psr-4": { - "Composer\\Semver\\": "src" + "Infection\\AbstractTestFramework\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "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" + "name": "Maks Rafalko", + "email": "maks.rafalko@gmail.com" } ], - "time": "2020-12-03T15:47:16+00:00" + "description": "Abstract Test Framework Adapter for Infection", + "support": { + "issues": "https://github.com/infection/abstract-testframework-adapter/issues", + "source": "https://github.com/infection/abstract-testframework-adapter/tree/0.3" + }, + "time": "2020-08-30T13:50:12+00:00" }, { - "name": "composer/spdx-licenses", - "version": "1.5.5", + "name": "infection/extension-installer", + "version": "0.1.1", "source": { "type": "git", - "url": "https://github.com/composer/spdx-licenses.git", - "reference": "de30328a7af8680efdc03e396aad24befd513200" + "url": "https://github.com/infection/extension-installer.git", + "reference": "ff30c0adffcdbc747c96adf92382ccbe271d0afd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/de30328a7af8680efdc03e396aad24befd513200", - "reference": "de30328a7af8680efdc03e396aad24befd513200", + "url": "https://api.github.com/repos/infection/extension-installer/zipball/ff30c0adffcdbc747c96adf92382ccbe271d0afd", + "reference": "ff30c0adffcdbc747c96adf92382ccbe271d0afd", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "composer-plugin-api": "^1.1 || ^2.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 7" + "composer/composer": "^1.9", + "friendsofphp/php-cs-fixer": "^2.16", + "infection/infection": "^0.15.2", + "php-coveralls/php-coveralls": "^2.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.10", + "phpstan/phpstan-phpunit": "^0.12.6", + "phpstan/phpstan-strict-rules": "^0.12.2", + "phpstan/phpstan-webmozart-assert": "^0.12.2", + "phpunit/phpunit": "^8.5", + "vimeo/psalm": "^3.8" }, - "type": "library", + "type": "composer-plugin", "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - } + "class": "Infection\\ExtensionInstaller\\Plugin" }, "autoload": { "psr-4": { - "Composer\\Spdx\\": "src" + "Infection\\ExtensionInstaller\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "SPDX licenses list and validation library.", - "keywords": [ - "license", - "spdx", - "validator" - ], - "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" + "name": "Maks Rafalko", + "email": "maks.rafalko@gmail.com" } ], - "time": "2020-12-03T16:04:16+00:00" + "description": "Infection Extension Installer", + "support": { + "issues": "https://github.com/infection/extension-installer/issues", + "source": "https://github.com/infection/extension-installer/tree/0.1.1" + }, + "time": "2020-04-25T22:40:05+00:00" }, { - "name": "composer/xdebug-handler", - "version": "1.4.5", + "name": "infection/include-interceptor", + "version": "0.2.4", "source": { "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "f28d44c286812c714741478d968104c5e604a1d4" + "url": "https://github.com/infection/include-interceptor.git", + "reference": "e3cf9317a7fd554ab60a5587f028b16418cc4264" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f28d44c286812c714741478d968104c5e604a1d4", - "reference": "f28d44c286812c714741478d968104c5e604a1d4", + "url": "https://api.github.com/repos/infection/include-interceptor/zipball/e3cf9317a7fd554ab60a5587f028b16418cc4264", + "reference": "e3cf9317a7fd554ab60a5587f028b16418cc4264", "shasum": "" }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" - }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + "friendsofphp/php-cs-fixer": "^2.16", + "infection/infection": "^0.15.0", + "phan/phan": "^2.4 || ^3", + "php-coveralls/php-coveralls": "^2.2", + "phpstan/phpstan": "^0.12.8", + "phpunit/phpunit": "^8.5", + "vimeo/psalm": "^3.8" }, "type": "library", "autoload": { "psr-4": { - "Composer\\XdebugHandler\\": "src" + "Infection\\StreamWrapper\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without Xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "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" + "name": "Maks Rafalko", + "email": "maks.rafalko@gmail.com" } ], - "time": "2020-11-13T08:04:11+00:00" + "description": "Stream Wrapper: Include Interceptor. Allows to replace included (autoloaded) file with another one.", + "support": { + "issues": "https://github.com/infection/include-interceptor/issues", + "source": "https://github.com/infection/include-interceptor/tree/0.2.4" + }, + "time": "2020-08-07T22:40:37+00:00" }, { - "name": "doctrine/instantiator", - "version": "1.4.0", + "name": "infection/infection", + "version": "0.21.0", "source": { "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "url": "https://github.com/infection/infection.git", + "reference": "dfacb1e3d9def7fd34c6fb8df4d4bd098815dc82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/infection/infection/zipball/dfacb1e3d9def7fd34c6fb8df4d4bd098815dc82", + "reference": "dfacb1e3d9def7fd34c6fb8df4d4bd098815dc82", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "composer/xdebug-handler": "^1.3.3", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "infection/abstract-testframework-adapter": "^0.3.1", + "infection/extension-installer": "^0.1.0", + "infection/include-interceptor": "^0.2.4", + "justinrainbow/json-schema": "^5.2", + "nikic/php-parser": "^4.10.3", + "ocramius/package-versions": "^1.2 || ^2.0", + "ondram/ci-detector": "^3.3.0", + "php": "^7.4 || ^8.0", + "sanmai/later": "^0.1.1", + "sanmai/pipeline": "^5.1", + "sebastian/diff": "^3.0.2 || ^4.0", + "seld/jsonlint": "^1.7", + "symfony/console": "^3.4.29 || ^4.1.19 || ^5.0", + "symfony/filesystem": "^3.4.29 || ^4.1.19 || ^5.0", + "symfony/finder": "^3.4.29 || ^4.1.19 || ^5.0", + "symfony/process": "^3.4.29 || ^4.1.19 || ^5.0", + "thecodingmachine/safe": "^1.0", + "webmozart/assert": "^1.3", + "webmozart/path-util": "^2.3" + }, + "conflict": { + "phpunit/php-code-coverage": ">9 <9.1.4", + "symfony/console": "=4.1.5" }, "require-dev": { - "doctrine/coding-standard": "^8.0", - "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" + "ext-simplexml": "*", + "helmich/phpunit-json-assert": "^3.0", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.8", + "phpstan/phpstan-phpunit": "^0.12.6", + "phpstan/phpstan-strict-rules": "^0.12.5", + "phpstan/phpstan-webmozart-assert": "^0.12.2", + "phpunit/phpunit": "^9.3.11", + "symfony/phpunit-bridge": "^4.4.18 || ^5.1.10", + "symfony/yaml": "^5.0", + "thecodingmachine/phpstan-safe-rule": "^1.0" }, + "bin": [ + "bin/infection" + ], "type": "library", "autoload": { "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + "Infection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" + "name": "Maks Rafalko", + "email": "maks.rafalko@gmail.com", + "homepage": "https://twitter.com/maks_rafalko" + }, + { + "name": "Oleg Zhulnev", + "homepage": "https://github.com/sidz" + }, + { + "name": "Gert de Pagter", + "homepage": "https://github.com/BackEndTea" + }, + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com", + "homepage": "https://twitter.com/tfidry" + }, + { + "name": "Alexey Kopytko", + "email": "alexey@kopytko.com", + "homepage": "https://www.alexeykopytko.com" + }, + { + "name": "Andreas Möller", + "email": "am@localheinz.com", + "homepage": "https://localheinz.com" } ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "description": "Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.", "keywords": [ - "constructor", - "instantiate" + "coverage", + "mutant", + "mutation framework", + "mutation testing", + "testing", + "unit testing" ], + "support": { + "issues": "https://github.com/infection/infection/issues", + "source": "https://github.com/infection/infection/tree/0.21.0" + }, "funding": [ { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" + "url": "https://github.com/infection", + "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" + "url": "https://opencollective.com/infection", + "type": "open_collective" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2021-01-26T22:10:01+00:00" }, { - "name": "etsy/phpunit-extensions", - "version": "v0.7.4", + "name": "johnpbloch/wordpress-core", + "version": "5.6.1", "source": { "type": "git", - "url": "https://github.com/etsy/phpunit-extensions.git", - "reference": "08fbbd24490d192692b5d10f904af7a5a9f4207e" + "url": "https://github.com/johnpbloch/wordpress-core.git", + "reference": "82592ec73d42cf784da38adb0028a24dbacab1b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/etsy/phpunit-extensions/zipball/08fbbd24490d192692b5d10f904af7a5a9f4207e", - "reference": "08fbbd24490d192692b5d10f904af7a5a9f4207e", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/82592ec73d42cf784da38adb0028a24dbacab1b4", + "reference": "82592ec73d42cf784da38adb0028a24dbacab1b4", "shasum": "" }, "require": { - "mockery/mockery": "^1.0.0", - "php": "^7.1", - "phpunit/dbunit": "^2.0.2", - "phpunit/phpunit": "^5.7.5" + "ext-json": "*", + "php": ">=5.6.20" }, - "type": "library", - "autoload": { - "classmap": [ - "PHPUnit/" - ] + "provide": { + "wordpress/core-implementation": "5.6.1" }, + "type": "wordpress-core", "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "GPL-2.0-or-later" ], - "description": "Etsy PHPUnit Extensions", - "homepage": "http://github.com/etsy/phpunit-extensions", - "keywords": [ - "etsy", - "extensions", - "phpunit" - ], - "time": "2017-11-10T12:42:53+00:00" - }, - { - "name": "hamcrest/hamcrest-php", - "version": "v2.0.1", - "source": { - "type": "git", - "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "shasum": "" - }, - "require": { - "php": "^5.3|^7.0|^8.0" - }, - "replace": { - "cordoval/hamcrest-php": "*", - "davedevelopment/hamcrest-php": "*", - "kodova/hamcrest-php": "*" - }, - "require-dev": { - "phpunit/php-file-iterator": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "hamcrest" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "This is the PHP port of Hamcrest Matchers", - "keywords": [ - "test" - ], - "time": "2020-07-09T08:09:16+00:00" - }, - { - "name": "humbug/humbug", - "version": "1.0.0-alpha2", - "source": { - "type": "git", - "url": "https://github.com/humbug/humbug.git", - "reference": "06b1c059e432dab8c22c36bc8b6e1ffc7e587c07" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/humbug/humbug/zipball/06b1c059e432dab8c22c36bc8b6e1ffc7e587c07", - "reference": "06b1c059e432dab8c22c36bc8b6e1ffc7e587c07", - "shasum": "" - }, - "require": { - "padraic/phar-updater": "^1.0.0", - "padraic/phpunit-accelerator": "^1.0.2", - "padraic/phpunit-extensions": "^1.0.0", - "php": ">=5.4.0", - "phpunit/phpunit": "^4.5|^5.0", - "sebastian/diff": "^1.1", - "symfony/console": "^2.6|^3.0", - "symfony/event-dispatcher": "^2.6|^3.0", - "symfony/finder": "^2.6|^3.0", - "symfony/process": "^2.6|^3.0" - }, - "require-dev": { - "behat/behat": "^3.0.15", - "mikey179/vfsstream": "^1.4", - "mockery/mockery": "^0.9", - "symfony/filesystem": "^2.6|^3.0" - }, - "bin": [ - "bin/humbug" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "Humbug\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" - } - ], - "description": "Humbug is a Mutation Testing framework for PHP. Whereas Code Coverage can tell you what code your tests are executing, Mutation Testing is intended to help you judge how well your unit tests actually perform and where they could be improved.", - "homepage": "https://github.com/padraic/humbug", - "keywords": [ - "coverage", - "mutation testing", - "testing", - "unit testing" - ], - "abandoned": "infection/infection", - "time": "2016-08-01T10:27:00+00:00" - }, - { - "name": "johnpbloch/wordpress-core", - "version": "4.9.16", - "source": { - "type": "git", - "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "c08d92e830aab79bc18a68546684831e8b1b5758" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/c08d92e830aab79bc18a68546684831e8b1b5758", - "reference": "c08d92e830aab79bc18a68546684831e8b1b5758", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "provide": { - "wordpress/core-implementation": "4.9.16" - }, - "type": "wordpress-core", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "WordPress Community", - "homepage": "https://wordpress.org/about/" - } + "authors": [ + { + "name": "WordPress Community", + "homepage": "https://wordpress.org/about/" + } ], "description": "WordPress is open source software you can use to create a beautiful website, blog, or app.", "homepage": "https://wordpress.org/", @@ -754,7 +575,7 @@ "cms", "wordpress" ], - "time": "2020-10-29T20:06:24+00:00" + "time": "2021-02-03T21:27:35+00:00" }, { "name": "justinrainbow/json-schema", @@ -820,72 +641,11 @@ "json", "schema" ], - "time": "2020-05-27T16:41:55+00:00" - }, - { - "name": "mockery/mockery", - "version": "1.3.3", - "source": { - "type": "git", - "url": "https://github.com/mockery/mockery.git", - "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/60fa2f67f6e4d3634bb4a45ff3171fa52215800d", - "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d", - "shasum": "" - }, - "require": { - "hamcrest/hamcrest-php": "^2.0.1", - "lib-pcre": ">=7.0", - "php": ">=5.6.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-0": { - "Mockery": "library/" - } + "support": { + "issues": "https://github.com/justinrainbow/json-schema/issues", + "source": "https://github.com/justinrainbow/json-schema/tree/5.2.10" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" - }, - { - "name": "Dave Marshall", - "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" - } - ], - "description": "Mockery is a simple yet flexible PHP mock object framework", - "homepage": "https://github.com/mockery/mockery", - "keywords": [ - "BDD", - "TDD", - "library", - "mock", - "mock objects", - "mockery", - "stub", - "test", - "test double", - "testing" - ], - "time": "2020-08-11T18:10:21+00:00" + "time": "2020-05-27T16:41:55+00:00" }, { "name": "mustache/mustache", @@ -931,6 +691,10 @@ "mustache", "templating" ], + "support": { + "issues": "https://github.com/bobthecow/mustache.php/issues", + "source": "https://github.com/bobthecow/mustache.php/tree/master" + }, "time": "2019-11-23T21:40:31+00:00" }, { @@ -979,6 +743,10 @@ "object", "object graph" ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + }, "funding": [ { "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", @@ -988,250 +756,280 @@ "time": "2020-11-13T09:40:50+00:00" }, { - "name": "nb/oxymel", - "version": "v0.1.0", + "name": "nikic/php-parser", + "version": "v4.10.4", "source": { "type": "git", - "url": "https://github.com/nb/oxymel.git", - "reference": "cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nb/oxymel/zipball/cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c", - "reference": "cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", "shasum": "" }, "require": { - "php": ">=5.2.4" + "ext-tokenizer": "*", + "php": ">=7.0" }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, "autoload": { - "psr-0": { - "Oxymel": "" + "psr-4": { + "PhpParser\\": "lib/PhpParser" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Nikolay Bachiyski", - "email": "nb@nikolay.bg", - "homepage": "http://extrapolate.me/" + "name": "Nikita Popov" } ], - "description": "A sweet XML builder", - "homepage": "https://github.com/nb/oxymel", + "description": "A PHP parser written in PHP", "keywords": [ - "xml" + "parser", + "php" ], - "time": "2013-02-24T15:01:54+00:00" + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + }, + "time": "2020-12-20T10:01:03+00:00" }, { - "name": "padraic/humbug_get_contents", - "version": "1.1.2", + "name": "ocramius/package-versions", + "version": "1.9.0", "source": { "type": "git", - "url": "https://github.com/humbug/file_get_contents.git", - "reference": "dcb086060c9dd6b2f51d8f7a895500307110b7a7" + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "94c9d42a466c57f91390cdd49c81313264f49d85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/humbug/file_get_contents/zipball/dcb086060c9dd6b2f51d8f7a895500307110b7a7", - "reference": "dcb086060c9dd6b2f51d8f7a895500307110b7a7", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/94c9d42a466c57f91390cdd49c81313264f49d85", + "reference": "94c9d42a466c57f91390cdd49c81313264f49d85", "shasum": "" }, "require": { - "composer/ca-bundle": "^1.0", - "ext-openssl": "*", - "php": "^5.3 || ^7.0 || ^7.1 || ^7.2" + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7.4.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.1", - "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5" + "composer/composer": "^1.9.3 || ^2.0@dev", + "doctrine/coding-standard": "^7.0.2", + "ext-zip": "^1.15.0", + "infection/infection": "^0.15.3", + "phpunit/phpunit": "^9.1.1", + "vimeo/psalm": "^3.9.3" }, - "type": "library", + "type": "composer-plugin", "extra": { - "bamarni-bin": { - "bin-links": false - }, + "class": "PackageVersions\\Installer", "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "1.99.x-dev" } }, "autoload": { "psr-4": { - "Humbug\\": "src/" - }, - "files": [ - "src/function.php", - "src/functions.php" - ] + "PackageVersions\\": "src/PackageVersions" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/Ocramius/PackageVersions/issues", + "source": "https://github.com/Ocramius/PackageVersions/tree/1.9.0" + }, + "funding": [ + { + "url": "https://github.com/Ocramius", + "type": "github" }, { - "name": "Théo Fidry", - "email": "theo.fidry@gmail.com" + "url": "https://tidelift.com/funding/github/packagist/ocramius/package-versions", + "type": "tidelift" } ], - "description": "Secure wrapper for accessing HTTPS resources with file_get_contents for PHP 5.3+", - "homepage": "https://github.com/padraic/file_get_contents", - "keywords": [ - "download", - "file_get_contents", - "http", - "https", - "ssl", - "tls" - ], - "time": "2018-02-12T18:47:17+00:00" + "time": "2020-06-22T14:15:44+00:00" }, { - "name": "padraic/phar-updater", - "version": "v1.0.6", + "name": "ondram/ci-detector", + "version": "3.5.1", "source": { "type": "git", - "url": "https://github.com/humbug/phar-updater.git", - "reference": "d01d3b8f26e541ac9b9eeba1e18d005d852f7ff1" + "url": "https://github.com/OndraM/ci-detector.git", + "reference": "594e61252843b68998bddd48078c5058fe9028bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/humbug/phar-updater/zipball/d01d3b8f26e541ac9b9eeba1e18d005d852f7ff1", - "reference": "d01d3b8f26e541ac9b9eeba1e18d005d852f7ff1", + "url": "https://api.github.com/repos/OndraM/ci-detector/zipball/594e61252843b68998bddd48078c5058fe9028bd", + "reference": "594e61252843b68998bddd48078c5058fe9028bd", "shasum": "" }, "require": { - "padraic/humbug_get_contents": "^1.0", - "php": ">=5.3.3" + "php": "^7.1 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "ergebnis/composer-normalize": "^2.2", + "lmc/coding-standard": "^1.3 || ^2.0", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpstan/extension-installer": "^1.0.3", + "phpstan/phpstan": "^0.12.0", + "phpstan/phpstan-phpunit": "^0.12.1", + "phpunit/phpunit": "^7.1 || ^8.0 || ^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, "autoload": { "psr-4": { - "Humbug\\SelfUpdate\\": "src/" + "OndraM\\CiDetector\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "name": "Ondřej Machulda", + "email": "ondrej.machulda@gmail.com" } ], - "description": "A thing to make PHAR self-updating easy and secure.", + "description": "Detect continuous integration environment and provide unified access to properties of current build", "keywords": [ - "humbug", - "phar", - "self-update", - "update" - ], - "abandoned": true, - "time": "2018-03-30T12:52:15+00:00" + "CircleCI", + "Codeship", + "Wercker", + "adapter", + "appveyor", + "aws", + "aws codebuild", + "bamboo", + "bitbucket", + "buddy", + "ci-info", + "codebuild", + "continuous integration", + "continuousphp", + "drone", + "github", + "gitlab", + "interface", + "jenkins", + "teamcity", + "travis" + ], + "support": { + "issues": "https://github.com/OndraM/ci-detector/issues", + "source": "https://github.com/OndraM/ci-detector/tree/main" + }, + "time": "2020-09-04T11:21:14+00:00" }, { - "name": "padraic/phpunit-accelerator", - "version": "v1.0.2", + "name": "phar-io/manifest", + "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/padraic/phpunit-accelerator.git", - "reference": "0b3b58e6e9a794eec22df712776058850d5fe0c1" + "url": "https://github.com/phar-io/manifest.git", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/padraic/phpunit-accelerator/zipball/0b3b58e6e9a794eec22df712776058850d5fe0c1", - "reference": "0b3b58e6e9a794eec22df712776058850d5fe0c1", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", "shasum": "" }, "require": { - "php": ">=5.3.3", - "phpunit/phpunit": ">=3.7" - }, - "replace": { - "mybuilder/phpunit-accelerator": "1.0.x" + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", - "autoload": { - "psr-4": { - "MyBuilder\\PhpunitAccelerator\\": "src" + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Keyvan Akbary", - "email": "keyvan@mybuilder.com", + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", "role": "Developer" }, { - "name": "Padraic Brady", - "email": "padraic.brady@gmail.com", - "role": "Contributor" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "PHPUnit Accelerator: Speeds up PHPUnit by freeing memory after test runs", - "keywords": [ - "accelerator", - "fast", - "free", - "memory", - "phpunit", - "property" - ], - "time": "2015-01-15T21:18:21+00:00" + "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" + }, + "time": "2020-06-27T14:33:11+00:00" }, { - "name": "padraic/phpunit-extensions", - "version": "1.0.1", + "name": "phar-io/version", + "version": "3.0.4", "source": { "type": "git", - "url": "https://github.com/humbug/phpunit-extensions.git", - "reference": "a6942fa3ada5487e1b9a409c235013a677c2689b" + "url": "https://github.com/phar-io/version.git", + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/humbug/phpunit-extensions/zipball/a6942fa3ada5487e1b9a409c235013a677c2689b", - "reference": "a6942fa3ada5487e1b9a409c235013a677c2689b", + "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", "shasum": "" }, "require": { - "php": ">=5.4.0", - "phpunit/phpunit": "^4.0|^5.0" + "php": "^7.2 || ^8.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, "autoload": { - "psr-0": { - "Humbug\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1239,21 +1037,27 @@ ], "authors": [ { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "Collection of Listeners to log and manipulate test run order", - "keywords": [ - "extension", - "humbug", - "listener", - "phpunit", - "testing", - "tests" - ], - "time": "2016-01-06T12:16:20+00:00" + "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/3.0.4" + }, + "time": "2020-12-13T23:18:30+00:00" }, { "name": "php-vcr/php-vcr", @@ -1302,6 +1106,10 @@ } ], "description": "Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.", + "support": { + "issues": "https://github.com/php-vcr/php-vcr/issues", + "source": "https://github.com/php-vcr/php-vcr/tree/1.5.1" + }, "time": "2020-11-22T13:11:57+00:00" }, { @@ -1351,6 +1159,10 @@ "reflection", "static analysis" ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, "time": "2020-06-27T09:03:43+00:00" }, { @@ -1403,6 +1215,10 @@ } ], "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/master" + }, "time": "2020-09-03T19:13:55+00:00" }, { @@ -1448,37 +1264,41 @@ } ], "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.4.0" + }, "time": "2020-09-17T18:55:26+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.10.3", + "version": "1.12.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "451c3cd1418cf640de218914901e51b064abb093" + "reference": "245710e971a030f42e08f4912863805570f23d39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", - "reference": "451c3cd1418cf640de218914901e51b064abb093", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", + "reference": "245710e971a030f42e08f4912863805570f23d39", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.1", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10.x-dev" + "dev-master": "1.11.x-dev" } }, "autoload": { @@ -1511,36 +1331,52 @@ "spy", "stub" ], - "time": "2020-03-05T15:02:03+00:00" + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/1.12.2" + }, + "time": "2020-12-19T10:15:11+00:00" }, { - "name": "phpunit/dbunit", - "version": "2.0.3", + "name": "phpunit/php-code-coverage", + "version": "9.2.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/dbunit.git", - "reference": "5c35d74549c21ba55d0ea74ba89d191a51f8cf25" + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/dbunit/zipball/5c35d74549c21ba55d0ea74ba89d191a51f8cf25", - "reference": "5c35d74549c21ba55d0ea74ba89d191a51f8cf25", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", "shasum": "" }, "require": { - "ext-pdo": "*", - "ext-simplexml": "*", - "php": "^5.4 || ^7.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0", - "symfony/yaml": "^2.1 || ^3.0" + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.10.2", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "*", + "ext-xdebug": "*" }, - "bin": [ - "dbunit" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -1555,56 +1391,53 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], - "description": "DbUnit port for PHP/PHPUnit to support database interaction testing.", - "homepage": "https://github.com/sebastianbergmann/dbunit/", + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", "keywords": [ - "database", + "coverage", "testing", "xunit" ], - "abandoned": true, - "time": "2016-12-02T14:39:14+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:44:49+00:00" }, { - "name": "phpunit/php-code-coverage", - "version": "4.0.8", + "name": "phpunit/php-file-iterator", + "version": "3.0.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" + "php": ">=7.3" }, "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" - }, - "suggest": { - "ext-xdebug": "^2.5.1" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1619,40 +1452,56 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", "keywords": [ - "coverage", - "testing", - "xunit" + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2017-04-02T07:44:40+00:00" + "time": "2020-09-28T05:57:25+00:00" }, { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1667,36 +1516,53 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", "keywords": [ - "filesystem", - "iterator" + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2020-09-28T05:58:55+00:00" }, { "name": "phpunit/php-text-template", - "version": "1.2.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1718,32 +1584,42 @@ "keywords": [ "template" ], - "time": "2015-06-21T13:50:34+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1758,7 +1634,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1767,105 +1643,69 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "funding": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "abandoned": true, - "time": "2017-11-27T05:48:46+00:00" + "time": "2020-10-26T13:16:10+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.27", + "version": "9.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "^1.0.6|^2.0.1", - "symfony/yaml": "~2.1|~3.0|~4.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.1", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpspec/prophecy": "^1.12.1", + "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^2.3", + "sebastian/version": "^3.0.2" }, "require-dev": { - "ext-pdo": "*" + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "ext-soap": "*", + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -1873,12 +1713,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "9.5-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1899,66 +1742,17 @@ "testing", "xunit" ], - "time": "2018-02-01T05:50:59+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "funding": [ { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2017-06-30T09:13:00+00:00" + "time": "2021-02-02T14:45:58+00:00" }, { "name": "psr/container", @@ -2007,34 +1801,38 @@ "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" }, { - "name": "psr/log", - "version": "1.1.3", + "name": "psr/event-dispatcher", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\EventDispatcher\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2047,40 +1845,45 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "Standard interfaces for event handling.", "keywords": [ - "log", + "events", "psr", - "psr-3" + "psr-14" ], - "time": "2020-03-23T09:12:05+00:00" + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" }, { - "name": "ramsey/array_column", + "name": "psr/log", "version": "1.1.3", "source": { "type": "git", - "url": "https://github.com/ramsey/array_column.git", - "reference": "f8e52eb28e67eb50e613b451dd916abcf783c1db" + "url": "https://github.com/php-fig/log.git", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/array_column/zipball/f8e52eb28e67eb50e613b451dd916abcf783c1db", - "reference": "f8e52eb28e67eb50e613b451dd916abcf783c1db", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "0.8.*", - "phpunit/phpunit": "~4.5", - "satooshi/php-coveralls": "0.6.*", - "squizlabs/php_codesniffer": "~2.2" + "require": { + "php": ">=5.3.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, "autoload": { - "files": [ - "src/array_column.php" - ] + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2088,18 +1891,21 @@ ], "authors": [ { - "name": "Ben Ramsey", - "homepage": "http://benramsey.com" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Provides functionality for array_column() to projects using PHP earlier than version 5.5.", - "homepage": "https://github.com/ramsey/array_column", + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "array", - "array_column", - "column" + "log", + "psr", + "psr-3" ], - "time": "2015-03-20T22:07:39+00:00" + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.3" + }, + "time": "2020-03-23T09:12:05+00:00" }, { "name": "rmccue/requests", @@ -2148,147 +1954,159 @@ "iri", "sockets" ], + "support": { + "issues": "https://github.com/rmccue/Requests/issues", + "source": "https://github.com/rmccue/Requests/tree/master" + }, "time": "2016-10-13T00:11:37+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", + "name": "sanmai/later", + "version": "0.1.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + "url": "https://github.com/sanmai/later.git", + "reference": "9b659fecef2030193fd02402955bc39629d5606f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "url": "https://api.github.com/repos/sanmai/later/zipball/9b659fecef2030193fd02402955bc39629d5606f", + "reference": "9b659fecef2030193fd02402955bc39629d5606f", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "friendsofphp/php-cs-fixer": "^2.13", + "infection/infection": ">=0.10.5", + "phan/phan": ">=2", + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": ">=0.10", + "phpunit/phpunit": ">=7.4", + "vimeo/psalm": ">=2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Later\\": "src/" + }, + "files": [ + "src/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "Apache-2.0" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Alexey Kopytko", + "email": "alexey@kopytko.com" } ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "description": "Later: deferred wrapper object", + "support": { + "issues": "https://github.com/sanmai/later/issues", + "source": "https://github.com/sanmai/later/tree/0.1.2" + }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://github.com/sanmai", "type": "github" } ], - "time": "2020-11-30T08:15:22+00:00" + "time": "2021-01-02T10:26:44+00:00" }, { - "name": "sebastian/comparator", - "version": "1.2.4", + "name": "sanmai/pipeline", + "version": "v5.1.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "url": "https://github.com/sanmai/pipeline.git", + "reference": "f935e10ddcb758c89829e7b69cfb1dc2b2638518" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sanmai/pipeline/zipball/f935e10ddcb758c89829e7b69cfb1dc2b2638518", + "reference": "f935e10ddcb758c89829e7b69cfb1dc2b2638518", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "ergebnis/composer-normalize": "^2.8", + "friendsofphp/php-cs-fixer": "^2.16", + "infection/infection": ">=0.10.5", + "league/pipeline": "^1.0 || ^0.3", + "phan/phan": "^1.1 || ^2.0 || ^3.0", + "php-coveralls/php-coveralls": "^2.4.1", + "phpstan/phpstan": ">=0.10", + "phpunit/phpunit": "^7.4 || ^8.1 || ^9.4", + "vimeo/psalm": "^2.0 || ^3.0 || ^4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-main": "v5.x-dev" } }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Pipeline\\": "src/" + }, + "files": [ + "src/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "Apache-2.0" ], "authors": [ { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Alexey Kopytko", + "email": "alexey@kopytko.com" } ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" + "description": "General-purpose collections pipeline", + "support": { + "issues": "https://github.com/sanmai/pipeline/issues", + "source": "https://github.com/sanmai/pipeline/tree/v5.1.0" + }, + "funding": [ + { + "url": "https://github.com/sanmai", + "type": "github" + } ], - "time": "2017-01-29T09:50:25+00:00" + "time": "2020-10-25T15:20:56+00:00" }, { - "name": "sebastian/diff", - "version": "1.4.3", + "name": "sebastian/cli-parser", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -2301,46 +2119,50 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2017-05-22T07:24:03+00:00" + "time": "2020-09-28T06:08:49+00:00" }, { - "name": "sebastian/environment", - "version": "2.0.0", + "name": "sebastian/code-unit", + "version": "1.0.8", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -2355,44 +2177,48 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2016-11-26T07:53:53+00:00" + "time": "2020-10-26T13:08:54+00:00" }, { - "name": "sebastian/exporter", - "version": "2.0.0", + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": ">=7.3" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2405,62 +2231,51 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" } ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" + "description": "Looks up which function or method a line of code belongs to", + "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/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2016-11-19T08:54:04+00:00" + "time": "2020-09-28T05:30:19+00:00" }, { - "name": "sebastian/global-state", - "version": "1.1.1", + "name": "sebastian/comparator", + "version": "4.0.6", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2476,40 +2291,64 @@ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" } ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ - "global state" + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2015-10-12T03:26:01+00:00" + "time": "2020-10-26T15:49:45+00:00" }, { - "name": "sebastian/object-enumerator", - "version": "2.0.1", + "name": "sebastian/complexity", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "nikic/php-parser": "^4.7", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2524,37 +2363,49 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" }, { - "name": "sebastian/recursion-context", - "version": "2.0.0", + "name": "sebastian/diff", + "version": "4.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2567,44 +2418,62 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, { - "name": "Adam Harvey", - "email": "aharvey@php.net" + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" }, { - "name": "sebastian/resource-operations", - "version": "1.0.0", + "name": "sebastian/environment", + "version": "5.1.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -2622,31 +2491,51 @@ "email": "sebastian@phpunit.de" } ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:52:38+00:00" }, { - "name": "sebastian/version", - "version": "2.0.1", + "name": "sebastian/exporter", + "version": "4.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2661,175 +2550,195 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:24:23+00:00" }, { - "name": "seld/jsonlint", - "version": "1.8.3", + "name": "sebastian/global-state", + "version": "5.0.2", "source": { "type": "git", - "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57" + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9ad6ce79c342fbd44df10ea95511a1b24dee5b57", - "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", "shasum": "" }, "require": { - "php": "^5.3 || ^7.0 || ^8.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" }, - "bin": [ - "bin/jsonlint" - ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, "autoload": { - "psr-4": { - "Seld\\JsonLint\\": "src/Seld/JsonLint/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "JSON Linter", + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", "keywords": [ - "json", - "linter", - "parser", - "validator" + "global state" ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + }, "funding": [ { - "url": "https://github.com/Seldaek", + "url": "https://github.com/sebastianbergmann", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint", - "type": "tidelift" } ], - "time": "2020-11-11T09:19:24+00:00" + "time": "2020-10-26T15:55:19+00:00" }, { - "name": "seld/phar-utils", - "version": "1.1.1", + "name": "sebastian/lines-of-code", + "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796" + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8674b1d84ffb47cc59a101f5d5a3b61e87d23796", - "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", "shasum": "" }, "require": { - "php": ">=5.3" + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "1.0-dev" } }, "autoload": { - "psr-4": { - "Seld\\PharUtils\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "PHAR file format utilities, for when PHP phars you up", - "keywords": [ - "phar" + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2020-07-07T18:42:57+00:00" + "time": "2020-11-28T06:42:11+00:00" }, { - "name": "squizlabs/php_codesniffer", - "version": "2.9.2", + "name": "sebastian/object-enumerator", + "version": "4.0.4", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745" + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", "shasum": "" }, "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.1.2" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^9.3" }, - "bin": [ - "scripts/phpcs", - "scripts/phpcbf" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2838,357 +2747,334 @@ ], "authors": [ { - "name": "Greg Sherwood", - "role": "lead" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2018-11-07T22:31:41+00:00" + "time": "2020-10-26T13:12:34+00:00" }, { - "name": "symfony/config", - "version": "v3.4.47", + "name": "sebastian/object-reflector", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f" + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", - "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" + "php": ">=7.3" }, "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" + "phpunit/phpunit": "^9.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, "funding": [ { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/sebastianbergmann", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2020-10-26T13:14:26+00:00" }, { - "name": "symfony/console", - "version": "v3.4.47", + "name": "sebastian/recursion-context", + "version": "4.0.4", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81" + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a10b1da6fc93080c180bba7219b5ff5b7518fe81", - "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "provide": { - "psr/log-implementation": "1.0" + "php": ">=7.3" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "phpunit/phpunit": "^9.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", + "description": "Provides functionality to recursively process PHP variables", + "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/4.0.4" + }, "funding": [ { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/sebastianbergmann", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2020-10-26T13:17:30+00:00" }, { - "name": "symfony/debug", - "version": "v3.4.47", + "name": "sebastian/resource-operations", + "version": "3.0.3", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "ab42889de57fdfcfcc0759ab102e2fd4ea72dcae" + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/ab42889de57fdfcfcc0759ab102e2fd4ea72dcae", - "reference": "ab42889de57fdfcfcc0759ab102e2fd4ea72dcae", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "php": ">=7.3" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" + "phpunit/phpunit": "^9.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", + "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/3.0.3" + }, "funding": [ { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/sebastianbergmann", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2020-09-28T06:45:17+00:00" }, { - "name": "symfony/dependency-injection", - "version": "v3.4.47", + "name": "sebastian/type", + "version": "2.3.1", "source": { "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "51d2a2708c6ceadad84393f8581df1dcf9e5e84b" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/51d2a2708c6ceadad84393f8581df1dcf9e5e84b", - "reference": "51d2a2708c6ceadad84393f8581df1dcf9e5e84b", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/container": "^1.0" - }, - "conflict": { - "symfony/config": "<3.3.7", - "symfony/finder": "<3.3", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "psr/container-implementation": "1.0" + "php": ">=7.3" }, "require-dev": { - "symfony/config": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" + "phpunit/phpunit": "^9.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", + "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/2.3.1" + }, "funding": [ { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/sebastianbergmann", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2020-10-26T13:18:59+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v3.4.47", + "name": "sebastian/version", + "version": "3.0.2", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "31fde73757b6bad247c54597beef974919ec6860" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/31fde73757b6bad247c54597beef974919ec6860", - "reference": "31fde73757b6bad247c54597beef974919ec6860", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.3" }, - "conflict": { - "symfony/dependency-injection": "<3.3" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/debug": "~3.4|~4.4", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" + "autoload": { + "classmap": [ + "src/" + ] }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "seld/jsonlint", + "version": "1.8.3", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9ad6ce79c342fbd44df10ea95511a1b24dee5b57", + "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, + "bin": [ + "bin/jsonlint" + ], "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3196,54 +3082,136 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" } ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "support": { + "issues": "https://github.com/Seldaek/jsonlint/issues", + "source": "https://github.com/Seldaek/jsonlint/tree/1.8.3" + }, "funding": [ { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/Seldaek", "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint", "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2020-11-11T09:19:24+00:00" }, { - "name": "symfony/filesystem", - "version": "v3.4.47", + "name": "squizlabs/php_codesniffer", + "version": "3.5.8", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3" + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "9d583721a7157ee997f235f327de038e7ea6dac4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e58d7841cddfed6e846829040dca2cca0ebbbbb3", - "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", + "reference": "9d583721a7157ee997f235f327de038e7ea6dac4", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "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", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2020-10-23T02:01:07+00:00" + }, + { + "name": "symfony/console", + "version": "v5.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "89d4b176d12a2946a1ae4e34906a025b7b6b135a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/89d4b176d12a2946a1ae4e34906a025b7b6b135a", + "reference": "89d4b176d12a2946a1ae4e34906a025b7b6b135a", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php80": "^1.15", + "symfony/service-contracts": "^1.1|^2", + "symfony/string": "^5.1" + }, + "conflict": { + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Filesystem\\": "" + "Symfony\\Component\\Console\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -3263,8 +3231,14 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], "funding": [ { "url": "https://symfony.com/sponsor", @@ -3279,32 +3253,38 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-01-28T22:06:19+00:00" }, { - "name": "symfony/finder", - "version": "v3.4.47", + "name": "symfony/deprecation-contracts", + "version": "v2.2.0", "source": { "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "b6b6ad3db3edb1b4b1c1896b1975fb684994de6e" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/b6b6ad3db3edb1b4b1c1896b1975fb684994de6e", - "reference": "b6b6ad3db3edb1b4b1c1896b1975fb684994de6e", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.1" }, "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" }, - "exclude-from-classmap": [ - "/Tests/" + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3313,16 +3293,19 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/master" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3337,44 +3320,56 @@ "type": "tidelift" } ], - "time": "2020-11-16T17:02:08+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { - "name": "symfony/polyfill-ctype", - "version": "v1.22.0", + "name": "symfony/event-dispatcher", + "version": "v5.2.3", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "4f9760f8074978ad82e2ce854dff79a71fe45367" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4f9760f8074978ad82e2ce854dff79a71fe45367", + "reference": "4f9760f8074978ad82e2ce854dff79a71fe45367", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/event-dispatcher-contracts": "^2", + "symfony/polyfill-php80": "^1.15" + }, + "conflict": { + "symfony/dependency-injection": "<4.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^4.4|^5.0" }, "suggest": { - "ext-ctype": "For best performance" + "symfony/dependency-injection": "", + "symfony/http-kernel": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.22-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" + "Symfony\\Component\\EventDispatcher\\": "" }, - "files": [ - "bootstrap.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3383,22 +3378,16 @@ ], "authors": [ { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for ctype functions", + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], "funding": [ { "url": "https://symfony.com/sponsor", @@ -3413,45 +3402,43 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-01-27T10:36:42+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.22.0", + "name": "symfony/event-dispatcher-contracts", + "version": "v2.2.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "0ba7d54483095a198fa51781bc608d17e84dffa2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", - "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ba7d54483095a198fa51781bc608d17e84dffa2", + "reference": "0ba7d54483095a198fa51781bc608d17e84dffa2", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2.5", + "psr/event-dispatcher": "^1" }, "suggest": { - "ext-mbstring": "For best performance" + "symfony/event-dispatcher-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-master": "2.2-dev" }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Symfony\\Contracts\\EventDispatcher\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3467,15 +3454,19 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Generic abstractions related to dispatching event", "homepage": "https://symfony.com", "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.2.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3490,29 +3481,30 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { - "name": "symfony/process", - "version": "v3.4.47", + "name": "symfony/filesystem", + "version": "v5.2.3", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca" + "url": "https://github.com/symfony/filesystem.git", + "reference": "262d033b57c73e8b59cd6e68a45c528318b15038" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b8648cf1d5af12a44a51d07ef9bf980921f15fca", - "reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/262d033b57c73e8b59cd6e68a45c528318b15038", + "reference": "262d033b57c73e8b59cd6e68a45c528318b15038", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Process\\": "" + "Symfony\\Component\\Filesystem\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -3532,7 +3524,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "funding": [ { @@ -3548,50 +3540,29 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-01-27T10:01:46+00:00" }, { - "name": "symfony/translation", - "version": "v3.4.47", + "name": "symfony/finder", + "version": "v5.2.3", "source": { "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "be83ee6c065cb32becdb306ba61160d598b1ce88" + "url": "https://github.com/symfony/finder.git", + "reference": "4adc8d172d602008c204c2e16956f99257248e03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/be83ee6c065cb32becdb306ba61160d598b1ce88", - "reference": "be83ee6c065cb32becdb306ba61160d598b1ce88", + "url": "https://api.github.com/repos/symfony/finder/zipball/4adc8d172d602008c204c2e16956f99257248e03", + "reference": "4adc8d172d602008c204c2e16956f99257248e03", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "~3.4|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", - "symfony/var-dumper": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" + "php": ">=7.2.5" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Translation\\": "" + "Symfony\\Component\\Finder\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -3611,7 +3582,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Translation Component", + "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "funding": [ { @@ -3627,42 +3598,44 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-01-28T22:06:19+00:00" }, { - "name": "symfony/yaml", - "version": "v3.4.47", + "name": "symfony/polyfill-ctype", + "version": "v1.22.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "88289caa3c166321883f67fe5130188ebbb47094" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", - "reference": "88289caa3c166321883f67fe5130188ebbb47094", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" + "php": ">=7.1" }, "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "ext-ctype": "For best performance" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.22-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "Symfony\\Polyfill\\Ctype\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3671,16 +3644,25 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3695,38 +3677,45 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { - "name": "webmozart/assert", - "version": "1.9.1", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.22.0", "source": { "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/267a9adeb8ecb8071040a740930e077cdfb987af", + "reference": "267a9adeb8ecb8071040a740930e077cdfb987af", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "php": ">=7.1" }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "suggest": { + "ext-intl": "For best performance" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.22-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, "autoload": { "psr-4": { - "Webmozart\\Assert\\": "src/" - } + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3734,108 +3723,82 @@ ], "authors": [ { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Assertions to validate method input/output with nice error messages.", + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", "keywords": [ - "assert", - "check", - "validate" + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" ], - "time": "2020-07-08T17:02:28+00:00" - }, - { - "name": "wp-cli/autoload-splitter", - "version": "v0.1.5", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/autoload-splitter.git", - "reference": "fb4302da26390811d2631c62b42b75976d224bb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/autoload-splitter/zipball/fb4302da26390811d2631c62b42b75976d224bb8", - "reference": "fb4302da26390811d2631c62b42b75976d224bb8", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1" - }, - "type": "composer-plugin", - "extra": { - "class": "WP_CLI\\AutoloadSplitter\\ComposerPlugin" - }, - "autoload": { - "psr-4": { - "WP_CLI\\AutoloadSplitter\\": "src" - } + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.0" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, { - "name": "Alain Schlesser", - "email": "alain.schlesser@gmail.com", - "homepage": "https://www.alainschlesser.com" + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Composer plugin for splitting a generated autoloader into two distinct parts.", - "homepage": "https://wp-cli.org", - "abandoned": true, - "time": "2017-08-03T08:40:16+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { - "name": "wp-cli/cache-command", - "version": "v1.0.6", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.22.0", "source": { "type": "git", - "url": "https://github.com/wp-cli/cache-command.git", - "reference": "d82cba9effa198f17847dce5771c8fb20c443ffa" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "6e971c891537eb617a00bb07a43d182a6915faba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/cache-command/zipball/d82cba9effa198f17847dce5771c8fb20c443ffa", - "reference": "d82cba9effa198f17847dce5771c8fb20c443ffa", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/6e971c891537eb617a00bb07a43d182a6915faba", + "reference": "6e971c891537eb617a00bb07a43d182a6915faba", "shasum": "" }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" + "require": { + "php": ">=7.1" }, - "type": "wp-cli-package", + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-main": "1.22-dev" }, - "bundled": true, - "commands": [ - "cache", - "cache add", - "cache decr", - "cache delete", - "cache flush", - "cache get", - "cache incr", - "cache replace", - "cache set", - "cache type", - "transient", - "transient delete", - "transient get", - "transient set", - "transient type" - ] + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } }, "autoload": { "psr-4": { - "": "src/" + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" }, "files": [ - "cache-command.php" + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3844,50 +3807,79 @@ ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Manages object and transient caches.", - "homepage": "https://github.com/wp-cli/cache-command", - "time": "2017-12-14T19:21:19+00:00" + "time": "2021-01-07T17:09:11+00:00" }, { - "name": "wp-cli/checksum-command", - "version": "v1.0.9", + "name": "symfony/polyfill-mbstring", + "version": "v1.22.0", "source": { "type": "git", - "url": "https://github.com/wp-cli/checksum-command.git", - "reference": "89a319440651f2867f282339c2223cfe5e9cc3fb" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/checksum-command/zipball/89a319440651f2867f282339c2223cfe5e9cc3fb", - "reference": "89a319440651f2867f282339c2223cfe5e9cc3fb", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", + "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", "shasum": "" }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "^1.5" + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-mbstring": "For best performance" }, - "type": "wp-cli-package", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-main": "1.22-dev" }, - "bundled": true, - "commands": [ - "core verify-checksums", - "plugin verify-checksums" - ] + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } }, "autoload": { "psr-4": { - "": "src/" + "Symfony\\Polyfill\\Mbstring\\": "" }, "files": [ - "checksum-command.php" + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3896,60 +3888,78 @@ ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Verifies file integrity by comparing to published checksums.", - "homepage": "https://github.com/wp-cli/checksum-command", - "time": "2018-04-20T07:47:27+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { - "name": "wp-cli/config-command", - "version": "v1.2.0", + "name": "symfony/polyfill-php73", + "version": "v1.22.0", "source": { "type": "git", - "url": "https://github.com/wp-cli/config-command.git", - "reference": "7bec9b4685b4022ab511630422dd6acccadfca9b" + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/config-command/zipball/7bec9b4685b4022ab511630422dd6acccadfca9b", - "reference": "7bec9b4685b4022ab511630422dd6acccadfca9b", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", "shasum": "" }, "require": { - "wp-cli/wp-config-transformer": "^1.2.1" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" + "php": ">=7.1" }, - "type": "wp-cli-package", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-main": "1.22-dev" }, - "bundled": true, - "commands": [ - "config", - "config edit", - "config delete", - "config create", - "config get", - "config has", - "config list", - "config path", - "config set" - ] + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } }, "autoload": { "psr-4": { - "": "src/" + "Symfony\\Polyfill\\Php73\\": "" }, "files": [ - "config-command.php" + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3958,499 +3968,77 @@ ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { - "name": "Alain Schlesser", - "email": "alain.schlesser@gmail.com", - "homepage": "https://www.alainschlesser.com" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Generates and reads the wp-config.php file.", - "homepage": "https://github.com/wp-cli/config-command", - "time": "2018-04-20T08:03:51+00:00" - }, - { - "name": "wp-cli/core-command", - "version": "v1.0.12", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/core-command.git", - "reference": "b41913707029c5147b38810700e424ed5f5fe8e0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/core-command/zipball/b41913707029c5147b38810700e424ed5f5fe8e0", - "reference": "b41913707029c5147b38810700e424ed5f5fe8e0", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "core", - "core check-update", - "core download", - "core install", - "core is-installed", - "core multisite-convert", - "core multisite-install", - "core update", - "core update-db", - "core version" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "core-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" ], - "description": "Downloads, installs, updates, and manages a WordPress installation.", - "homepage": "https://github.com/wp-cli/core-command", - "time": "2018-07-25T15:55:02+00:00" - }, - { - "name": "wp-cli/cron-command", - "version": "v1.0.5", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/cron-command.git", - "reference": "9da7e36e8f9c14cb171a3c5204cba2865e0ed7ef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/cron-command/zipball/9da7e36e8f9c14cb171a3c5204cba2865e0ed7ef", - "reference": "9da7e36e8f9c14cb171a3c5204cba2865e0ed7ef", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "cron", - "cron test", - "cron event", - "cron event delete", - "cron event list", - "cron event run", - "cron event schedule", - "cron schedule", - "cron schedule list" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "cron-command.php" - ] + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.0" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "funding": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Tests, runs, and deletes WP-Cron events; manages WP-Cron schedules.", - "homepage": "https://github.com/wp-cli/cron-command", - "time": "2017-12-08T15:09:54+00:00" - }, - { - "name": "wp-cli/db-command", - "version": "v1.3.5", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/db-command.git", - "reference": "c260be59d9ac4c0012b016405e17d0251137fb89" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/db-command/zipball/c260be59d9ac4c0012b016405e17d0251137fb89", - "reference": "c260be59d9ac4c0012b016405e17d0251137fb89", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "^1.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "db", - "db create", - "db drop", - "db reset", - "db check", - "db optimize", - "db prefix", - "db repair", - "db cli", - "db query", - "db export", - "db import", - "db search", - "db tables", - "db size", - "db columns" - ] - }, - "autoload": { - "psr-4": { - "": "src/" + "url": "https://symfony.com/sponsor", + "type": "custom" }, - "files": [ - "db-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Performs basic database operations using credentials stored in wp-config.php.", - "homepage": "https://github.com/wp-cli/db-command", - "time": "2018-07-31T02:06:59+00:00" - }, - { - "name": "wp-cli/embed-command", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/embed-command.git", - "reference": "81319d4243a8dfe096389bf54cdc4fc3dec53497" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/embed-command/zipball/81319d4243a8dfe096389bf54cdc4fc3dec53497", - "reference": "81319d4243a8dfe096389bf54cdc4fc3dec53497", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "^1.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "embed", - "embed fetch", - "embed provider list", - "embed provider match", - "embed handler list", - "embed cache clear", - "embed cache find", - "embed cache trigger" - ] - }, - "autoload": { - "psr-4": { - "WP_CLI\\Embeds\\": "src/" - }, - "files": [ - "embed-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Pascal Birchler", - "homepage": "https://pascalbirchler.com/" - } - ], - "description": "Inspects oEmbed providers, clears embed cache, and more.", - "homepage": "https://github.com/wp-cli/embed-command", - "time": "2018-01-22T21:26:48+00:00" - }, - { - "name": "wp-cli/entity-command", - "version": "v1.3.1", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/entity-command.git", - "reference": "7b000645684b6acbb1d55ab47b77eb08f35cd229" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/entity-command/zipball/7b000645684b6acbb1d55ab47b77eb08f35cd229", - "reference": "7b000645684b6acbb1d55ab47b77eb08f35cd229", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "phpunit/phpunit": "^4.8", - "wp-cli/wp-cli": "^1.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "comment", - "comment approve", - "comment count", - "comment create", - "comment delete", - "comment exists", - "comment generate", - "comment get", - "comment list", - "comment meta", - "comment meta add", - "comment meta delete", - "comment meta get", - "comment meta list", - "comment meta patch", - "comment meta pluck", - "comment meta update", - "comment recount", - "comment spam", - "comment status", - "comment trash", - "comment unapprove", - "comment unspam", - "comment untrash", - "comment update", - "menu", - "menu create", - "menu delete", - "menu item", - "menu item add-custom", - "menu item add-post", - "menu item add-term", - "menu item delete", - "menu item list", - "menu item update", - "menu list", - "menu location", - "menu location assign", - "menu location list", - "menu location remove", - "network meta", - "network meta add", - "network meta delete", - "network meta get", - "network meta list", - "network meta patch", - "network meta pluck", - "network meta update", - "option", - "option add", - "option delete", - "option get", - "option list", - "option patch", - "option pluck", - "option update", - "post", - "post create", - "post delete", - "post edit", - "post generate", - "post get", - "post list", - "post meta", - "post meta add", - "post meta delete", - "post meta get", - "post meta list", - "post meta patch", - "post meta pluck", - "post meta update", - "post term", - "post term add", - "post term list", - "post term remove", - "post term set", - "post update", - "post-type", - "post-type get", - "post-type list", - "site", - "site activate", - "site archive", - "site create", - "site deactivate", - "site delete", - "site empty", - "site list", - "site mature", - "site option", - "site private", - "site public", - "site spam", - "site unarchive", - "site unmature", - "site unspam", - "taxonomy", - "taxonomy get", - "taxonomy list", - "term", - "term create", - "term delete", - "term generate", - "term get", - "term list", - "term meta", - "term meta add", - "term meta delete", - "term meta get", - "term meta list", - "term meta patch", - "term meta pluck", - "term meta update", - "term recount", - "term update", - "user", - "user add-cap", - "user add-role", - "user create", - "user delete", - "user generate", - "user get", - "user import-csv", - "user list", - "user list-caps", - "user meta", - "user meta add", - "user meta delete", - "user meta get", - "user meta list", - "user meta patch", - "user meta pluck", - "user meta update", - "user remove-cap", - "user remove-role", - "user reset-password", - "user session", - "user session destroy", - "user session list", - "user set-role", - "user spam", - "user term", - "user term add", - "user term list", - "user term remove", - "user term set", - "user unspam", - "user update" - ] - }, - "autoload": { - "psr-4": { - "": "src/", - "WP_CLI\\": "src/WP_CLI" + "url": "https://github.com/fabpot", + "type": "github" }, - "files": [ - "entity-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Manage WordPress core entities.", - "homepage": "https://github.com/wp-cli/entity-command", - "time": "2018-07-13T12:21:06+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { - "name": "wp-cli/eval-command", - "version": "v1.0.5", + "name": "symfony/polyfill-php80", + "version": "v1.22.0", "source": { "type": "git", - "url": "https://github.com/wp-cli/eval-command.git", - "reference": "9640d40ab28cd86590396f08f8c382e659f57321" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/eval-command/zipball/9640d40ab28cd86590396f08f8c382e659f57321", - "reference": "9640d40ab28cd86590396f08f8c382e659f57321", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", "shasum": "" }, "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" + "php": ">=7.1" }, - "type": "wp-cli-package", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-main": "1.22-dev" }, - "bundled": true, - "commands": [ - "eval", - "eval-file" - ] + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } }, "autoload": { "psr-4": { - "": "src/" + "Symfony\\Polyfill\\Php80\\": "" }, "files": [ - "eval-command.php" + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -4459,187 +4047,70 @@ ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Executes arbitrary PHP code or files.", - "homepage": "https://github.com/wp-cli/eval-command", - "time": "2017-12-08T14:33:34+00:00" - }, - { - "name": "wp-cli/export-command", - "version": "v1.0.7", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/export-command.git", - "reference": "776d33ad6b2ac93c00fded27402ca8e188e7bff0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/export-command/zipball/776d33ad6b2ac93c00fded27402ca8e188e7bff0", - "reference": "776d33ad6b2ac93c00fded27402ca8e188e7bff0", - "shasum": "" - }, - "require": { - "nb/oxymel": "~0.1.0" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "^1.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" }, - "bundled": true, - "commands": [ - "export" - ] - }, - "autoload": { - "psr-4": { - "": "src/" + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, - "files": [ - "export-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Exports WordPress content to a WXR file.", - "homepage": "https://github.com/wp-cli/export-command", - "time": "2018-04-20T08:10:47+00:00" - }, - { - "name": "wp-cli/extension-command", - "version": "v1.2.2", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/extension-command.git", - "reference": "18f1036bad42f481f178c2f4139039e9424b6e14" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/extension-command/zipball/18f1036bad42f481f178c2f4139039e9424b6e14", - "reference": "18f1036bad42f481f178c2f4139039e9424b6e14", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.0" }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" }, - "bundled": true, - "commands": [ - "plugin", - "plugin activate", - "plugin deactivate", - "plugin delete", - "plugin get", - "plugin install", - "plugin is-installed", - "plugin list", - "plugin path", - "plugin search", - "plugin status", - "plugin toggle", - "plugin uninstall", - "plugin update", - "theme", - "theme activate", - "theme delete", - "theme disable", - "theme enable", - "theme get", - "theme install", - "theme is-installed", - "theme list", - "theme mod", - "theme mod get", - "theme mod set", - "theme mod remove", - "theme path", - "theme search", - "theme status", - "theme update", - "theme mod list" - ] - }, - "autoload": { - "psr-4": { - "": "src/" + { + "url": "https://github.com/fabpot", + "type": "github" }, - "files": [ - "extension-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Manages plugins and themes, including installs, activations, and updates.", - "homepage": "https://github.com/wp-cli/extension-command", - "time": "2018-07-31T17:46:49+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { - "name": "wp-cli/import-command", - "version": "v1.0.7", + "name": "symfony/process", + "version": "v5.2.3", "source": { "type": "git", - "url": "https://github.com/wp-cli/import-command.git", - "reference": "421fec5bd96671931f2119a89d28bae2f9edeb6b" + "url": "https://github.com/symfony/process.git", + "reference": "313a38f09c77fbcdc1d223e57d368cea76a2fd2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/import-command/zipball/421fec5bd96671931f2119a89d28bae2f9edeb6b", - "reference": "421fec5bd96671931f2119a89d28bae2f9edeb6b", + "url": "https://api.github.com/repos/symfony/process/zipball/313a38f09c77fbcdc1d223e57d368cea76a2fd2f", + "reference": "313a38f09c77fbcdc1d223e57d368cea76a2fd2f", "shasum": "" }, "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "import" - ] + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.15" }, + "type": "library", "autoload": { "psr-4": { - "": "src/" + "Symfony\\Component\\Process\\": "" }, - "files": [ - "import-command.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -4648,159 +4119,67 @@ ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Imports content from a given WXR file.", - "homepage": "https://github.com/wp-cli/import-command", - "time": "2018-04-20T08:07:05+00:00" - }, - { - "name": "wp-cli/language-command", - "version": "v1.0.6", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/language-command.git", - "reference": "2a3d1ce5a722a4d70809619a065087aa933f6209" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/language-command/zipball/2a3d1ce5a722a4d70809619a065087aa933f6209", - "reference": "2a3d1ce5a722a4d70809619a065087aa933f6209", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "language", - "language core", - "language core activate", - "language core install", - "language core list", - "language core uninstall", - "language core update" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, - "files": [ - "language-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Installs, activates, and manages language packs.", - "homepage": "https://github.com/wp-cli/language-command", - "time": "2017-12-08T17:50:26+00:00" - }, - { - "name": "wp-cli/media-command", - "version": "v1.1.4", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/media-command.git", - "reference": "7f8664ba722505446b3ef3dbc6717e8e7f20265c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/media-command/zipball/7f8664ba722505446b3ef3dbc6717e8e7f20265c", - "reference": "7f8664ba722505446b3ef3dbc6717e8e7f20265c", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "^1.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" }, - "bundled": true, - "commands": [ - "media", - "media import", - "media regenerate", - "media image-size" - ] - }, - "autoload": { - "psr-4": { - "": "src/" + { + "url": "https://github.com/fabpot", + "type": "github" }, - "files": [ - "media-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Imports files as attachments, regenerates thumbnails, or lists registered image sizes.", - "homepage": "https://github.com/wp-cli/media-command", - "time": "2018-01-29T02:17:56+00:00" + "time": "2021-01-27T10:15:41+00:00" }, { - "name": "wp-cli/mustangostang-spyc", - "version": "0.6.3", + "name": "symfony/service-contracts", + "version": "v2.2.0", "source": { "type": "git", - "url": "https://github.com/wp-cli/spyc.git", - "reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7" + "url": "https://github.com/symfony/service-contracts.git", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/spyc/zipball/6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7", - "reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", "shasum": "" }, "require": { - "php": ">=5.3.1" + "php": ">=7.2.5", + "psr/container": "^1.0" }, - "require-dev": { - "phpunit/phpunit": "4.3.*@dev" + "suggest": { + "symfony/service-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.5.x-dev" + "dev-master": "2.2-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { "psr-4": { - "Mustangostang\\": "src/" - }, - "files": [ - "includes/functions.php" - ] + "Symfony\\Contracts\\Service\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4808,160 +4187,81 @@ ], "authors": [ { - "name": "mustangostang", - "email": "vlad.andersen@gmail.com" - } - ], - "description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)", - "homepage": "https://github.com/mustangostang/spyc/", - "time": "2017-04-25T11:26:20+00:00" - }, - { - "name": "wp-cli/package-command", - "version": "v1.0.14", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/package-command.git", - "reference": "a7ce916de5e1d0c3d910d4fc8ca31928ee3775d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/package-command/zipball/a7ce916de5e1d0c3d910d4fc8ca31928ee3775d3", - "reference": "a7ce916de5e1d0c3d910d4fc8ca31928ee3775d3", - "shasum": "" - }, - "require": { - "composer/composer": "^1.2.0" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "^1.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "package", - "package browse", - "package install", - "package list", - "package update", - "package uninstall" - ] - }, - "autoload": { - "psr-4": { - "": "src/" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, - "files": [ - "package-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Lists, installs, and removes WP-CLI packages.", - "homepage": "https://github.com/wp-cli/package-command", - "time": "2018-05-28T11:40:24+00:00" - }, - { - "name": "wp-cli/php-cli-tools", - "version": "v0.11.11", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/php-cli-tools.git", - "reference": "fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f", - "reference": "fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f", - "shasum": "" - }, - "require": { - "php": ">= 5.3.0" + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/master" }, - "type": "library", - "autoload": { - "psr-0": { - "cli": "lib/" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" }, - "files": [ - "lib/cli/cli.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ { - "name": "James Logsdon", - "email": "jlogsdon@php.net", - "role": "Developer" + "url": "https://github.com/fabpot", + "type": "github" }, { - "name": "Daniel Bachhuber", - "email": "daniel@handbuilt.co", - "role": "Maintainer" + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Console utilities for PHP", - "homepage": "http://github.com/wp-cli/php-cli-tools", - "keywords": [ - "cli", - "console" - ], - "time": "2018-09-04T13:28:00+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { - "name": "wp-cli/rewrite-command", - "version": "v1.0.5", + "name": "symfony/string", + "version": "v5.2.3", "source": { "type": "git", - "url": "https://github.com/wp-cli/rewrite-command.git", - "reference": "6b1695887e289ffad14c8f4ea86b5f1d92757408" + "url": "https://github.com/symfony/string.git", + "reference": "c95468897f408dd0aca2ff582074423dd0455122" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/rewrite-command/zipball/6b1695887e289ffad14c8f4ea86b5f1d92757408", - "reference": "6b1695887e289ffad14c8f4ea86b5f1d92757408", + "url": "https://api.github.com/repos/symfony/string/zipball/c95468897f408dd0aca2ff582074423dd0455122", + "reference": "c95468897f408dd0aca2ff582074423dd0455122", "shasum": "" }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" + "require": { + "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-php80": "~1.15" }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "rewrite", - "rewrite flush", - "rewrite list", - "rewrite structure" - ], - "bundled": true + "require-dev": { + "symfony/error-handler": "^4.4|^5.0", + "symfony/http-client": "^4.4|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0" }, + "type": "library", "autoload": { "psr-4": { - "": "src/" + "Symfony\\Component\\String\\": "" }, "files": [ - "rewrite-command.php" + "Resources/functions.php" + ], + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -4970,58 +4270,78 @@ ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Lists or flushes the site's rewrite rules, updates the permalink structure.", - "homepage": "https://github.com/wp-cli/rewrite-command", - "time": "2017-12-08T17:51:04+00:00" + "time": "2021-01-25T15:14:59+00:00" }, { - "name": "wp-cli/role-command", - "version": "v1.1.0", + "name": "symfony/yaml", + "version": "v5.2.3", "source": { "type": "git", - "url": "https://github.com/wp-cli/role-command.git", - "reference": "f50134ea9c27c108b1069cf044f7395c8f9bf716" + "url": "https://github.com/symfony/yaml.git", + "reference": "338cddc6d74929f6adf19ca5682ac4b8e109cdb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/role-command/zipball/f50134ea9c27c108b1069cf044f7395c8f9bf716", - "reference": "f50134ea9c27c108b1069cf044f7395c8f9bf716", + "url": "https://api.github.com/repos/symfony/yaml/zipball/338cddc6d74929f6adf19ca5682ac4b8e109cdb0", + "reference": "338cddc6d74929f6adf19ca5682ac4b8e109cdb0", "shasum": "" }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<4.4" + }, "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" + "symfony/console": "^4.4|^5.0" }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "role", - "role create", - "role delete", - "role exists", - "role list", - "role reset", - "cap", - "cap add", - "cap list", - "cap remove" - ], - "bundled": true + "suggest": { + "symfony/console": "For validating YAML files using the lint command" }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", "autoload": { "psr-4": { - "": "src/" + "Symfony\\Component\\Yaml\\": "" }, - "files": [ - "role-command.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -5030,162 +4350,251 @@ ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "Adds, removes, lists, and resets roles and capabilities.", - "homepage": "https://github.com/wp-cli/role-command", - "time": "2018-04-20T08:05:51+00:00" + "time": "2021-02-03T04:42:09+00:00" }, { - "name": "wp-cli/scaffold-command", - "version": "v1.2.0", + "name": "thecodingmachine/safe", + "version": "v1.3.3", "source": { "type": "git", - "url": "https://github.com/wp-cli/scaffold-command.git", - "reference": "a897a54ba0a8199743d90204ff773b302fc77572" + "url": "https://github.com/thecodingmachine/safe.git", + "reference": "a8ab0876305a4cdaef31b2350fcb9811b5608dbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/scaffold-command/zipball/a897a54ba0a8199743d90204ff773b302fc77572", - "reference": "a897a54ba0a8199743d90204ff773b302fc77572", + "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/a8ab0876305a4cdaef31b2350fcb9811b5608dbc", + "reference": "a8ab0876305a4cdaef31b2350fcb9811b5608dbc", "shasum": "" }, + "require": { + "php": ">=7.2" + }, "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "^1.5" + "phpstan/phpstan": "^0.12", + "squizlabs/php_codesniffer": "^3.2", + "thecodingmachine/phpstan-strict-rules": "^0.12" }, - "type": "wp-cli-package", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "scaffold", - "scaffold _s", - "scaffold block", - "scaffold child-theme", - "scaffold plugin", - "scaffold plugin-tests", - "scaffold post-type", - "scaffold taxonomy", - "scaffold theme-tests" - ] + "dev-master": "0.1-dev" + } }, "autoload": { "psr-4": { - "": "src/" + "Safe\\": [ + "lib/", + "deprecated/", + "generated/" + ] }, "files": [ - "scaffold-command.php" + "deprecated/apc.php", + "deprecated/libevent.php", + "deprecated/mssql.php", + "deprecated/stats.php", + "lib/special_cases.php", + "generated/apache.php", + "generated/apcu.php", + "generated/array.php", + "generated/bzip2.php", + "generated/calendar.php", + "generated/classobj.php", + "generated/com.php", + "generated/cubrid.php", + "generated/curl.php", + "generated/datetime.php", + "generated/dir.php", + "generated/eio.php", + "generated/errorfunc.php", + "generated/exec.php", + "generated/fileinfo.php", + "generated/filesystem.php", + "generated/filter.php", + "generated/fpm.php", + "generated/ftp.php", + "generated/funchand.php", + "generated/gmp.php", + "generated/gnupg.php", + "generated/hash.php", + "generated/ibase.php", + "generated/ibmDb2.php", + "generated/iconv.php", + "generated/image.php", + "generated/imap.php", + "generated/info.php", + "generated/ingres-ii.php", + "generated/inotify.php", + "generated/json.php", + "generated/ldap.php", + "generated/libxml.php", + "generated/lzf.php", + "generated/mailparse.php", + "generated/mbstring.php", + "generated/misc.php", + "generated/msql.php", + "generated/mysql.php", + "generated/mysqli.php", + "generated/mysqlndMs.php", + "generated/mysqlndQc.php", + "generated/network.php", + "generated/oci8.php", + "generated/opcache.php", + "generated/openssl.php", + "generated/outcontrol.php", + "generated/password.php", + "generated/pcntl.php", + "generated/pcre.php", + "generated/pdf.php", + "generated/pgsql.php", + "generated/posix.php", + "generated/ps.php", + "generated/pspell.php", + "generated/readline.php", + "generated/rpminfo.php", + "generated/rrd.php", + "generated/sem.php", + "generated/session.php", + "generated/shmop.php", + "generated/simplexml.php", + "generated/sockets.php", + "generated/sodium.php", + "generated/solr.php", + "generated/spl.php", + "generated/sqlsrv.php", + "generated/ssdeep.php", + "generated/ssh2.php", + "generated/stream.php", + "generated/strings.php", + "generated/swoole.php", + "generated/uodbc.php", + "generated/uopz.php", + "generated/url.php", + "generated/var.php", + "generated/xdiff.php", + "generated/xml.php", + "generated/xmlrpc.php", + "generated/yaml.php", + "generated/yaz.php", + "generated/zip.php", + "generated/zlib.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Generates code for post types, taxonomies, blocks, plugins, child themes, etc.", - "homepage": "https://github.com/wp-cli/scaffold-command", - "time": "2018-07-29T15:02:24+00:00" + "description": "PHP core functions that throw exceptions instead of returning FALSE on error", + "support": { + "issues": "https://github.com/thecodingmachine/safe/issues", + "source": "https://github.com/thecodingmachine/safe/tree/v1.3.3" + }, + "time": "2020-10-28T17:51:34+00:00" }, { - "name": "wp-cli/search-replace-command", - "version": "v1.3.1", + "name": "theseer/tokenizer", + "version": "1.2.0", "source": { "type": "git", - "url": "https://github.com/wp-cli/search-replace-command.git", - "reference": "be21639dc530ad6506664baa813862d39b6d78ba" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "75a63c33a8577608444246075ea0af0d052e452a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/search-replace-command/zipball/be21639dc530ad6506664baa813862d39b6d78ba", - "reference": "be21639dc530ad6506664baa813862d39b6d78ba", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", + "reference": "75a63c33a8577608444246075ea0af0d052e452a", "shasum": "" }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "^1.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "search-replace" - ] + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" }, + "type": "library", "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "search-replace-command.php" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/master" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" } ], - "description": "Searches/replaces strings in the database.", - "homepage": "https://github.com/wp-cli/search-replace-command", - "time": "2018-05-29T10:21:19+00:00" + "time": "2020-07-12T23:59:07+00:00" }, { - "name": "wp-cli/server-command", - "version": "v1.0.9", + "name": "webmozart/assert", + "version": "1.9.1", "source": { "type": "git", - "url": "https://github.com/wp-cli/server-command.git", - "reference": "6192e6d7becd07e4c11a8f1560655c73a3b3526a" + "url": "https://github.com/webmozarts/assert.git", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/server-command/zipball/6192e6d7becd07e4c11a8f1560655c73a3b3526a", - "reference": "6192e6d7becd07e4c11a8f1560655c73a3b3526a", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "wp-cli/wp-cli": "*" + "php": "^5.3.3 || ^7.0 || ^8.0", + "symfony/polyfill-ctype": "^1.8" }, - "require-dev": { - "behat/behat": "~2.5" + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "server" - ], - "bundled": true + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, + "type": "library", "autoload": { "psr-4": { - "": "src/" - }, - "files": [ - "server-command.php" - ] + "Webmozart\\Assert\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -5193,53 +4602,54 @@ ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], - "description": "Launches PHP's built-in web server for a specific WordPress installation.", - "homepage": "https://github.com/wp-cli/server-command", - "time": "2017-12-14T20:06:24+00:00" + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.9.1" + }, + "time": "2020-07-08T17:02:28+00:00" }, { - "name": "wp-cli/shell-command", - "version": "v1.0.5", + "name": "webmozart/path-util", + "version": "2.3.0", "source": { "type": "git", - "url": "https://github.com/wp-cli/shell-command.git", - "reference": "507603a8994d984b6c4d5bd26e31ede6d9cce37e" + "url": "https://github.com/webmozart/path-util.git", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/shell-command/zipball/507603a8994d984b6c4d5bd26e31ede6d9cce37e", - "reference": "507603a8994d984b6c4d5bd26e31ede6d9cce37e", + "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", "shasum": "" }, "require": { - "wp-cli/wp-cli": "*" + "php": ">=5.3.3", + "webmozart/assert": "~1.0" }, "require-dev": { - "behat/behat": "~2.5" + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" }, - "type": "wp-cli-package", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "shell" - ], - "bundled": true + "dev-master": "2.3-dev" + } }, "autoload": { "psr-4": { - "": "src/", - "WP_CLI\\": "src/WP_CLI" - }, - "files": [ - "shell-command.php" - ] + "Webmozart\\PathUtil\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -5247,52 +4657,49 @@ ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], - "description": "Opens an interactive PHP console for running and testing PHP code.", - "homepage": "https://github.com/wp-cli/shell-command", - "time": "2017-12-08T16:03:53+00:00" + "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "support": { + "issues": "https://github.com/webmozart/path-util/issues", + "source": "https://github.com/webmozart/path-util/tree/2.3.0" + }, + "time": "2015-12-17T08:42:14+00:00" }, { - "name": "wp-cli/super-admin-command", - "version": "v1.0.6", + "name": "wp-cli/mustangostang-spyc", + "version": "0.6.3", "source": { "type": "git", - "url": "https://github.com/wp-cli/super-admin-command.git", - "reference": "2982d2e6514dbb318561d72d0577746a3a37181e" + "url": "https://github.com/wp-cli/spyc.git", + "reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/super-admin-command/zipball/2982d2e6514dbb318561d72d0577746a3a37181e", - "reference": "2982d2e6514dbb318561d72d0577746a3a37181e", + "url": "https://api.github.com/repos/wp-cli/spyc/zipball/6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7", + "reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7", "shasum": "" }, + "require": { + "php": ">=5.3.1" + }, "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" + "phpunit/phpunit": "4.3.*@dev" }, - "type": "wp-cli-package", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "super-admin", - "super-admin add", - "super-admin list", - "super-admin remove" - ], - "bundled": true + "dev-master": "0.5.x-dev" + } }, "autoload": { "psr-4": { - "": "src/" + "Mustangostang\\": "src/" }, "files": [ - "super-admin-command.php" + "includes/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -5301,58 +4708,41 @@ ], "authors": [ { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "name": "mustangostang", + "email": "vlad.andersen@gmail.com" } ], - "description": "Lists, adds, or removes super admin users on a multisite installation.", - "homepage": "https://github.com/wp-cli/super-admin-command", - "time": "2017-12-08T17:43:53+00:00" + "description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)", + "homepage": "https://github.com/mustangostang/spyc/", + "support": { + "source": "https://github.com/wp-cli/spyc/tree/autoload" + }, + "time": "2017-04-25T11:26:20+00:00" }, { - "name": "wp-cli/widget-command", - "version": "v1.0.5", + "name": "wp-cli/php-cli-tools", + "version": "v0.11.11", "source": { "type": "git", - "url": "https://github.com/wp-cli/widget-command.git", - "reference": "657e0f77d80c892f8f72f90a3a25112c254386df" + "url": "https://github.com/wp-cli/php-cli-tools.git", + "reference": "fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/widget-command/zipball/657e0f77d80c892f8f72f90a3a25112c254386df", - "reference": "657e0f77d80c892f8f72f90a3a25112c254386df", + "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f", + "reference": "fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f", "shasum": "" }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "widget", - "widget add", - "widget deactivate", - "widget delete", - "widget list", - "widget move", - "widget reset", - "widget update", - "sidebar", - "sidebar list" - ], - "bundled": true + "require": { + "php": ">= 5.3.0" }, + "type": "library", "autoload": { - "psr-4": { - "": "src/" + "psr-0": { + "cli": "lib/" }, "files": [ - "widget-command.php" + "lib/cli/cli.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -5360,173 +4750,104 @@ "MIT" ], "authors": [ + { + "name": "James Logsdon", + "email": "jlogsdon@php.net", + "role": "Developer" + }, { "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" + "email": "daniel@handbuilt.co", + "role": "Maintainer" } ], - "description": "Adds, moves, and removes widgets; lists sidebars.", - "homepage": "https://github.com/wp-cli/widget-command", - "time": "2017-12-08T17:45:57+00:00" + "description": "Console utilities for PHP", + "homepage": "http://github.com/wp-cli/php-cli-tools", + "keywords": [ + "cli", + "console" + ], + "support": { + "issues": "https://github.com/wp-cli/php-cli-tools/issues", + "source": "https://github.com/wp-cli/php-cli-tools/tree/master" + }, + "time": "2018-09-04T13:28:00+00:00" }, { "name": "wp-cli/wp-cli", - "version": "v1.5.1", + "version": "v2.4.1", "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "3aac73bc4d629372531f3e15bbb67945d19b5d5a" + "reference": "ceb18598e79befa9b2a37a51efbb34910628988b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/3aac73bc4d629372531f3e15bbb67945d19b5d5a", - "reference": "3aac73bc4d629372531f3e15bbb67945d19b5d5a", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/ceb18598e79befa9b2a37a51efbb34910628988b", + "reference": "ceb18598e79befa9b2a37a51efbb34910628988b", "shasum": "" }, "require": { - "composer/composer": "^1.2.0", - "composer/semver": "~1.0", - "justinrainbow/json-schema": "~5.2.5", - "mustache/mustache": "~2.4", - "php": ">=5.3.29", - "ramsey/array_column": "~1.1", + "ext-curl": "*", + "mustache/mustache": "~2.13", + "php": "^5.4 || ^7.0", "rmccue/requests": "~1.6", - "symfony/config": "^2.7|^3.0", - "symfony/console": "^2.7|^3.0", - "symfony/debug": "^2.7|^3.0", - "symfony/dependency-injection": "^2.7|^3.0", - "symfony/event-dispatcher": "^2.7|^3.0", - "symfony/filesystem": "^2.7|^3.0", - "symfony/finder": "^2.7|^3.0", - "symfony/process": "^2.1|^3.0", - "symfony/translation": "^2.7|^3.0", - "symfony/yaml": "^2.7|^3.0", - "wp-cli/autoload-splitter": "^0.1.5", - "wp-cli/cache-command": "^1.0", - "wp-cli/checksum-command": "^1.0", - "wp-cli/config-command": "^1.0", - "wp-cli/core-command": "^1.0", - "wp-cli/cron-command": "^1.0", - "wp-cli/db-command": "^1.0", - "wp-cli/embed-command": "^1.0", - "wp-cli/entity-command": "^1.0", - "wp-cli/eval-command": "^1.0", - "wp-cli/export-command": "^1.0", - "wp-cli/extension-command": "^1.0", - "wp-cli/import-command": "^1.0", - "wp-cli/language-command": "^1.0", - "wp-cli/media-command": "^1.0", + "symfony/finder": ">2.7", "wp-cli/mustangostang-spyc": "^0.6.3", - "wp-cli/package-command": "^1.0", - "wp-cli/php-cli-tools": "~0.11.2", - "wp-cli/rewrite-command": "^1.0", - "wp-cli/role-command": "^1.0", - "wp-cli/scaffold-command": "^1.0", - "wp-cli/search-replace-command": "^1.0", - "wp-cli/server-command": "^1.0", - "wp-cli/shell-command": "^1.0", - "wp-cli/super-admin-command": "^1.0", - "wp-cli/widget-command": "^1.0" + "wp-cli/php-cli-tools": "~0.11.2" }, "require-dev": { - "behat/behat": "2.5.*", - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3", - "phpunit/phpunit": "3.7.*", "roave/security-advisories": "dev-master", - "wimg/php-compatibility": "^8.0", - "wp-coding-standards/wpcs": "^0.13.1" + "wp-cli/db-command": "^1.3 || ^2", + "wp-cli/entity-command": "^1.2 || ^2", + "wp-cli/extension-command": "^1.1 || ^2", + "wp-cli/package-command": "^1 || ^2", + "wp-cli/wp-cli-tests": "^2.1" }, "suggest": { - "psy/psysh": "Enhanced `wp shell` functionality" + "ext-readline": "Include for a better --prompt implementation", + "ext-zip": "Needed to support extraction of ZIP archives when doing downloads or updates" }, "bin": [ - "bin/wp.bat", - "bin/wp" + "bin/wp", + "bin/wp.bat" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" - }, - "autoload-splitter": { - "splitter-logic": "WP_CLI\\AutoloadSplitter", - "splitter-location": "php/WP_CLI/AutoloadSplitter.php", - "split-target-prefix-true": "autoload_commands", - "split-target-prefix-false": "autoload_framework" + "dev-master": "2.4.x-dev" } }, "autoload": { "psr-0": { "WP_CLI": "php" - }, - "psr-4": { - "": "php/commands/src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "The command line interface for WordPress", + "description": "WP-CLI framework", "homepage": "https://wp-cli.org", "keywords": [ "cli", "wordpress" ], - "time": "2018-05-31T11:04:05+00:00" - }, - { - "name": "wp-cli/wp-config-transformer", - "version": "v1.2.8", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/wp-config-transformer.git", - "reference": "0bb2b9162c38ca72370380aea11dc06e431e13a5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-config-transformer/zipball/0bb2b9162c38ca72370380aea11dc06e431e13a5", - "reference": "0bb2b9162c38ca72370380aea11dc06e431e13a5", - "shasum": "" - }, - "require": { - "php": ">=5.3.29" + "support": { + "docs": "https://make.wordpress.org/cli/handbook/", + "issues": "https://github.com/wp-cli/wp-cli/issues", + "source": "https://github.com/wp-cli/wp-cli" }, - "require-dev": { - "composer/composer": ">=1.5.6 <1.7.0 || ^1.7.1 || ^2.0.0", - "phpunit/phpunit": "^6.5.5 || ^7.0.0", - "wp-coding-standards/wpcs": "^0.14.0 || ^1.0.0 || ^2.0.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/WPConfigTransformer.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frankie Jarrett", - "email": "fjarrett@gmail.com" - } - ], - "description": "Programmatically edit a wp-config.php file.", - "time": "2020-11-12T08:08:10+00:00" + "time": "2020-02-18T08:15:37+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "humbug/humbug": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.4" + "php": ">=7.3" }, "platform-dev": [], "plugin-api-version": "1.1.0" diff --git a/humbug.json.dist b/humbug.json.dist deleted file mode 100644 index 76661e07..00000000 --- a/humbug.json.dist +++ /dev/null @@ -1,30 +0,0 @@ -{ - "timeout": 20, - "source": { - "directories": [ - "src/Access", - "src/Cache", - "src/Command", - "src/Config", - "src/Controller", - "src/Database", - "src/File", - "src/Form", - "src/Object", - "src/ObjectMembership", - "src/Setup", - "src/User", - "src/UserGroup", - "src/Util", - "src/Widget" - ], - "excludes": [ - "vendor", - "tests" - ] - }, - "logs": { - "text": "humbuglog.txt", - "json": "humbuglog.json" - } -} \ No newline at end of file diff --git a/includes/language.php b/includes/language.php index 84a159b8..99f01c5a 100644 --- a/includes/language.php +++ b/includes/language.php @@ -14,7 +14,7 @@ */ // --- Error Messages --- -define('TXT_UAM_PHP_VERSION_TO_LOW', __('Sorry you need at least PHP version 5.4 to use the User Access Manager. Your current PHP version is %s. See https://github.com/GM-Alex/user-access-manager/wiki/Troubleshoot for more information.', 'user-access-manager')); +define('TXT_UAM_PHP_VERSION_TO_LOW', __('Sorry you need at least PHP version 7.3 to use the User Access Manager. Your current PHP version is %s. See https://github.com/GM-Alex/user-access-manager/wiki/Troubleshoot for more information.', 'user-access-manager')); define('TXT_UAM_WORDPRESS_VERSION_TO_LOW', __('Sorry you need at least Wordpress version 3.0 to use the User Access Manager. Your current Wordpress version is %s.', 'user-access-manager')); /** @noinspection HtmlUnknownTarget */ define('TXT_UAM_NEED_DATABASE_UPDATE', __('Please update the database of the User Access Manager. Click here to proceed', 'user-access-manager')); diff --git a/infection.json.dist b/infection.json.dist new file mode 100644 index 00000000..306a3ac0 --- /dev/null +++ b/infection.json.dist @@ -0,0 +1,90 @@ +{ + "timeout": 60, + "source": { + "directories": [ + "src/Access", + "src/Cache", + "src/Command", + "src/Config", + "src/Controller", + "src/Database", + "src/File", + "src/Form", + "src/Object", + "src/ObjectMembership", + "src/Setup", + "src/User", + "src/UserGroup", + "src/Util", + "src/Widget" + ], + "excludes": [ + "vendor", + "tests" + ] + }, + "testFramework": "phpunit", + "bootstrap": "./tests/bootstrap.php", + "logs": { + "text": "infection.txt", + "json": "infection.json" + }, + "mutators": { + "@default": true, + "@cast": false, + "@function_signature": false, + "MethodCallRemoval": { + "ignore": [ + "UserAccessManager\\Command\\GroupCommand::__construct", + "UserAccessManager\\Command\\ObjectCommand::__construct" + ] + }, + "UnwrapRtrim": { + "ignore": [ + "UserAccessManager\\Controller\\Backend\\AboutController::getAllSupporters" + ] + }, + "IncrementInteger": { + "ignore": [ + "UserAccessManager\\Controller\\Backend\\ObjectController::sortUserGroups" + ] + }, + "DecrementInteger": { + "ignore": [ + "UserAccessManager\\Controller\\Backend\\ObjectController::sortUserGroups" + ] + }, + "UnwrapUcFirst": { + "ignore": [ + "UserAccessManager\\Controller\\Backend\\UserGroupController::getUserGroups" + ] + }, + "FunctionCallRemoval": { + "ignore": [ + "UserAccessManager\\Controller\\BaseControllerTrait::getIncludeContents" + ] + }, + "UnwrapArrayMap": { + "ignore": [ + "UserAccessManager\\Controller\\Controller::processAction" + ] + }, + "UnwrapStrReplace": { + "ignore": [ + "UserAccessManager\\Controller\\Frontend\\RedirectController::getFileSettingsByType" + ] + }, + "ConcatOperandRemoval": { + "ignore": [ + "UserAccessManager\\Controller\\Frontend\\RedirectController::getFileSettingsByType" + ] + }, + "UnwrapLtrim": { + "ignore": [ + "UserAccessManager\\Controller\\Frontend\\RedirectController::getFileSettingsByType" + ] + } + }, + "minMsi": 98, + "minCoveredMsi": 98 +} \ No newline at end of file diff --git a/package.json b/package.json index 7dec4f85..375438c2 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "user-access-manager", - "version": "2.1.13", + "version": "2.2.0", "description": "[![Build Status](https://travis-ci.org/GM-Alex/user-access-manager.svg)](https://travis-ci.org/GM-Alex/user-access-manager)", "main": "index.js", "directories": { "test": "tests" }, "dependencies": { - "grunt": "^0.4.5", + "grunt": "^1.3.0", "grunt-pot": "^0.3.0" }, "devDependencies": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 52638688..65bbc865 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,27 +1,23 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.5/phpunit.xsd" + bootstrap="./tests/bootstrap.php" + colors="true"> ./tests - - - ./tests - - + + ./src - - ./src/View - ./src/Wrapper - - - - - - - + + + ./src/View + ./src/Wrapper + + + + + diff --git a/readme.txt b/readme.txt index d254ac45..da0610d8 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i Tags: admin, access, member area, members, member, member access, page, pages, post, posts, private, privacy, restrict, user, user access manager, user management Requires at least: 4.7 Tested up to: 5.6 -Stable tag: 2.1.13 +Stable tag: 2.2.0 With the "User Access Manager"-plugin you can manage the access to your posts, pages and files. @@ -59,7 +59,8 @@ Here you found the changes in each version. Version Date Changes - 2.1.13 2021/01/26 Fix possible update bug. + 2.2.0 2021/02/11 Improve and update code base. + Fix possible update bug. 2.1.12 2019/01/08 Fix multi site file handling issue. #222 diff --git a/scripts/build.sh b/scripts/build.sh index caac6bee..9feae04d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -20,7 +20,7 @@ fi npm install ${PLUGIN_ROOT}/node_modules/grunt-cli/bin/grunt -EXCLUDES="${EXCLUDES}.gitkeep,README.md,.travis.yml,builds,phpunit.xml.dist,humbug.json.dist,tests,scripts,package.json,Gruntfile.js" +EXCLUDES="${EXCLUDES}.gitkeep,README.md,.github,builds,phpunit.xml.dist,infection.json.dist,tests,scripts,package.json,Gruntfile.js" eval "rsync -av ${PLUGIN_ROOT}/* ${PLUGIN_BUILDS_PATH} --exclude={${EXCLUDES}}" composer --working-dir="${PLUGIN_BUILDS_PATH}" install --no-dev \ No newline at end of file diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 25f724fb..112ac572 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,16 +1,20 @@ #!/usr/bin/env bash -if [[ -z "${TRAVIS}" ]]; then - echo "Script is only to be run by Travis CI" 1>&2 +if [[ -z "${1}" ]]; then + echo "WordPress.org password not set" 1>&2 exit 1 fi -if [[ -z "${WP_ORG_PASSWORD}" ]]; then - echo "WordPress.org password not set" 1>&2 +WP_ORG_PASSWORD=${1} + +if [[ -z "${GITHUB_REF}" ]]; then + echo "Script is only to be run by github action" 1>&2 exit 1 fi -if [[ -z "${TRAVIS_TAG}" ]]; then +CURRENT_TAG=${GITHUB_REF##*/} + +if [[ -z "${CURRENT_TAG}" ]]; then echo "Build must be a tag" 1>&2 exit 0 fi @@ -40,8 +44,8 @@ else exit 1 fi -if [[ ${VERSION} != ${TRAVIS_TAG} ]]; then - echo "Tag ${TRAVIS_TAG} version must match plugin version ${VERSION}." +if [[ ${VERSION} != ${CURRENT_TAG} ]]; then + echo "Tag ${CURRENT_TAG} version must match plugin version ${VERSION}." exit 1 fi @@ -70,7 +74,6 @@ mkdir svn/trunk rsync -r -p ${PLUGIN}/* svn/trunk # Copy all the .svn folders from the checked out copy of trunk to the new trunk. -# This is necessary as the Travis container runs Subversion 1.6 which has .svn dirs in every sub dir cd svn/trunk/ TARGET=$(pwd) cd ../../svn-trunk/ diff --git a/scripts/humbug.sh b/scripts/humbug.sh deleted file mode 100755 index 8524136c..00000000 --- a/scripts/humbug.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -e -PLUGIN_ROOT="$(cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd)" - -echo "Execute humbug" -${PLUGIN_ROOT}/vendor/bin/humbug -HUMBUG_REPORT_FILE=$(cat ${PLUGIN_ROOT}/humbuglog.json) -REGEX='.*"total":[ ]*([0-9]+).*"kills":[ ]*([0-9]+).*' - -if [[ ! ${HUMBUG_REPORT_FILE} =~ ${REGEX} ]] || [[ $((${BASH_REMATCH[1]} - ${BASH_REMATCH[2]})) > 0 ]]; then - echo "Humbug mutation tests failed" - exit 1 -fi \ No newline at end of file diff --git a/scripts/phpunit.sh b/scripts/phpunit.sh deleted file mode 100755 index f59bee85..00000000 --- a/scripts/phpunit.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -set -e -PLUGIN_ROOT="$(cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd)" - -echo "Execute phpunit" -${PLUGIN_ROOT}/vendor/bin/phpunit --coverage-clover=coverage.clover -wget https://scrutinizer-ci.com/ocular.phar -php ocular.phar code-coverage:upload --format=php-clover coverage.clover -rm ocular.phar \ No newline at end of file diff --git a/src/Access/AccessHandler.php b/src/Access/AccessHandler.php index ec3b5d5b..deab2848 100644 --- a/src/Access/AccessHandler.php +++ b/src/Access/AccessHandler.php @@ -12,19 +12,23 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Access; +use Exception; use UserAccessManager\Config\MainConfig; use UserAccessManager\Database\Database; use UserAccessManager\Object\ObjectHandler; -use UserAccessManager\UserGroup\AbstractUserGroup; use UserAccessManager\User\UserHandler; +use UserAccessManager\UserGroup\AbstractUserGroup; use UserAccessManager\UserGroup\UserGroupHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Wrapper\Wordpress; /** * Class AccessHandler - * * @package UserAccessManager\AccessHandler */ class AccessHandler @@ -81,12 +85,11 @@ class AccessHandler /** * AccessHandler constructor. - * - * @param Wordpress $wordpress - * @param MainConfig $mainConfig - * @param Database $database - * @param ObjectHandler $objectHandler - * @param UserHandler $userHandler + * @param Wordpress $wordpress + * @param MainConfig $mainConfig + * @param Database $database + * @param ObjectHandler $objectHandler + * @param UserHandler $userHandler * @param UserGroupHandler $userGroupHandler */ public function __construct( @@ -107,20 +110,18 @@ public function __construct( /** * Checks it the user has access because he is the author. - * * @param string $objectType - * @param string $objectId - * + * @param int|string $objectId * @return bool */ - private function hasAuthorAccess($objectType, $objectId) + private function hasAuthorAccess(string $objectType, $objectId): bool { if ($this->mainConfig->authorsHasAccessToOwn() === true && $this->objectHandler->isPostType($objectType) ) { - $currentUser = $this->wordpress->getCurrentUser(); $post = $this->objectHandler->getPost($objectId); - return ($post !== false && $currentUser->ID === (int)$post->post_author); + return $post !== false + && $this->wordpress->getCurrentUser()->ID === (int) $post->post_author; } return false; @@ -128,24 +129,21 @@ private function hasAuthorAccess($objectType, $objectId) /** * Checks if the is admin value is set if not grabs it from the wordpress function. - * * @param null|bool $isAdmin - * * @return bool */ - private function isAdmin($isAdmin) + private function isAdmin(?bool $isAdmin): bool { return ($isAdmin === null) ? $this->wordpress->isAdmin() : $isAdmin; } /** * Returns the user user groups filtered by the write access. - * * @param null|bool $isAdmin If set we force the admin mode. - * * @return AbstractUserGroup[] + * @throws UserGroupTypeException */ - private function getUserUserGroupsForObjectAccess($isAdmin = null) + private function getUserUserGroupsForObjectAccess($isAdmin = null): array { $userUserGroups = $this->userGroupHandler->getUserGroupsForUser(); @@ -163,19 +161,18 @@ function (AbstractUserGroup $userGroup) { /** * Checks if the current_user has access to the given post. - * - * @param string $objectType The object type which should be checked. - * @param int $objectId The id of the object. - * @param null|bool $isAdmin If set we force the admin mode. - * + * @param string|null $objectType The object type which should be checked. + * @param int|string $objectId The id of the object. + * @param null|bool $isAdmin If set we force the admin mode. * @return bool + * @throws UserGroupTypeException + * @throws Exception */ - public function checkObjectAccess($objectType, $objectId, $isAdmin = null) + public function checkObjectAccess(?string $objectType, $objectId, $isAdmin = null): bool { $isAdmin = $this->isAdmin($isAdmin); - $admin = $isAdmin === true ? 'admin' : 'noAdmin'; - if (isset($this->objectAccess[$admin][$objectType][$objectId]) === false) { + if (isset($this->objectAccess[$isAdmin][$objectType][$objectId]) === false) { if ($this->objectHandler->isValidObjectType($objectType) === false || $this->userHandler->checkUserAccess(UserHandler::MANAGE_USER_GROUPS_CAPABILITY) === true || $this->hasAuthorAccess($objectType, $objectId) === true @@ -187,21 +184,21 @@ public function checkObjectAccess($objectType, $objectId, $isAdmin = null) || array_intersect_key($membership, $this->getUserUserGroupsForObjectAccess($isAdmin)) !== []; } - $this->objectAccess[$admin][$objectType][$objectId] = $access; + $this->objectAccess[$isAdmin][$objectType][$objectId] = $access; } - return $this->objectAccess[$admin][$objectType][$objectId]; + return $this->objectAccess[$isAdmin][$objectType][$objectId]; } /** * Returns the excluded objects. - * * @param string $type - * @param array $filterTypesMap - * + * @param array $filterTypesMap * @return array + * @throws UserGroupTypeException + * @throws Exception */ - private function getExcludedObjects($type, array $filterTypesMap = []) + private function getExcludedObjects(string $type, array $filterTypesMap = []): array { $excludedObjects = []; $userGroups = $this->userGroupHandler->getFullUserGroups(); @@ -231,10 +228,10 @@ function ($element) use ($filterTypesMap) { /** * Returns the excluded terms for a user. - * * @return array + * @throws UserGroupTypeException */ - public function getExcludedTerms() + public function getExcludedTerms(): ?array { if ($this->userHandler->checkUserAccess(UserHandler::MANAGE_USER_GROUPS_CAPABILITY)) { $this->excludedTerms = []; @@ -249,10 +246,9 @@ public function getExcludedTerms() /** * Returns the none hidden post types map. - * * @return array */ - private function getNoneHiddenPostTypes() + private function getNoneHiddenPostTypes(): ?array { if ($this->noneHiddenPostTypes === null) { $this->noneHiddenPostTypes = []; @@ -273,10 +269,10 @@ private function getNoneHiddenPostTypes() /** * Returns the excluded posts. - * * @return array + * @throws UserGroupTypeException */ - public function getExcludedPosts() + public function getExcludedPosts(): ?array { if ($this->userHandler->checkUserAccess(UserHandler::MANAGE_USER_GROUPS_CAPABILITY)) { $this->excludedPosts = []; @@ -288,13 +284,17 @@ public function getExcludedPosts() if ($this->mainConfig->authorsHasAccessToOwn() === true) { $query = $this->database->prepare( - "SELECT ID - FROM {$this->database->getPostsTable()} + "SELECT ID FROM {$this->database->getPostsTable()} WHERE post_author = %d", $this->wordpress->getCurrentUser()->ID ); - $ownPosts = (array)$this->database->getResults($query); + $ownPosts = array_filter( + (array) $this->database->getResults($query), + function ($ownPost) { + return isset($ownPost->ID); + } + ); $ownPostIds = []; foreach ($ownPosts as $ownPost) { diff --git a/src/Cache/Cache.php b/src/Cache/Cache.php index c9252b1c..e3ddc671 100644 --- a/src/Cache/Cache.php +++ b/src/Cache/Cache.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Cache; use UserAccessManager\Wrapper\Wordpress; @@ -50,8 +53,7 @@ class Cache /** * Cache constructor. - * - * @param Wordpress $wordpress + * @param Wordpress $wordpress * @param CacheProviderFactory $cacheProviderFactory */ public function __construct(Wordpress $wordpress, CacheProviderFactory $cacheProviderFactory) @@ -60,12 +62,20 @@ public function __construct(Wordpress $wordpress, CacheProviderFactory $cachePro $this->cacheProviderFactory = $cacheProviderFactory; } + /** + * Return the cache provider. + * @return CacheProviderInterface|null + */ + public function getCacheProvider(): ?CacheProviderInterface + { + return $this->cacheProvider; + } + /** * Sets a cache provider - * - * @param string $key + * @param null|string $key */ - public function setActiveCacheProvider($key) + public function setActiveCacheProvider(?string $key) { $cacheProviders = $this->getRegisteredCacheProviders(); @@ -78,10 +88,9 @@ public function setActiveCacheProvider($key) /** * Returns a generated cache key. - * * @return string */ - public function generateCacheKey() + public function generateCacheKey(): string { $arguments = func_get_args(); @@ -90,11 +99,10 @@ public function generateCacheKey() /** * Adds the variable to the cache. - * - * @param string $key The cache key - * @param mixed $value The value. + * @param string $key The cache key + * @param mixed $value The value. */ - public function add($key, $value) + public function add(string $key, $value) { if ($this->cacheProvider !== null) { $this->cacheProvider->add($key, $value); @@ -105,12 +113,10 @@ public function add($key, $value) /** * Returns a value from the cache by the given key. - * * @param string $key - * * @return mixed */ - public function get($key) + public function get(string $key) { if (isset($this->cache[$key]) === false) { $this->cache[$key] = ($this->cacheProvider !== null) ? $this->cacheProvider->get($key) : null; @@ -121,10 +127,9 @@ public function get($key) /** * Invalidates the cached object. - * * @param string $key */ - public function invalidate($key) + public function invalidate(string $key) { if ($this->cacheProvider !== null) { $this->cacheProvider->invalidate($key); @@ -135,23 +140,20 @@ public function invalidate($key) /** * Adds the variable to the runtime cache. - * - * @param string $key The cache key - * @param mixed $value The value. + * @param string $key The cache key + * @param mixed $value The value. */ - public function addToRuntimeCache($key, $value) + public function addToRuntimeCache(string $key, $value) { $this->runtimeCache[$key] = $value; } /** * Returns a value from the runtime cache by the given key. - * * @param string $key - * * @return mixed */ - public function getFromRuntimeCache($key) + public function getFromRuntimeCache(string $key) { if (isset($this->runtimeCache[$key]) === true) { return $this->runtimeCache[$key]; @@ -171,10 +173,9 @@ public function flushCache() /** * Returns a list of the registered cache handlers. - * * @return CacheProviderInterface[] */ - public function getRegisteredCacheProviders() + public function getRegisteredCacheProviders(): array { $fileSystemCacheProvider = $this->cacheProviderFactory->createFileSystemCacheProvider(); diff --git a/src/Cache/CacheProviderFactory.php b/src/Cache/CacheProviderFactory.php index 467dafe5..cd061a5f 100644 --- a/src/Cache/CacheProviderFactory.php +++ b/src/Cache/CacheProviderFactory.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Cache; use UserAccessManager\Config\ConfigFactory; @@ -54,11 +57,10 @@ class CacheProviderFactory /** * CacheProviderFactory constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param Util $util - * @param ConfigFactory $configFactory + * @param Php $php + * @param Wordpress $wordpress + * @param Util $util + * @param ConfigFactory $configFactory * @param ConfigParameterFactory $configParameterFactory */ public function __construct( @@ -77,10 +79,9 @@ public function __construct( /** * Creates a FileSystemCacheProvider object. - * * @return FileSystemCacheProvider */ - public function createFileSystemCacheProvider() + public function createFileSystemCacheProvider(): FileSystemCacheProvider { return new FileSystemCacheProvider( $this->php, diff --git a/src/Cache/CacheProviderInterface.php b/src/Cache/CacheProviderInterface.php index 21350626..5d8a3298 100644 --- a/src/Cache/CacheProviderInterface.php +++ b/src/Cache/CacheProviderInterface.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Cache; use UserAccessManager\Config\Config; @@ -25,10 +28,9 @@ interface CacheProviderInterface { /** * Returns the id of the cache provider. - * * @return string */ - public function getId(); + public function getId(): string; /** * Initialises the cache provider object. @@ -37,32 +39,27 @@ public function init(); /** * Returns the cache provider configuration. - * * @return Config */ - public function getConfig(); + public function getConfig(): Config; /** * Adds a value to the cache. - * * @param string $key - * @param mixed $value + * @param mixed $value */ - public function add($key, $value); + public function add(string $key, $value); /** * Returns a value from the cache. - * * @param string $key - * * @return mixed */ - public function get($key); + public function get(string $key); /** * Invalidates the cache. - * * @param string $key */ - public function invalidate($key); + public function invalidate(string $key); } diff --git a/src/Cache/FileSystemCacheProvider.php b/src/Cache/FileSystemCacheProvider.php index 2e6766d1..bb56f16c 100644 --- a/src/Cache/FileSystemCacheProvider.php +++ b/src/Cache/FileSystemCacheProvider.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Cache; +use Exception; use UserAccessManager\Config\Config; use UserAccessManager\Config\ConfigFactory; use UserAccessManager\Config\ConfigParameterFactory; @@ -74,11 +78,10 @@ class FileSystemCacheProvider implements CacheProviderInterface /** * FileSystemCacheProvider constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param Util $util - * @param ConfigFactory $configFactory + * @param Php $php + * @param Wordpress $wordpress + * @param Util $util + * @param ConfigFactory $configFactory * @param ConfigParameterFactory $configParameterFactory */ public function __construct( @@ -94,23 +97,22 @@ public function __construct( $this->configFactory = $configFactory; $this->configParameterFactory = $configParameterFactory; } - + /** * Returns the id. - * * @return string */ - public function getId() + public function getId(): string { return self::ID; } /** * Returns the cache path. - * * @return string + * @throws Exception */ - private function getPath() + private function getPath(): string { if ($this->path === null) { $this->path = $this->getConfig()->getParameterValue(self::CONFIG_PATH); @@ -125,6 +127,7 @@ private function getPath() /** * Initialise the caching path. + * @throws Exception */ public function init() { @@ -134,7 +137,7 @@ public function init() $this->php->mkdir($path, 0775, true); } - $htaccessFile = $path.'.htaccess'; + $htaccessFile = $path . '.htaccess'; if (file_exists($htaccessFile) === false) { file_put_contents($htaccessFile, 'Deny from all'); @@ -143,10 +146,10 @@ public function init() /** * Returns the cache config. - * * @return Config + * @throws Exception */ - public function getConfig() + public function getConfig(): Config { if ($this->config === null) { $this->config = $this->configFactory->createConfig(self::CONFIG_KEY); @@ -164,7 +167,7 @@ public function getConfig() $configParameters = [ self::CONFIG_PATH => $this->configParameterFactory->createStringConfigParameter( self::CONFIG_PATH, - $this->wordpress->getHomePath().'cache/uam' + $this->wordpress->getHomePath() . 'cache/uam' ), self::CONFIG_METHOD => $this->configParameterFactory->createSelectionConfigParameter( self::CONFIG_METHOD, @@ -180,12 +183,12 @@ public function getConfig() /** * Returns the caching method. - * * @return string|null + * @throws Exception */ - private function getCacheMethod() + private function getCacheMethod(): ?string { - $method = (string)$this->getConfig()->getParameterValue(self::CONFIG_METHOD); + $method = (string) $this->getConfig()->getParameterValue(self::CONFIG_METHOD); if ($method === self::METHOD_IGBINARY && ($this->php->functionExists('igbinary_serialize') === false @@ -199,15 +202,14 @@ private function getCacheMethod() /** * Returns the cache file name with path. - * - * @param string $method + * @param string|null $method * @param string $key - * * @return string + * @throws Exception */ - private function getCacheFile($method, $key) + private function getCacheFile(?string $method, string $key): string { - $cacheFile = $this->getPath().$key; + $cacheFile = $this->getPath() . $key; $cacheFile .= ($method === self::METHOD_VAR_EXPORT) ? '.php' : '.cache'; return $cacheFile; @@ -215,11 +217,11 @@ private function getCacheFile($method, $key) /** * Adds a value to the cache. - * * @param string $key - * @param mixed $value + * @param mixed $value + * @throws Exception */ - public function add($key, $value) + public function add(string $key, $value) { $method = $this->getCacheMethod(); $cacheFile = $this->getCacheFile($method, $key); @@ -232,18 +234,21 @@ public function add($key, $value) } elseif ($method === self::METHOD_JSON) { $this->php->filePutContents($cacheFile, json_encode($value), LOCK_EX); } elseif ($method === self::METHOD_VAR_EXPORT) { - $this->php->filePutContents($cacheFile, "php->filePutContents( + $cacheFile, + "getCacheMethod(); $cacheFile = $this->getCacheFile($method, $key); @@ -269,10 +274,10 @@ public function get($key) /** * Invalidates the cache. - * * @param string $key + * @throws Exception */ - public function invalidate($key) + public function invalidate(string $key) { $method = $this->getCacheMethod(); $cacheFile = $this->getCacheFile($method, $key); diff --git a/src/Command/GroupCommand.php b/src/Command/GroupCommand.php index 6bbdf119..b0f8c6b9 100644 --- a/src/Command/GroupCommand.php +++ b/src/Command/GroupCommand.php @@ -13,21 +13,29 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + + namespace UserAccessManager\Command; +use Exception; use UserAccessManager\Object\ObjectHandler; +use UserAccessManager\UserGroup\UserGroup; use UserAccessManager\UserGroup\UserGroupFactory; use UserAccessManager\UserGroup\UserGroupHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Wrapper\WordpressCli; -use WP_CLI\CommandWithDBObject; use WP_CLI\ExitException; +use WP_CLI\Formatter; +use WP_CLI_Command; /** * Class GroupCommand * * @package UserAccessManager\Command */ -class GroupCommand extends CommandWithDBObject +class GroupCommand extends WP_CLI_Command { const FORMATTER_PREFIX = 'uam_user_groups'; @@ -53,8 +61,7 @@ class GroupCommand extends CommandWithDBObject /** * ObjectCommand constructor. - * - * @param WordpressCli $wordpressCli + * @param WordpressCli $wordpressCli * @param UserGroupHandler $userGroupHandler * @param UserGroupFactory $userGroupFactory */ @@ -66,16 +73,15 @@ public function __construct( $this->wordpressCli = $wordpressCli; $this->userGroupHandler = $userGroupHandler; $this->userGroupFactory = $userGroupFactory; + parent::__construct(); } /** * Returns the formatter - * * @param $assocArguments - * - * @return \WP_CLI\Formatter + * @return Formatter */ - private function getFormatter(&$assocArguments) + private function getFormatter(&$assocArguments): Formatter { return $this->wordpressCli->createFormatter( $assocArguments, @@ -94,22 +100,17 @@ private function getFormatter(&$assocArguments) /** * list groups - * * ## OPTIONS - * * [--format=] * : Accepted values: table, csv, json, count, ids. Default: table - * * ## EXAMPLES - * * wp uam groups list - * * @subcommand ls - * * @param array $arguments * @param array $assocArguments - * * @throws ExitException + * @throws UserGroupTypeException + * @throws Exception */ public function ls(array $arguments, array $assocArguments) { @@ -148,20 +149,15 @@ public function ls(array $arguments, array $assocArguments) /** * delete groups - * * ## OPTIONS * * : id of the group(s) to delete; accepts unlimited ids - * * ## EXAMPLES - * * wp uam groups del 3 5 - * * @subcommand del - * * @param array $arguments - * * @throws ExitException + * @throws UserGroupTypeException */ public function del(array $arguments) { @@ -181,14 +177,12 @@ public function del(array $arguments) /** * Checks if the user group already exists. - * * @param $userGroupName - * * @return bool - * * @throws ExitException + * @throws UserGroupTypeException */ - private function doesUserGroupExists($userGroupName) + private function doesUserGroupExists($userGroupName): bool { $userGroups = $this->userGroupHandler->getUserGroups(); @@ -207,33 +201,29 @@ private function doesUserGroupExists($userGroupName) /** * Returns the argument value. - * - * @param array $arguments + * @param array $arguments * @param string $value - * * @return string */ - private function getArgumentValue(array $arguments, $value) + private function getArgumentValue(array $arguments, string $value): string { - return (isset($arguments[$value]) === true) ? (string)$arguments[$value] : ''; + return (isset($arguments[$value]) === true) ? (string) $arguments[$value] : ''; } /** * Processes the access value. - * - * @param array $arguments + * @param array $arguments * @param string $value - * @param bool $porcelain - * + * @param bool $porcelain * @return string */ - private function getAccessValue(array $arguments, $value, $porcelain) + private function getAccessValue(array $arguments, string $value, bool $porcelain): string { $accessValue = $this->getArgumentValue($arguments, $value); if (in_array($accessValue, self::$allowedAccessValues) === false) { if ($porcelain === true) { - $this->wordpressCli->line("setting {$value} to ".self::$allowedAccessValues[0]); + $this->wordpressCli->line("setting {$value} to " . self::$allowedAccessValues[0]); } $accessValue = self::$allowedAccessValues[0]; @@ -244,13 +234,13 @@ private function getAccessValue(array $arguments, $value, $porcelain) /** * Creates the user group. - * * @param string $userGroupName - * @param array $assocArguments - * - * @return \UserAccessManager\UserGroup\UserGroup + * @param array $assocArguments + * @return UserGroup + * @throws UserGroupTypeException + * @throws Exception */ - private function createUserGroup($userGroupName, array $assocArguments) + private function createUserGroup(string $userGroupName, array $assocArguments): UserGroup { $groupDescription = $this->getArgumentValue($assocArguments, 'desc'); $ipRange = $this->getArgumentValue($assocArguments, 'ip_range'); @@ -283,17 +273,13 @@ private function createUserGroup($userGroupName, array $assocArguments) /** * add group - * * ## OPTIONS * * : the name of the new group - * * [--porcelain] * : Output just the new post id. - * * [--roles=] * : comma separated list of group associated roles - * * [--=] * : Associative args for new UamUserGroup object * allowed fields and values are: @@ -301,17 +287,13 @@ private function createUserGroup($userGroupName, array $assocArguments) * read_access={group,all*}, * write_access={group,all*}, * ip_range="192.168.0.1-192.168.0.10;192.168.0.20-192.168.0.30" - * * *=default - * * ## EXAMPLES - * * wp uam groups add fighters --read_access=all - * * @param array $arguments * @param array $assocArguments - * * @throws ExitException + * @throws UserGroupTypeException */ public function add(array $arguments, array $assocArguments) { diff --git a/src/Command/ObjectCommand.php b/src/Command/ObjectCommand.php index 008c35f0..52849e3d 100644 --- a/src/Command/ObjectCommand.php +++ b/src/Command/ObjectCommand.php @@ -13,20 +13,26 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Command; +use Exception; use UserAccessManager\UserGroup\AbstractUserGroup; use UserAccessManager\UserGroup\UserGroup; use UserAccessManager\UserGroup\UserGroupHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Wrapper\WordpressCli; use WP_CLI\ExitException; +use WP_CLI_Command; /** * Class ObjectCommand * * @package UserAccessManager\Command */ -class ObjectCommand extends \WP_CLI_Command +class ObjectCommand extends WP_CLI_Command { const ACTION_ADD = 'add'; const ACTION_UPDATE = 'update'; @@ -44,24 +50,22 @@ class ObjectCommand extends \WP_CLI_Command /** * ObjectCommand constructor. - * - * @param WordpressCli $wordpressCli + * @param WordpressCli $wordpressCli * @param UserGroupHandler $userGroupHandler */ public function __construct(WordpressCli $wordpressCli, UserGroupHandler $userGroupHandler) { $this->wordpressCli = $wordpressCli; $this->userGroupHandler = $userGroupHandler; + parent::__construct(); } /** * Converts the string to and associative array of index and group - * * @param AbstractUserGroup[] $userGroups - * * @return array */ - private function getUserGroupNameMap(array $userGroups) + private function getUserGroupNameMap(array $userGroups): array { $userGroupNames = array_map( function (UserGroup $userGroup) { @@ -70,24 +74,18 @@ function (UserGroup $userGroup) { $userGroups ); - foreach ($userGroups as $userGroup) { - $userGroupNames[$userGroup->getId()] = $userGroup->getName(); - } - $userGroupNames = array_flip($userGroupNames); return (is_array($userGroupNames) === true) ? $userGroupNames : []; } /** * Returns the user group id and the type of the id. - * - * @param array $namesMap + * @param array $namesMap * @param string $identifier - * @param string $type - * - * @return mixed + * @param string|null $type + * @return int|string */ - private function getUserGroupIdAndType(array $namesMap, $identifier, &$type) + private function getUserGroupIdAndType(array $namesMap, string $identifier, ?string &$type = '') { $type = (is_numeric($identifier) === true) ? 'id' : 'name'; return isset($namesMap[$identifier]) ? $namesMap[$identifier] : $identifier; @@ -95,30 +93,27 @@ private function getUserGroupIdAndType(array $namesMap, $identifier, &$type) /** * Returns the add and remove user groups by reference. - * - * @param string $operation - * @param string $objectType - * @param string $objectId - * @param string $userGroupsArgument + * @param string $operation + * @param string $objectType + * @param int|string $objectId + * @param array $userGroupIds * @param AbstractUserGroup[] $userGroups - * @param array $addUserGroups - * @param array $removeUserGroups - * + * @param array|null $addUserGroups + * @param array|null $removeUserGroups * @return bool - * * @throws ExitException + * @throws UserGroupTypeException */ private function getAddRemoveUserGroups( - $operation, - $objectType, + string $operation, + string $objectType, $objectId, - $userGroupsArgument, + array $userGroupIds, array $userGroups, - &$addUserGroups, - &$removeUserGroups - ) { + ?array &$addUserGroups = [], + ?array &$removeUserGroups = [] + ): bool { $addUserGroups = []; - $userGroupIds = array_unique(explode(',', $userGroupsArgument)); $namesMap = $this->getUserGroupNameMap($userGroups); // find the UserGroup object for the ids or strings given on the commandline @@ -146,31 +141,24 @@ private function getAddRemoveUserGroups( /** * update groups for an object - * * ## OPTIONS - * * * : 'add', 'remove' or 'update' - * * * : 'page', 'post', 'user', 'role', 'category' or any other term type - * * * : the id of the object (string for role) - * * * : comma separated list of group names or ids to add, remove of update to for the object - * * ## EXAMPLES - * * wp uam object add user 1 fighters,losers * wp uam object remove role author fighters * wp uam object update category 5 controller - * * @param array $arguments * @param array $assocArguments - * * @throws ExitException + * @throws UserGroupTypeException + * @throws Exception */ public function __invoke(array $arguments, array $assocArguments) { @@ -194,14 +182,14 @@ public function __invoke(array $arguments, array $assocArguments) $objectType = $arguments[1]; $objectId = $arguments[2]; - $userGroupsArgument = $arguments[3]; + $userGroupIds = array_unique(explode(',', $arguments[3])); $userGroups = $this->userGroupHandler->getUserGroups(); $success = $this->getAddRemoveUserGroups( $operation, $objectType, $objectId, - $userGroupsArgument, + $userGroupIds, $userGroups, $addUserGroups, $removeUserGroups @@ -223,6 +211,8 @@ public function __invoke(array $arguments, array $assocArguments) $userGroup->save(); } - $this->wordpressCli->success(sprintf($messages[$operation], $userGroupsArgument, $objectType, $objectId)); + $this->wordpressCli->success( + sprintf($messages[$operation], implode(', ', $userGroupIds), $objectType, $objectId) + ); } } diff --git a/src/Config/BooleanConfigParameter.php b/src/Config/BooleanConfigParameter.php index f472d1c9..7f3853f4 100644 --- a/src/Config/BooleanConfigParameter.php +++ b/src/Config/BooleanConfigParameter.php @@ -12,8 +12,13 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Config; +use Exception; + /** * Class BooleanConfigParameter * @package UserAccessManager\Config @@ -22,23 +27,19 @@ class BooleanConfigParameter extends ConfigParameter { /** * BooleanConfigParameter constructor. - * * @param string $id - * @param bool $defaultValue - * - * @throws \Exception + * @param bool $defaultValue + * @throws Exception */ - public function __construct($id, $defaultValue = false) + public function __construct(string $id, $defaultValue = false) { parent::__construct($id, $defaultValue); } /** * Legacy converter for legacy values. - * - * @param $value - * - * @return bool + * @param mixed $value + * @return bool|string */ private function stringToBoolConverter($value) { @@ -53,23 +54,20 @@ private function stringToBoolConverter($value) /** * Legacy wrapper for old config values. - * * @param mixed $value */ public function setValue($value) { - $value = $this->stringToBoolConverter($value); + $value = (bool) $this->stringToBoolConverter($value); parent::setValue($value); } /** * Checks if the given value is bool. - * * @param mixed $value - * * @return bool */ - public function isValidValue($value) + public function isValidValue($value): bool { return is_bool($value) === true; } diff --git a/src/Config/Config.php b/src/Config/Config.php index 137a4d1a..342f6887 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Config; +use Exception; use UserAccessManager\Wrapper\Wordpress; /** @@ -50,13 +54,12 @@ class Config /** * Config constructor. - * - * @param Wordpress $wordpress - * @param string $key + * @param Wordpress $wordpress + * @param string $key */ public function __construct( Wordpress $wordpress, - $key + string $key ) { $this->wordpress = $wordpress; $this->key = $key; @@ -64,12 +67,10 @@ public function __construct( /** * Returns the WordPress options. - * * @param string $option - * * @return mixed */ - public function getWpOption($option) + public function getWpOption(string $option) { if (!isset($this->wpOptions[$option]) === true) { $this->wpOptions[$option] = $this->wordpress->getOption($option); @@ -80,17 +81,15 @@ public function getWpOption($option) /** * Returns the default parameters for the current config. - * * @return ConfigParameter[] */ - protected function getDefaultConfigParameters() + protected function getDefaultConfigParameters(): array { return $this->defaultConfigParameters; } /** * Sets the default config parameters - * * @param ConfigParameter[] $defaultConfigParameters */ public function setDefaultConfigParameters(array $defaultConfigParameters) @@ -100,14 +99,13 @@ public function setDefaultConfigParameters(array $defaultConfigParameters) /** * Returns the current settings - * * @return ConfigParameter[] */ - public function getConfigParameters() + public function getConfigParameters(): array { if ($this->configParameters === null) { $configParameters = $this->getDefaultConfigParameters(); - $currentOptions = (array)$this->getWpOption($this->key); + $currentOptions = (array) $this->getWpOption($this->key); foreach ($currentOptions as $key => $option) { if (isset($configParameters[$key])) { @@ -123,7 +121,6 @@ public function getConfigParameters() /** * Sets the new config parameters and saves them to the database. - * * @param array $rawParameters */ public function setConfigParameters(array $rawParameters) @@ -158,19 +155,16 @@ public function flushConfigParameters() /** * Returns the requested parameter value - * * @param string $parameterName - * * @return mixed - * - * @throws \Exception + * @throws Exception */ - public function getParameterValueRaw($parameterName) + public function getParameterValueRaw(string $parameterName) { $options = $this->getConfigParameters(); if (isset($options[$parameterName]) === false) { - throw new \Exception("Unknown config parameter '{$parameterName}'."); + throw new Exception("Unknown config parameter '{$parameterName}'."); } return $options[$parameterName]->getValue(); @@ -178,16 +172,14 @@ public function getParameterValueRaw($parameterName) /** * Returns the requested parameter value but suppresses exceptions. - * * @param string $parameterName - * * @return mixed */ - public function getParameterValue($parameterName) + public function getParameterValue(string $parameterName) { try { return $this->getParameterValueRaw($parameterName); - } catch (\Exception $exception) { + } catch (Exception $exception) { return null; } } diff --git a/src/Config/ConfigFactory.php b/src/Config/ConfigFactory.php index 4ace8ea6..81c97635 100644 --- a/src/Config/ConfigFactory.php +++ b/src/Config/ConfigFactory.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Config; use UserAccessManager\Wrapper\Wordpress; @@ -27,7 +30,6 @@ class ConfigFactory /** * ConfigFactory constructor. - * * @param Wordpress $wordpress */ public function __construct(Wordpress $wordpress) @@ -37,12 +39,10 @@ public function __construct(Wordpress $wordpress) /** * Returns a new configuration. - * * @param string $key - * * @return Config */ - public function createConfig($key) + public function createConfig(string $key): Config { return new Config($this->wordpress, $key); } diff --git a/src/Config/ConfigParameter.php b/src/Config/ConfigParameter.php index bb64490a..79096dc6 100644 --- a/src/Config/ConfigParameter.php +++ b/src/Config/ConfigParameter.php @@ -12,8 +12,13 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Config; +use Exception; + /** * Class ConfigParameter * @@ -38,13 +43,11 @@ abstract class ConfigParameter implements ConfigParameterInterface /** * ConfigParameter constructor. - * * @param string $id - * @param mixed $defaultValue - * - * @throws \Exception + * @param mixed $defaultValue + * @throws Exception */ - public function __construct($id, $defaultValue = null) + public function __construct(string $id, $defaultValue = null) { $this->id = $id; @@ -54,31 +57,27 @@ public function __construct($id, $defaultValue = null) /** * Returns the id. - * * @return string */ - public function getId() + public function getId(): string { return $this->id; } /** * Checks the value type and throws an exception if the value isn't the required type. - * * @param mixed $value - * - * @throws \Exception + * @throws Exception */ protected function validateValue($value) { if ($this->isValidValue($value) === false) { - throw new \Exception("Wrong value '{$value}' type given for '{$this->id}'.'"); + throw new Exception("Wrong value '{$value}' type given for '{$this->id}'.'"); } } /** * Sets the current value. - * * @param mixed $value */ public function setValue($value) @@ -89,7 +88,6 @@ public function setValue($value) /** * Returns the current parameter value. - * * @return mixed */ public function getValue() diff --git a/src/Config/ConfigParameterFactory.php b/src/Config/ConfigParameterFactory.php index 2cf3ccc8..0435ed0e 100644 --- a/src/Config/ConfigParameterFactory.php +++ b/src/Config/ConfigParameterFactory.php @@ -12,8 +12,13 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Config; +use Exception; + /** * Class ConfigParameterFactory * @@ -23,40 +28,40 @@ class ConfigParameterFactory { /** * Creates a boolean config parameter object. - * * @param string $id - * @param mixed $defaultValue - * + * @param mixed $defaultValue * @return BooleanConfigParameter + * @throws Exception */ - public function createBooleanConfigParameter($id, $defaultValue = false) + public function createBooleanConfigParameter(string $id, $defaultValue = false): BooleanConfigParameter { return new BooleanConfigParameter($id, $defaultValue); } /** * Creates a selection config parameter object. - * * @param string $id - * @param mixed $defaultValue - * @param array $selection - * + * @param mixed $defaultValue + * @param array $selection * @return SelectionConfigParameter + * @throws Exception */ - public function createSelectionConfigParameter($id, $defaultValue, array $selection) - { + public function createSelectionConfigParameter( + string $id, + $defaultValue, + array $selection + ): SelectionConfigParameter { return new SelectionConfigParameter($id, $defaultValue, $selection); } /** * Creates a string config parameter object. - * * @param string $id - * @param mixed $defaultValue - * + * @param mixed $defaultValue * @return StringConfigParameter + * @throws Exception */ - public function createStringConfigParameter($id, $defaultValue = '') + public function createStringConfigParameter(string $id, $defaultValue = ''): StringConfigParameter { return new StringConfigParameter($id, $defaultValue); } diff --git a/src/Config/ConfigParameterInterface.php b/src/Config/ConfigParameterInterface.php index 0e70efef..61a96af4 100644 --- a/src/Config/ConfigParameterInterface.php +++ b/src/Config/ConfigParameterInterface.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Config; /** @@ -23,23 +26,19 @@ interface ConfigParameterInterface { /** * Validates the value. - * * @param mixed $value - * * @return bool */ - public function isValidValue($value); + public function isValidValue($value): bool; /** * Sets the current value. - * * @param mixed $value */ public function setValue($value); /** * Returns the current parameter value. - * * @return mixed */ public function getValue(); diff --git a/src/Config/MainConfig.php b/src/Config/MainConfig.php index 87bb79e6..9d673f39 100644 --- a/src/Config/MainConfig.php +++ b/src/Config/MainConfig.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Config; +use Exception; use UserAccessManager\Cache\Cache; use UserAccessManager\Object\ObjectHandler; use UserAccessManager\Wrapper\Wordpress; @@ -46,10 +50,9 @@ class MainConfig extends Config /** * MainConfig constructor. - * - * @param Wordpress $wordpress - * @param ObjectHandler $objectHandler - * @param Cache $cache + * @param Wordpress $wordpress + * @param ObjectHandler $objectHandler + * @param Cache $cache * @param ConfigParameterFactory $configParameterFactory */ public function __construct( @@ -67,8 +70,8 @@ public function __construct( /** * Adds the default general config parameters to the config parameters. - * * @param array $configParameters + * @throws Exception */ private function addDefaultGeneralConfigParameters(array &$configParameters) { @@ -126,8 +129,8 @@ private function addDefaultGeneralConfigParameters(array &$configParameters) /** * Adds the default post config parameters to the config parameters. - * * @param array $configParameters + * @throws Exception */ private function addDefaultPostConfigParameters(array &$configParameters) { @@ -181,8 +184,8 @@ private function addDefaultPostConfigParameters(array &$configParameters) /** * Adds the default taxonomy config parameters to the config parameters. - * * @param array $configParameters + * @throws Exception */ private function addDefaultTaxonomyConfigParameters(array &$configParameters) { @@ -195,15 +198,15 @@ private function addDefaultTaxonomyConfigParameters(array &$configParameters) $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id); } - $id = 'hide_empty_'.$taxonomy; + $id = 'hide_empty_' . $taxonomy; $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, true); } } /** * Adds the default file config parameters to the config parameters. - * * @param array $configParameters + * @throws Exception */ private function addDefaultFileConfigParameters(array &$configParameters) { @@ -272,10 +275,10 @@ private function addDefaultFileConfigParameters(array &$configParameters) /** * Returns the default config parameters settings - * * @return ConfigParameter[] + * @throws Exception */ - protected function getDefaultConfigParameters() + protected function getDefaultConfigParameters(): array { if ($this->defaultConfigParameters === []) { /** @@ -296,20 +299,18 @@ protected function getDefaultConfigParameters() /** * Returns the object parameter name. - * * @param string $objectType * @param string $rawParameterName - * * @return ConfigParameter|null */ - private function getObjectParameter($objectType, $rawParameterName) + private function getObjectParameter(string $objectType, string $rawParameterName): ?ConfigParameter { $options = $this->getConfigParameters(); $parameterName = sprintf($rawParameterName, $objectType); if (isset($options[$parameterName]) === false || isset($options["{$objectType}_use_default"]) === true - && $options["{$objectType}_use_default"]->getValue() === true + && $options["{$objectType}_use_default"]->getValue() === true ) { $parameterName = sprintf($rawParameterName, self::DEFAULT_TYPE); } @@ -319,13 +320,11 @@ private function getObjectParameter($objectType, $rawParameterName) /** * Returns the option value if the option exists otherwise true. - * * @param string $objectType * @param string $parameterName - * * @return bool */ - private function hideObject($objectType, $parameterName) + private function hideObject(string $objectType, string $parameterName): bool { $parameter = $this->getObjectParameter($objectType, $parameterName); return ($parameter !== null) ? $parameter->getValue() : true; @@ -333,13 +332,11 @@ private function hideObject($objectType, $parameterName) /** * Returns the option value if the option exists otherwise an empty string. - * * @param string $objectType * @param string $parameterName - * - * @return string + * @return bool|string */ - private function getObjectContent($objectType, $parameterName) + private function getObjectContent(string $objectType, string $parameterName) { $parameter = $this->getObjectParameter($objectType, $parameterName); return ($parameter !== null) ? $parameter->getValue() : ''; @@ -347,88 +344,80 @@ private function getObjectContent($objectType, $parameterName) /** * @param string $postType - * * @return bool */ - public function hidePostType($postType) + public function hidePostType(string $postType): bool { return $this->hideObject($postType, 'hide_%s'); } /** * @param string $postType - * * @return bool */ - public function hidePostTypeTitle($postType) + public function hidePostTypeTitle(string $postType): bool { return $this->hideObject($postType, 'hide_%s_title'); } /** * @param string $postType - * * @return bool */ - public function hidePostTypeComments($postType) + public function hidePostTypeComments(string $postType): bool { return $this->hideObject($postType, 'hide_%s_comment'); } /** * @param string $postType - * * @return bool */ - public function lockPostTypeComments($postType) + public function lockPostTypeComments(string $postType): bool { return $this->hideObject($postType, '%s_comments_locked'); } /** * @param string $postType - * * @return string */ - public function getPostTypeTitle($postType) + public function getPostTypeTitle(string $postType): string { return $this->getObjectContent($postType, '%s_title'); } /** * @param string $postType - * * @return string */ - public function getPostTypeContent($postType) + public function getPostTypeContent(string $postType): string { return $this->getObjectContent($postType, '%s_content'); } /** * @param string $postType - * * @return string */ - public function getPostTypeCommentContent($postType) + public function getPostTypeCommentContent(string $postType): string { return $this->getObjectContent($postType, '%s_comment_content'); } /** * @param string $postType - * * @return bool */ - public function showPostTypeContentBeforeMore($postType) + public function showPostTypeContentBeforeMore(string $postType) { - return $this->getObjectContent($postType, 'show_%s_content_before_more'); + return (bool) $this->getObjectContent($postType, 'show_%s_content_before_more'); } /** * @return string */ - public function getRedirect() + public function getRedirect(): ?string { return $this->getParameterValue('redirect'); } @@ -436,7 +425,7 @@ public function getRedirect() /** * @return string */ - public function getRedirectCustomPage() + public function getRedirectCustomPage(): ?string { return $this->getParameterValue('redirect_custom_page'); } @@ -444,7 +433,7 @@ public function getRedirectCustomPage() /** * @return string */ - public function getRedirectCustomUrl() + public function getRedirectCustomUrl(): ?string { return $this->getParameterValue('redirect_custom_url'); } @@ -452,39 +441,39 @@ public function getRedirectCustomUrl() /** * @return bool */ - public function lockRecursive() + public function lockRecursive(): bool { - return $this->getParameterValue('lock_recursive'); + return (bool) $this->getParameterValue('lock_recursive'); } /** * @return bool */ - public function authorsHasAccessToOwn() + public function authorsHasAccessToOwn(): bool { - return $this->getParameterValue('authors_has_access_to_own'); + return (bool) $this->getParameterValue('authors_has_access_to_own'); } /** * @return bool */ - public function authorsCanAddPostsToGroups() + public function authorsCanAddPostsToGroups(): bool { - return $this->getParameterValue('authors_can_add_posts_to_groups'); + return (bool) $this->getParameterValue('authors_can_add_posts_to_groups'); } /** * @return bool */ - public function lockFile() + public function lockFile(): bool { - return $this->getParameterValue('lock_file'); + return (bool) $this->getParameterValue('lock_file'); } /** * @return string */ - public function getInlineFiles() + public function getInlineFiles(): ?string { return $this->getParameterValue('inline_files'); } @@ -492,7 +481,7 @@ public function getInlineFiles() /** * @return string */ - public function getNoAccessImageType() + public function getNoAccessImageType(): ?string { return $this->getParameterValue('no_access_image_type'); } @@ -500,7 +489,7 @@ public function getNoAccessImageType() /** * @return string */ - public function getCustomNoAccessImage() + public function getCustomNoAccessImage(): ?string { return $this->getParameterValue('custom_no_access_image'); } @@ -508,15 +497,15 @@ public function getCustomNoAccessImage() /** * @return bool */ - public function useCustomFileHandlingFile() + public function useCustomFileHandlingFile(): bool { - return $this->getParameterValue('use_custom_file_handling_file'); + return (bool) $this->getParameterValue('use_custom_file_handling_file'); } /** * @return string */ - public function getLockedDirectoryType() + public function getLockedDirectoryType(): ?string { return $this->getParameterValue('locked_directory_type'); } @@ -524,7 +513,7 @@ public function getLockedDirectoryType() /** * @return string */ - public function getCustomLockedDirectories() + public function getCustomLockedDirectories(): ?string { return $this->getParameterValue('custom_locked_directories'); } @@ -532,7 +521,7 @@ public function getCustomLockedDirectories() /** * @return string */ - public function getFilePassType() + public function getFilePassType(): ?string { return $this->getParameterValue('file_pass_type'); } @@ -540,7 +529,7 @@ public function getFilePassType() /** * @return string */ - public function getDownloadType() + public function getDownloadType(): ?string { return $this->getParameterValue('download_type'); } @@ -548,7 +537,7 @@ public function getDownloadType() /** * @return string */ - public function getLockedFileType() + public function getLockedFileType(): ?string { return $this->getParameterValue('lock_file_types'); } @@ -556,7 +545,7 @@ public function getLockedFileType() /** * @return string */ - public function getLockedFiles() + public function getLockedFiles(): ?string { return $this->getParameterValue('locked_file_types'); } @@ -564,7 +553,7 @@ public function getLockedFiles() /** * @return string */ - public function getNotLockedFiles() + public function getNotLockedFiles(): ?string { return $this->getParameterValue('not_locked_file_types'); } @@ -572,15 +561,15 @@ public function getNotLockedFiles() /** * @return bool */ - public function blogAdminHint() + public function blogAdminHint(): bool { - return $this->getParameterValue('blog_admin_hint'); + return (bool) $this->getParameterValue('blog_admin_hint'); } /** * @return string */ - public function getBlogAdminHintText() + public function getBlogAdminHintText(): ?string { return $this->getParameterValue('blog_admin_hint_text'); } @@ -588,25 +577,24 @@ public function getBlogAdminHintText() /** * @return bool */ - public function showAssignedGroups() + public function showAssignedGroups(): bool { - return $this->getParameterValue('show_assigned_groups'); + return (bool) $this->getParameterValue('show_assigned_groups'); } /** * @return bool */ - public function hideEditLinkOnNoAccess() + public function hideEditLinkOnNoAccess(): bool { - return $this->getParameterValue('hide_edit_link_on_no_access'); + return (bool) $this->getParameterValue('hide_edit_link_on_no_access'); } /** * @param string $taxonomy - * * @return bool */ - public function hideEmptyTaxonomy($taxonomy) + public function hideEmptyTaxonomy(string $taxonomy): bool { $parameter = $this->getObjectParameter($taxonomy, 'hide_empty_%s'); return ($parameter !== null) ? $parameter->getValue() : false; @@ -615,15 +603,15 @@ public function hideEmptyTaxonomy($taxonomy) /** * @return bool */ - public function protectFeed() + public function protectFeed(): bool { - return $this->getParameterValue('protect_feed'); + return (bool) $this->getParameterValue('protect_feed'); } /** * @return string */ - public function getFullAccessRole() + public function getFullAccessRole(): ?string { return $this->getParameterValue('full_access_role'); } @@ -631,7 +619,7 @@ public function getFullAccessRole() /** * @return null|string */ - public function getActiveCacheProvider() + public function getActiveCacheProvider(): ?string { return $this->getParameterValue('active_cache_provider'); } diff --git a/src/Config/SelectionConfigParameter.php b/src/Config/SelectionConfigParameter.php index 1de6b3a0..44ed8257 100644 --- a/src/Config/SelectionConfigParameter.php +++ b/src/Config/SelectionConfigParameter.php @@ -12,8 +12,13 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Config; +use Exception; + /** * Class SelectionConfigParameter * @@ -28,14 +33,12 @@ class SelectionConfigParameter extends ConfigParameter /** * SelectionConfigParameter constructor. - * * @param string $id - * @param mixed $defaultValue - * @param array $selections - * - * @throws \Exception + * @param mixed $defaultValue + * @param array $selections + * @throws Exception */ - public function __construct($id, $defaultValue, array $selections) + public function __construct(string $id, $defaultValue, array $selections) { $this->selections = $selections; @@ -44,12 +47,10 @@ public function __construct($id, $defaultValue, array $selections) /** * Checks if the value is part of the selection. - * * @param mixed $value - * * @return bool */ - public function isValidValue($value) + public function isValidValue($value): bool { $map = array_flip($this->selections); return (isset($map[$value]) === true); @@ -57,10 +58,9 @@ public function isValidValue($value) /** * Returns the available selections. - * * @return array */ - public function getSelections() + public function getSelections(): array { return $this->selections; } diff --git a/src/Config/StringConfigParameter.php b/src/Config/StringConfigParameter.php index 2f7b2d3f..f7d84308 100644 --- a/src/Config/StringConfigParameter.php +++ b/src/Config/StringConfigParameter.php @@ -12,31 +12,32 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Config; +use Exception; + class StringConfigParameter extends ConfigParameter { /** * StringConfigParameter constructor. - * * @param string $id * @param string $defaultValue - * - * @throws \Exception + * @throws Exception */ - public function __construct($id, $defaultValue = '') + public function __construct(string $id, $defaultValue = '') { parent::__construct($id, $defaultValue); } /** * Checks if the given value is a string. - * * @param mixed $value - * * @return bool */ - public function isValidValue($value) + public function isValidValue($value): bool { return is_string($value) === true; } diff --git a/src/Config/WordpressConfig.php b/src/Config/WordpressConfig.php index c3a74829..45f505cc 100644 --- a/src/Config/WordpressConfig.php +++ b/src/Config/WordpressConfig.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Config; use UserAccessManager\Wrapper\Wordpress; @@ -45,11 +48,10 @@ class WordpressConfig /** * WordpressClass constructor. - * * @param Wordpress $wordpress - * @param string $baseFile + * @param string $baseFile */ - public function __construct(Wordpress $wordpress, $baseFile) + public function __construct(Wordpress $wordpress, string $baseFile) { $this->wordpress = $wordpress; $this->baseFile = $baseFile; @@ -57,20 +59,18 @@ public function __construct(Wordpress $wordpress, $baseFile) /** * Returns true if a user is at the admin panel. - * * @return bool */ - public function atAdminPanel() + public function atAdminPanel(): bool { return $this->wordpress->isAdmin(); } /** * Returns true if permalinks are active otherwise false. - * * @return bool */ - public function isPermalinksActive() + public function isPermalinksActive(): ?bool { if ($this->isPermalinksActive === null) { $permalinkStructure = $this->wordpress->getOption('permalink_structure'); @@ -82,15 +82,14 @@ public function isPermalinksActive() /** * Returns the upload directory. - * * @return null|string */ - public function getUploadDirectory() + public function getUploadDirectory(): ?string { $wordpressUploadDir = $this->wordpress->getUploadDir(); if (empty($wordpressUploadDir['error'])) { - return $wordpressUploadDir['basedir'].DIRECTORY_SEPARATOR; + return $wordpressUploadDir['basedir'] . DIRECTORY_SEPARATOR; } return null; @@ -98,10 +97,9 @@ public function getUploadDirectory() /** * Returns the full supported mine types. - * * @return array */ - public function getMimeTypes() + public function getMimeTypes(): ?array { if ($this->mimeTypes === null) { $mimeTypes = $this->wordpress->getAllowedMimeTypes(); @@ -123,24 +121,22 @@ public function getMimeTypes() /** * Returns the module url path. - * * @return string */ - public function getUrlPath() + public function getUrlPath(): string { - return $this->wordpress->pluginsUrl('', $this->baseFile).'/'; + return $this->wordpress->pluginsUrl('', $this->baseFile) . '/'; } /** * Returns the module real path. - * * @return string */ - public function getRealPath() + public function getRealPath(): string { $dirName = dirname($this->baseFile); - return $this->wordpress->getPluginDir().DIRECTORY_SEPARATOR - .$this->wordpress->pluginBasename($dirName).DIRECTORY_SEPARATOR; + return $this->wordpress->getPluginDir() . DIRECTORY_SEPARATOR + . $this->wordpress->pluginBasename($dirName) . DIRECTORY_SEPARATOR; } } diff --git a/src/Controller/Backend/AboutController.php b/src/Controller/Backend/AboutController.php index f824c55f..5a4db07d 100644 --- a/src/Controller/Backend/AboutController.php +++ b/src/Controller/Backend/AboutController.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; use UserAccessManager\Controller\Controller; @@ -38,16 +41,15 @@ class AboutController extends Controller /** * Returns all the supporters. - * * @return array */ - private function getAllSupporters() + private function getAllSupporters(): ?array { if ($this->supporters === null) { $realPath = rtrim($this->wordpressConfig->getRealPath(), DIRECTORY_SEPARATOR); $path = [$realPath, 'assets']; - $path = implode(DIRECTORY_SEPARATOR, $path).DIRECTORY_SEPARATOR; - $fileWithPath = $path.self::SUPPORTER_FILE; + $path = implode(DIRECTORY_SEPARATOR, $path) . DIRECTORY_SEPARATOR; + $fileWithPath = $path . self::SUPPORTER_FILE; $needsUpdate = is_file($fileWithPath) === false || filemtime($fileWithPath) < $this->wordpress->currentTime('timestamp') - 24 * 60 * 60; $fileContent = ($needsUpdate === true) ? @file_get_contents(self::SUPPORTER_FILE_URL) : false; @@ -66,10 +68,9 @@ private function getAllSupporters() /** * Returns the people which earn a special thanks. - * * @return array */ - public function getSpecialThanks() + public function getSpecialThanks(): array { $supporters = $this->getAllSupporters(); return isset($supporters['special-thanks']) === true ? $supporters['special-thanks'] : []; @@ -77,10 +78,9 @@ public function getSpecialThanks() /** * Returns the people which earn a special thanks. - * * @return array */ - public function getTopSupporters() + public function getTopSupporters(): array { $supporters = $this->getAllSupporters(); return isset($supporters['top-supporters']) === true ? $supporters['top-supporters'] : []; @@ -88,10 +88,9 @@ public function getTopSupporters() /** * Returns the people which earn a special thanks. - * * @return array */ - public function getSupporters() + public function getSupporters(): array { $supporters = $this->getAllSupporters(); return isset($supporters['supporters']) === true ? $supporters['supporters'] : []; diff --git a/src/Controller/Backend/BackendController.php b/src/Controller/Backend/BackendController.php index e016145f..2bc24294 100644 --- a/src/Controller/Backend/BackendController.php +++ b/src/Controller/Backend/BackendController.php @@ -12,14 +12,17 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; use UserAccessManager\Config\WordpressConfig; use UserAccessManager\Controller\Controller; use UserAccessManager\File\FileHandler; use UserAccessManager\Setup\SetupHandler; -use UserAccessManager\UserAccessManager; use UserAccessManager\User\UserHandler; +use UserAccessManager\UserAccessManager; use UserAccessManager\Wrapper\Php; use UserAccessManager\Wrapper\Wordpress; @@ -30,11 +33,11 @@ */ class BackendController extends Controller { - const HANDLE_STYLE_ADMIN = 'UserAccessManagerAdmin'; - const HANDLE_SCRIPT_GROUP_SUGGEST = 'UserAccessManagerGroupSuggest'; - const HANDLE_SCRIPT_TIME_INPUT = 'UserAccessManagerTimeInput'; - const HANDLE_SCRIPT_ADMIN = 'UserAccessManagerFunctions'; - const UAM_ERRORS = 'UAM_ERRORS'; + public const HANDLE_STYLE_ADMIN = 'UserAccessManagerAdmin'; + public const HANDLE_SCRIPT_GROUP_SUGGEST = 'UserAccessManagerGroupSuggest'; + public const HANDLE_SCRIPT_TIME_INPUT = 'UserAccessManagerTimeInput'; + public const HANDLE_SCRIPT_ADMIN = 'UserAccessManagerFunctions'; + public const UAM_ERRORS = 'UAM_ERRORS'; /** * @var UserHandler @@ -58,13 +61,12 @@ class BackendController extends Controller /** * BackendController constructor. - * - * @param Php $php - * @param Wordpress $wordpress + * @param Php $php + * @param Wordpress $wordpress * @param WordpressConfig $wordpressConfig - * @param UserHandler $userHandler - * @param FileHandler $fileHandler - * @param SetupHandler $setupHandler + * @param UserHandler $userHandler + * @param FileHandler $fileHandler + * @param SetupHandler $setupHandler */ public function __construct( Php $php, @@ -103,10 +105,9 @@ public function showAdminNotice() /** * Returns the set notice. - * * @return string */ - public function getNotice() + public function getNotice(): string { return $this->notice; } @@ -120,7 +121,7 @@ private function registerStylesAndScripts() $this->wordpress->registerStyle( self::HANDLE_STYLE_ADMIN, - $urlPath.'assets/css/uamAdmin.css', + $urlPath . 'assets/css/uamAdmin.css', [], UserAccessManager::VERSION, 'screen' @@ -128,21 +129,21 @@ private function registerStylesAndScripts() $this->wordpress->registerScript( self::HANDLE_SCRIPT_GROUP_SUGGEST, - $urlPath.'assets/js/jquery.uam-group-suggest.js', + $urlPath . 'assets/js/jquery.uam-group-suggest.js', ['jquery'], UserAccessManager::VERSION ); $this->wordpress->registerScript( self::HANDLE_SCRIPT_TIME_INPUT, - $urlPath.'assets/js/jquery.uam-time-input.js', + $urlPath . 'assets/js/jquery.uam-time-input.js', ['jquery'], UserAccessManager::VERSION ); $this->wordpress->registerScript( self::HANDLE_SCRIPT_ADMIN, - $urlPath.'assets/js/functions.js', + $urlPath . 'assets/js/functions.js', ['jquery'], UserAccessManager::VERSION ); diff --git a/src/Controller/Backend/CacheController.php b/src/Controller/Backend/CacheController.php index 78d7e624..f525f7b5 100644 --- a/src/Controller/Backend/CacheController.php +++ b/src/Controller/Backend/CacheController.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; use UserAccessManager\Cache\Cache; @@ -31,7 +34,6 @@ class CacheController /** * CacheController constructor. - * * @param Cache $cache */ public function __construct(Cache $cache) diff --git a/src/Controller/Backend/ControllerTabNavigationTrait.php b/src/Controller/Backend/ControllerTabNavigationTrait.php index 63b4c4e1..3d0672b4 100644 --- a/src/Controller/Backend/ControllerTabNavigationTrait.php +++ b/src/Controller/Backend/ControllerTabNavigationTrait.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; /** @@ -23,65 +26,55 @@ trait ControllerTabNavigationTrait { /** * Returns the current request url. - * * @return string */ - abstract public function getRequestUrl(); + abstract public function getRequestUrl(): string; /** * Returns the request parameter. - * * @param string $name - * @param mixed $default - * + * @param mixed $default * @return mixed */ - abstract public function getRequestParameter($name, $default = null); + abstract public function getRequestParameter(string $name, $default = null); /** * Translates the given group by the group key. - * * @param string $key - * * @return string */ - abstract public function getGroupText($key); + abstract public function getGroupText(string $key): string; /** * Translates the given group section by the group key. - * * @param string $key - * * @return string */ - abstract public function getGroupSectionText($key); + abstract public function getGroupSectionText(string $key): string; /** * Returns the tab groups. - * * @return array */ - abstract public function getTabGroups(); + abstract public function getTabGroups(): array; /** * Returns the current tab group. - * * @return string */ - public function getCurrentTabGroup() + public function getCurrentTabGroup(): string { $groups = $this->getTabGroups(); $keys = array_keys($groups); - return (string)$this->getRequestParameter('tab_group', reset($keys)); + return (string) $this->getRequestParameter('tab_group', reset($keys)); } /** * Returns the tab group sections. - * * @return array */ - public function getSections() + public function getSections(): array { $groups = $this->getTabGroups(); $group = $this->getCurrentTabGroup(); @@ -91,10 +84,9 @@ public function getSections() /** * Returns the current tab group section. - * * @return string */ - public function getCurrentTabGroupSection() + public function getCurrentTabGroupSection(): string { $groups = $this->getTabGroups(); $group = $this->getCurrentTabGroup(); @@ -106,35 +98,31 @@ public function getCurrentTabGroupSection() $default = reset($firstGroup); } - return (string)$this->getRequestParameter('tab_group_section', $default); + return (string) $this->getRequestParameter('tab_group_section', $default); } /** * Returns the settings group link by the given group key. - * * @param string $groupKey - * * @return string */ - public function getTabGroupLink($groupKey) + public function getTabGroupLink(string $groupKey): string { $rawUrl = $this->getRequestUrl(); $url = preg_replace('/&tab_group[^&]*/i', '', $rawUrl); - return $url.'&tab_group='.$groupKey; + return $url . '&tab_group=' . $groupKey; } /** * Returns the settings section link by the given group and section key. - * * @param string $groupKey * @param string $sectionKey - * * @return string */ - public function getTabGroupSectionLink($groupKey, $sectionKey) + public function getTabGroupSectionLink(string $groupKey, string $sectionKey): string { $rawUrl = $this->getTabGroupLink($groupKey); $url = preg_replace('/&tab_group_section[^&]*/i', '', $rawUrl); - return $url.'&tab_group_section='.$sectionKey; + return $url . '&tab_group_section=' . $sectionKey; } } diff --git a/src/Controller/Backend/DynamicGroupsController.php b/src/Controller/Backend/DynamicGroupsController.php index 421a3df3..0c1fbb80 100644 --- a/src/Controller/Backend/DynamicGroupsController.php +++ b/src/Controller/Backend/DynamicGroupsController.php @@ -12,9 +12,13 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; use UserAccessManager\UserGroup\DynamicUserGroup; +use WP_Role; /** * Class DynamicGroupsController @@ -39,14 +43,14 @@ public function getDynamicGroupsForAjax() $search = trim(end($searches)); $users = $this->wordpress->getUsers([ - 'search' => '*'.$search.'*', + 'search' => '*' . $search . '*', 'fields' => ['ID', 'display_name', 'user_login', 'user_email'] ]); $matches = array_map( function ($element) { return [ 'id' => $element->ID, - 'name' => TXT_UAM_USER.": {$element->display_name} ($element->user_login)", + 'name' => TXT_UAM_USER . ": {$element->display_name} ($element->user_login)", 'type' => DynamicUserGroup::USER_TYPE ]; }, @@ -54,7 +58,7 @@ function ($element) { ); /** - * @var \WP_Role[] $roles + * @var WP_Role[] $roles */ $roles = $this->wordpress->getRoles()->roles; @@ -62,7 +66,7 @@ function ($element) { if (strpos(strtolower($role['name']), strtolower($search)) !== false) { $matches[] = [ 'id' => $key, - 'name' => TXT_UAM_ROLE.': '.$role['name'], + 'name' => TXT_UAM_ROLE . ': ' . $role['name'], 'type' => DynamicUserGroup::ROLE_TYPE ]; } diff --git a/src/Controller/Backend/ObjectController.php b/src/Controller/Backend/ObjectController.php index 95d72e5a..ed5b2102 100644 --- a/src/Controller/Backend/ObjectController.php +++ b/src/Controller/Backend/ObjectController.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; +use Exception; use UserAccessManager\Access\AccessHandler; use UserAccessManager\Config\MainConfig; use UserAccessManager\Config\WordpressConfig; @@ -21,13 +25,14 @@ use UserAccessManager\Database\Database; use UserAccessManager\Object\ObjectHandler; use UserAccessManager\ObjectMembership\MissingObjectMembershipHandlerException; +use UserAccessManager\User\UserHandler; use UserAccessManager\UserGroup\AbstractUserGroup; use UserAccessManager\UserGroup\AssignmentInformation; use UserAccessManager\UserGroup\DynamicUserGroup; use UserAccessManager\UserGroup\UserGroupAssignmentException; use UserAccessManager\UserGroup\UserGroupAssignmentHandler; -use UserAccessManager\User\UserHandler; use UserAccessManager\UserGroup\UserGroupHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Util\DateUtil; use UserAccessManager\Wrapper\Php; use UserAccessManager\Wrapper\Wordpress; @@ -97,19 +102,18 @@ class ObjectController extends Controller /** * ObjectController constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param WordpressConfig $wordpressConfig - * @param MainConfig $mainConfig - * @param Database $database - * @param DateUtil $dateUtil - * @param ObjectHandler $objectHandler - * @param UserHandler $userHandler - * @param UserGroupHandler $userGroupHandler + * @param Php $php + * @param Wordpress $wordpress + * @param WordpressConfig $wordpressConfig + * @param MainConfig $mainConfig + * @param Database $database + * @param DateUtil $dateUtil + * @param ObjectHandler $objectHandler + * @param UserHandler $userHandler + * @param UserGroupHandler $userGroupHandler * @param UserGroupAssignmentHandler $userGroupAssignmentHandler - * @param AccessHandler $accessHandler - * @param ObjectInformationFactory $objectInformationFactory + * @param AccessHandler $accessHandler + * @param ObjectInformationFactory $objectInformationFactory */ public function __construct( Php $php, @@ -139,12 +143,12 @@ public function __construct( /** * Sets the current object type, the object id and the user groups. - * * @param string $objectType - * @param string $objectId - * @param array $objectUserGroups + * @param int|string|null $objectId + * @param array|null $objectUserGroups + * @throws UserGroupTypeException */ - protected function setObjectInformation($objectType, $objectId, array $objectUserGroups = null) + protected function setObjectInformation(string $objectType, $objectId, ?array $objectUserGroups = null) { $userGroupDiff = 0; @@ -156,43 +160,40 @@ protected function setObjectInformation($objectType, $objectId, array $objectUse $this->objectInformation->setObjectType($objectType) ->setObjectId($objectId) - ->setObjectUserGroups((array)$objectUserGroups) + ->setObjectUserGroups((array) $objectUserGroups) ->setUserGroupDiff($userGroupDiff); } /** * Returns the object information. - * * @return ObjectInformation */ - public function getObjectInformation() + public function getObjectInformation(): ObjectInformation { return $this->objectInformation; } /** * Returns the default groups form name. - * * @return string */ - public function getGroupsFormName() + public function getGroupsFormName(): string { - return ($this->groupsFromName !== null) ? (string)$this->groupsFromName : self::DEFAULT_GROUPS_FORM_NAME; + return ($this->groupsFromName !== null) ? (string) $this->groupsFromName : self::DEFAULT_GROUPS_FORM_NAME; } /** * Returns the filtered user groups. - * * @return AbstractUserGroup[] + * @throws UserGroupTypeException */ - public function getFilteredUserGroups() + public function getFilteredUserGroups(): array { return $this->userGroupHandler->getFilteredUserGroups(); } /** * Sorts the user groups. - * * @param array $userGroups */ public function sortUserGroups(array &$userGroups) @@ -203,12 +204,12 @@ function ( AbstractUserGroup $userGroupOne, AbstractUserGroup $userGroupTwo ) { - $notLoggedInUserGroupId = DynamicUserGroup::USER_TYPE.'|'.DynamicUserGroup::NOT_LOGGED_IN_USER_ID; + $notLoggedInUserGroupId = DynamicUserGroup::USER_TYPE . '|' . DynamicUserGroup::NOT_LOGGED_IN_USER_ID; if ($userGroupOne->getId() === $notLoggedInUserGroupId) { return 1; } elseif ($userGroupTwo->getId() === $notLoggedInUserGroupId) { - return 0; + return -1; } return strnatcasecmp($userGroupOne->getName(), $userGroupTwo->getName()); @@ -218,20 +219,18 @@ function ( /** * Returns the date util. - * * @return DateUtil */ - public function getDateUtil() + public function getDateUtil(): DateUtil { return $this->dateUtil; } /** * Checks if the current user is an admin. - * * @return bool */ - public function isCurrentUserAdmin() + public function isCurrentUserAdmin(): bool { if ($this->objectInformation->getObjectType() === ObjectHandler::GENERAL_USER_OBJECT_TYPE && $this->objectInformation->getObjectId() !== null @@ -244,10 +243,9 @@ public function isCurrentUserAdmin() /** * Returns the wordpress role names. - * * @return array */ - public function getRoleNames() + public function getRoleNames(): array { $roles = $this->wordpress->getRoles(); return $roles->role_names; @@ -255,22 +253,21 @@ public function getRoleNames() /** * Checks the user access. - * * @return bool */ - public function checkUserAccess() + public function checkUserAccess(): bool { return $this->userHandler->checkUserAccess(UserHandler::MANAGE_USER_GROUPS_CAPABILITY); } /** * Returns the recursive object membership. - * - * @param $userGroup - * + * @param AbstractUserGroup $userGroup * @return array + * @throws Exception + * @throws Exception */ - public function getRecursiveMembership(AbstractUserGroup $userGroup) + public function getRecursiveMembership(AbstractUserGroup $userGroup): array { $recursiveMembership = []; $objectType = $this->objectInformation->getObjectType(); @@ -298,11 +295,11 @@ public function getRecursiveMembership(AbstractUserGroup $userGroup) /** * Checks the access and dies if the user has no access. - * * @param string $objectType - * @param string $objectId + * @param int|string $objectId + * @throws UserGroupTypeException */ - private function dieOnNoAccess($objectType, $objectId) + private function dieOnNoAccess(string $objectType, $objectId) { if ($this->accessHandler->checkObjectAccess($objectType, $objectId) === false) { $this->wordpress->wpDie(TXT_UAM_NO_RIGHTS_MESSAGE, TXT_UAM_NO_RIGHTS_TITLE, ['response' => 403]); @@ -311,6 +308,7 @@ private function dieOnNoAccess($objectType, $objectId) /** * Shows the error if the user has no rights to edit the content. + * @throws UserGroupTypeException */ public function checkRightsToEditContent() { @@ -333,16 +331,20 @@ public function checkRightsToEditContent() /** * Returns the user groups by reference which should be add and removed from the object. - * - * @param string $objectType - * @param string $objectId + * @param string $objectType + * @param int|string $objectId * @param array|null $addUserGroups - * @param array $removeUserGroups + * @param array|null $removeUserGroups + * @throws UserGroupTypeException */ - private function getAddRemoveGroups($objectType, $objectId, &$addUserGroups, &$removeUserGroups) - { + private function getAddRemoveGroups( + string $objectType, + $objectId, + ?array &$addUserGroups = [], + ?array &$removeUserGroups = [] + ) { if ($addUserGroups === null) { - $addUserGroups = (array)$this->getRequestParameter(self::DEFAULT_GROUPS_FORM_NAME, []); + $addUserGroups = (array) $this->getRequestParameter(self::DEFAULT_GROUPS_FORM_NAME, []); } $filteredUserGroupsForObject = $this->userGroupHandler->getFilteredUserGroupsForObject( @@ -360,15 +362,15 @@ private function getAddRemoveGroups($objectType, $objectId, &$addUserGroups, &$r /** * Saves the object data to the database. - * - * @param string $objectType The object type. - * @param string $objectId The id of the object. - * @param array $addUserGroups The new user groups for the object. - * @param bool $force If true we force the assignment. + * @param string $objectType The object type. + * @param int|string|null $objectId The id of the object. + * @param array|null $addUserGroups The new user groups for the object. + * @param bool $force If true we force the assignment. + * @throws UserGroupTypeException */ - public function saveObjectData($objectType, $objectId, array $addUserGroups = null, $force = false) + public function saveObjectData(string $objectType, $objectId, ?array $addUserGroups = null, $force = false) { - $isUpdateForm = (bool)$this->getRequestParameter(self::UPDATE_GROUPS_FORM_NAME, false) === true + $isUpdateForm = (bool) $this->getRequestParameter(self::UPDATE_GROUPS_FORM_NAME, false) === true || $this->getRequestParameter('uam_bulk_type') !== null; $hasRights = $this->checkUserAccess() === true || $this->mainConfig->authorsCanAddPostsToGroups() === true; @@ -392,11 +394,10 @@ public function saveObjectData($objectType, $objectId, array $addUserGroups = nu /** * Removes the object data. - * * @param string $objectType The object type. - * @param int $id The object id. + * @param int|string $id The object id. */ - public function removeObjectData($objectType, $id) + public function removeObjectData(string $objectType, $id) { $this->database->delete( $this->database->getUserGroupToObjectTable(), @@ -413,20 +414,19 @@ public function removeObjectData($objectType, $id) /** * Returns the group selection form for pluggable objects. - * - * @param string $objectType The object type. - * @param string $objectId The id of the object. - * @param string $formName The formName. - * @param array $objectUserGroups If set we force this user groups for the object. - * + * @param string $objectType The object type. + * @param int|string $objectId The id of the object. + * @param null $formName The formName. + * @param array|null $objectUserGroups If set we force this user groups for the object. * @return string + * @throws UserGroupTypeException */ public function showGroupSelectionForm( - $objectType, + string $objectType, $objectId, $formName = null, array $objectUserGroups = null - ) { + ): string { $this->setObjectInformation($objectType, $objectId, $objectUserGroups); $this->groupsFromName = $formName; @@ -438,13 +438,12 @@ public function showGroupSelectionForm( /** * Returns the column for a pluggable object. - * * @param string $objectType The object type. - * @param string $objectId The object id. - * + * @param int|string $objectId The object id. * @return string + * @throws UserGroupTypeException */ - public function getGroupColumn($objectType, $objectId) + public function getGroupColumn(string $objectType, $objectId): string { $this->setObjectInformation($objectType, $objectId); return $this->getIncludeContents('ObjectColumn.php'); @@ -452,10 +451,10 @@ public function getGroupColumn($objectType, $objectId) /** * Checks if the current object is a new object. - * * @return bool + * @throws Exception */ - public function isNewObject() + public function isNewObject(): bool { $objectType = $this->objectInformation->getObjectType(); diff --git a/src/Controller/Backend/ObjectInformation.php b/src/Controller/Backend/ObjectInformation.php index 2dae2c31..f8769331 100644 --- a/src/Controller/Backend/ObjectInformation.php +++ b/src/Controller/Backend/ObjectInformation.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; use UserAccessManager\UserGroup\AbstractUserGroup; @@ -45,12 +48,10 @@ class ObjectInformation /** * Sets the object type. - * * @param string $objectType - * * @return $this */ - public function setObjectType($objectType) + public function setObjectType(string $objectType): ObjectInformation { $this->objectType = $objectType; return $this; @@ -58,22 +59,19 @@ public function setObjectType($objectType) /** * Returns the current object type. - * * @return null|string */ - public function getObjectType() + public function getObjectType(): ?string { return $this->objectType; } /** * Sets the object id. - * * @param $objectId - * * @return $this */ - public function setObjectId($objectId) + public function setObjectId($objectId): ObjectInformation { $this->objectId = $objectId; return $this; @@ -81,8 +79,7 @@ public function setObjectId($objectId) /** * Returns the current object id. - * - * @return null|string + * @return int|string|null */ public function getObjectId() { @@ -91,12 +88,10 @@ public function getObjectId() /** * Sets the user group diff count. - * * @param int $userGroupDiff - * * @return $this */ - public function setUserGroupDiff($userGroupDiff) + public function setUserGroupDiff(int $userGroupDiff): ObjectInformation { $this->userGroupDiff = $userGroupDiff; return $this; @@ -104,22 +99,19 @@ public function setUserGroupDiff($userGroupDiff) /** * Returns the user group count diff. - * * @return int */ - public function getUserGroupDiff() + public function getUserGroupDiff(): int { return $this->userGroupDiff; } /** * Sets the user group diff count. - * * @param $objectUserGroups - * * @return $this */ - public function setObjectUserGroups($objectUserGroups) + public function setObjectUserGroups($objectUserGroups): ObjectInformation { $this->objectUserGroups = $objectUserGroups; return $this; @@ -127,10 +119,9 @@ public function setObjectUserGroups($objectUserGroups) /** * Returns the current object user groups. - * * @return AbstractUserGroup[] */ - public function getObjectUserGroups() + public function getObjectUserGroups(): array { return $this->objectUserGroups; } diff --git a/src/Controller/Backend/ObjectInformationFactory.php b/src/Controller/Backend/ObjectInformationFactory.php index 6659d790..dafc4361 100644 --- a/src/Controller/Backend/ObjectInformationFactory.php +++ b/src/Controller/Backend/ObjectInformationFactory.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; /** @@ -23,10 +26,9 @@ class ObjectInformationFactory { /** * Creates and returns a new object information object. - * * @return ObjectInformation */ - public function createObjectInformation() + public function createObjectInformation(): ObjectInformation { return new ObjectInformation(); } diff --git a/src/Controller/Backend/PostObjectController.php b/src/Controller/Backend/PostObjectController.php index 15d65281..65fbe084 100644 --- a/src/Controller/Backend/PostObjectController.php +++ b/src/Controller/Backend/PostObjectController.php @@ -12,9 +12,14 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; use UserAccessManager\Object\ObjectHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; +use WP_Post; /** * Class PostObjectController @@ -26,12 +31,10 @@ class PostObjectController extends ObjectController /** * The function for the manage_posts_columns and * the manage_pages_columns filter. - * * @param array $defaults The table headers. - * * @return array */ - public function addPostColumnsHeader($defaults) + public function addPostColumnsHeader(array $defaults): array { $defaults[self::COLUMN_NAME] = TXT_UAM_COLUMN_ACCESS; return $defaults; @@ -39,11 +42,11 @@ public function addPostColumnsHeader($defaults) /** * The function for the manage_users_custom_column action. - * - * @param string $columnName The column name. - * @param integer $id The id. + * @param string $columnName The column name. + * @param integer $id The id. + * @throws UserGroupTypeException */ - public function addPostColumn($columnName, $id) + public function addPostColumn(string $columnName, int $id) { if ($columnName === self::COLUMN_NAME) { $post = $this->objectHandler->getPost($id); @@ -53,12 +56,12 @@ public function addPostColumn($columnName, $id) /** * The function for the uam_post_access meta box. - * - * @param object $post The post. + * @param mixed $post The post. + * @throws UserGroupTypeException */ public function editPostContent($post) { - if ($post instanceof \WP_Post) { + if ($post instanceof WP_Post) { $this->setObjectInformation($post->post_type, $post->ID); } @@ -67,7 +70,6 @@ public function editPostContent($post) /** * Adds the bulk edit form. - * * @param $columnName */ public function addBulkAction($columnName) @@ -79,8 +81,8 @@ public function addBulkAction($columnName) /** * The function for the save_post action. - * * @param mixed $postParam The post id or a array of a post. + * @throws UserGroupTypeException */ public function savePostData($postParam) { @@ -100,10 +102,10 @@ public function savePostData($postParam) /** * The function for the add_attachment action. - * * @param int $postId + * @throws UserGroupTypeException */ - public function addAttachment($postId) + public function addAttachment(int $postId) { $post = $this->objectHandler->getPost($postId); $postType = $post->post_type; @@ -123,12 +125,11 @@ public function addAttachment($postId) * The function for the attachment_fields_to_save filter. * We have to use this because the attachment actions work * not in the way we need. - * * @param array $attachment The attachment id. - * * @return array + * @throws UserGroupTypeException */ - public function saveAttachmentData($attachment) + public function saveAttachmentData(array $attachment): array { $this->savePostData($attachment['ID']); @@ -137,6 +138,7 @@ public function saveAttachmentData($attachment) /** * The function for the wp_ajax_save_attachment_compat filter. + * @throws UserGroupTypeException */ public function saveAjaxAttachmentData() { @@ -152,10 +154,9 @@ public function saveAjaxAttachmentData() /** * The function for the delete_post action. - * * @param integer $postId The post id. */ - public function removePostData($postId) + public function removePostData(int $postId) { $post = $this->objectHandler->getPost($postId); $this->removeObjectData($post->post_type, $postId); @@ -163,13 +164,12 @@ public function removePostData($postId) /** * The function for the media_meta action. - * - * @param array $formFields The meta. - * @param \WP_Post $post The post. - * + * @param array $formFields The meta. + * @param WP_Post $post The post. * @return array + * @throws UserGroupTypeException */ - public function showMediaFile(array $formFields, $post = null) + public function showMediaFile(array $formFields, $post = null): array { if ($this->getRequestParameter('action') !== 'edit') { $attachmentId = $this->getRequestParameter('attachment_id'); @@ -178,7 +178,7 @@ public function showMediaFile(array $formFields, $post = null) $post = $this->objectHandler->getPost($attachmentId); } - if ($post instanceof \WP_Post) { + if ($post instanceof WP_Post) { $this->setObjectInformation($post->post_type, $post->ID); } diff --git a/src/Controller/Backend/SettingsController.php b/src/Controller/Backend/SettingsController.php index bb564684..2730a9ec 100644 --- a/src/Controller/Backend/SettingsController.php +++ b/src/Controller/Backend/SettingsController.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; +use Exception; use UserAccessManager\Cache\Cache; use UserAccessManager\Config\MainConfig; use UserAccessManager\Config\WordpressConfig; @@ -26,6 +30,8 @@ use UserAccessManager\Object\ObjectHandler; use UserAccessManager\Wrapper\Php; use UserAccessManager\Wrapper\Wordpress; +use WP_Post_Type; +use WP_Taxonomy; class SettingsController extends Controller { @@ -73,15 +79,14 @@ class SettingsController extends Controller /** * SettingsController constructor. - * - * @param Php $php - * @param Wordpress $wordpress + * @param Php $php + * @param Wordpress $wordpress * @param WordpressConfig $wordpressConfig - * @param MainConfig $mainConfig - * @param Cache $cache - * @param FileHandler $fileHandler - * @param FormFactory $formFactory - * @param FormHelper $formHelper + * @param MainConfig $mainConfig + * @param Cache $cache + * @param FileHandler $fileHandler + * @param FormFactory $formFactory + * @param FormHelper $formHelper */ public function __construct( Php $php, @@ -103,10 +108,9 @@ public function __construct( /** * Returns the tab groups. - * * @return array */ - public function getTabGroups() + public function getTabGroups(): array { $activeCacheProvider = $this->mainConfig->getActiveCacheProvider(); $cacheProviderSections = [$activeCacheProvider]; @@ -118,6 +122,10 @@ public function getTabGroups() } } + if (!in_array(MainConfig::CACHE_PROVIDER_NONE, $cacheProviderSections)) { + $cacheProviderSections[] = MainConfig::CACHE_PROVIDER_NONE; + } + return [ self::GROUP_POST_TYPES => array_merge([MainConfig::DEFAULT_TYPE], array_keys($this->getPostTypes())), self::GROUP_TAXONOMIES => array_merge([MainConfig::DEFAULT_TYPE], array_keys($this->getTaxonomies())), @@ -130,10 +138,9 @@ public function getTabGroups() /** * Returns the pages. - * * @return array */ - private function getPages() + private function getPages(): array { $pages = $this->wordpress->getPages('sort_column=menu_order'); return is_array($pages) !== false ? $pages : []; @@ -141,51 +148,46 @@ private function getPages() /** * Returns the post types as object. - * - * @return \WP_Post_Type[] + * @return WP_Post_Type[] */ - private function getPostTypes() + private function getPostTypes(): array { return $this->wordpress->getPostTypes(['public' => true], 'objects'); } /** * Returns the taxonomies as objects. - * - * @return \WP_Taxonomy[] + * @return WP_Taxonomy[] */ - private function getTaxonomies() + private function getTaxonomies(): array { return $this->wordpress->getTaxonomies(['public' => true], 'objects'); } /** * @param string $key - * @param bool $description - * + * @param bool $description * @return string */ - public function getText($key, $description = false) + public function getText(string $key, $description = false): string { return $this->formHelper->getText($key, $description); } /** * @param string $key - * * @return string */ - public function getGroupText($key) + public function getGroupText(string $key): string { return $this->getText($key); } /** - * @param $key - * + * @param string $key * @return string */ - public function getGroupSectionText($key) + public function getGroupSectionText(string $key): string { return ($key === MainConfig::DEFAULT_TYPE) ? TXT_UAM_SETTINGS_GROUP_SECTION_DEFAULT : $this->getObjectName($key); @@ -193,12 +195,10 @@ public function getGroupSectionText($key) /** * Returns the object name. - * * @param string $objectKey - * * @return string */ - public function getObjectName($objectKey) + public function getObjectName(string $objectKey): string { $objects = $this->wordpress->getPostTypes(['public' => true], 'objects') + $this->wordpress->getTaxonomies(['public' => true], 'objects'); @@ -208,14 +208,11 @@ public function getObjectName($objectKey) /** * Returns the post settings form. - * * @param string $postType - * - * @return \UserAccessManager\Form\Form - * - * @throws \Exception + * @return Form + * @throws Exception */ - private function getPostSettingsForm($postType = MainConfig::DEFAULT_TYPE) + private function getPostSettingsForm($postType = MainConfig::DEFAULT_TYPE): Form { $textarea = null; $configParameters = $this->mainConfig->getConfigParameters(); @@ -247,14 +244,11 @@ private function getPostSettingsForm($postType = MainConfig::DEFAULT_TYPE) /** * Returns the taxonomy settings form. - * * @param string $taxonomy - * - * @return \UserAccessManager\Form\Form - * - * @throws \Exception + * @return Form + * @throws Exception */ - private function getTaxonomySettingsForm($taxonomy = MainConfig::DEFAULT_TYPE) + private function getTaxonomySettingsForm($taxonomy = MainConfig::DEFAULT_TYPE): Form { $parameters = ($taxonomy !== MainConfig::DEFAULT_TYPE) ? ["{$taxonomy}_use_default"] : []; $parameters = array_merge($parameters, [ @@ -266,12 +260,11 @@ private function getTaxonomySettingsForm($taxonomy = MainConfig::DEFAULT_TYPE) /** * Checks if x send file is available. - * * @return bool */ - private function isXSendFileAvailable() + private function isXSendFileAvailable(): bool { - $content = file_get_contents($this->wordpress->getSiteUrl().'?testXSendFile'); + $content = file_get_contents($this->wordpress->getSiteUrl() . '?testXSendFile'); $this->fileHandler->removeXSendFileTestFile(); return ($content === 'success'); @@ -279,7 +272,6 @@ private function isXSendFileAvailable() /** * Disables the xSendFileOption - * * @param Form $form */ private function disableXSendFileOption(Form $form) @@ -299,7 +291,6 @@ private function disableXSendFileOption(Form $form) /** * Adds the lock file types config parameter to the parameters. - * * @param array $configParameters * @param array $parameters */ @@ -321,12 +312,10 @@ private function addLockFileTypes(array $configParameters, array &$parameters) /** * Returns the files settings form. - * - * @return \UserAccessManager\Form\Form - * - * @throws \Exception + * @return Form + * @throws Exception */ - private function getFilesSettingsForm() + private function getFilesSettingsForm(): Form { $fileProtectionFileName = $this->fileHandler->getFileProtectionFileName(); $fileContent = (file_exists($fileProtectionFileName) === true) ? @@ -362,12 +351,10 @@ private function getFilesSettingsForm() /** * Returns the author settings form. - * - * @return \UserAccessManager\Form\Form - * - * @throws \Exception + * @return Form + * @throws Exception */ - private function getAuthorSettingsForm() + private function getAuthorSettingsForm(): Form { $parameters = [ 'authors_has_access_to_own', @@ -380,7 +367,6 @@ private function getAuthorSettingsForm() /** * Adds the custom page redirect from element. - * * @param array $configParameters * @param array $values */ @@ -398,7 +384,7 @@ private function addCustomPageRedirectFormElement(array $configParameters, array foreach ($pages as $page) { $possibleValues[] = $this->formFactory->createValueSetFromElementValue( - (int)$page->ID, + (int) $page->ID, $page->post_title ); } @@ -406,13 +392,13 @@ private function addCustomPageRedirectFormElement(array $configParameters, array $formElement = $this->formFactory->createSelect( $redirectCustomPage->getId(), $possibleValues, - (int)$redirectCustomPage->getValue() + (int) $redirectCustomPage->getValue() ); try { $redirectCustomPageValue->setSubElement($formElement); $values[] = $redirectCustomPageValue; - } catch (\Exception $exception) { + } catch (Exception $exception) { // Do Nothing } } @@ -420,12 +406,10 @@ private function addCustomPageRedirectFormElement(array $configParameters, array /** * Returns the author settings form. - * - * @return \UserAccessManager\Form\Form - * - * @throws \Exception + * @return Form + * @throws Exception */ - private function getOtherSettingsForm() + private function getOtherSettingsForm(): Form { $redirect = null; $configParameters = $this->mainConfig->getConfigParameters(); @@ -446,7 +430,7 @@ private function getOtherSettingsForm() TXT_UAM_REDIRECT_TO_URL, $configParameters['redirect_custom_url'] ); - } catch (\Exception $exception) { + } catch (Exception $exception) { // Do nothing. } } @@ -477,14 +461,12 @@ private function getOtherSettingsForm() /** * Returns the full settings from. - * - * @param array $types - * @param array $ignoredTypes + * @param array $types + * @param array $ignoredTypes * @param Callable $formFunction - * * @return array */ - private function getFullSettingsFrom(array $types, array $ignoredTypes, $formFunction) + private function getFullSettingsFrom(array $types, array $ignoredTypes, callable $formFunction): array { $groupForms = []; $groupForms[MainConfig::DEFAULT_TYPE] = $formFunction(); @@ -502,10 +484,10 @@ private function getFullSettingsFrom(array $types, array $ignoredTypes, $formFun /** * Returns the full taxonomy post forms. - * * @return array + * @throws Exception */ - private function getFullPostSettingsForm() + private function getFullPostSettingsForm(): array { return $this->getFullSettingsFrom( $this->getPostTypes(), @@ -518,10 +500,10 @@ function ($type = MainConfig::DEFAULT_TYPE) { /** * Returns the full taxonomy settings forms. - * * @return array + * @throws Exception */ - private function getFullTaxonomySettingsForm() + private function getFullTaxonomySettingsForm(): array { return $this->getFullSettingsFrom( $this->getTaxonomies(), @@ -534,12 +516,10 @@ function ($type = MainConfig::DEFAULT_TYPE) { /** * Returns the full cache providers froms. - * * @return array - * - * @throws \Exception + * @throws Exception */ - private function getFullCacheProvidersForm() + private function getFullCacheProvidersForm(): array { $groupForms = []; $cacheProviders = $this->cache->getRegisteredCacheProviders(); @@ -556,13 +536,11 @@ private function getFullCacheProvidersForm() /** * Returns the current settings form. - * - * @return \UserAccessManager\Form\Form[] + * @return Form[] */ - public function getCurrentGroupForms() + public function getCurrentGroupForms(): array { $group = $this->getCurrentTabGroup(); - $groupForms = []; try { $formMap = [ @@ -589,16 +567,15 @@ public function getCurrentGroupForms() if (isset($formMap[$group]) === true) { return $formMap[$group](); } - } catch (\Exception $exception) { + } catch (Exception $exception) { $this->addErrorMessage(sprintf(TXT_UAM_ERROR, $exception->getMessage())); } - return $groupForms; + return []; } /** * Updates the file handling file. - * * @param array $configParameters */ private function updateFileProtectionFile(array $configParameters) @@ -649,12 +626,10 @@ public function updateSettingsAction() /** * Checks if the group is a post type. - * * @param string $key - * * @return bool */ - public function isPostTypeGroup($key) + public function isPostTypeGroup(string $key): bool { $postTypes = $this->getPostTypes(); diff --git a/src/Controller/Backend/SetupController.php b/src/Controller/Backend/SetupController.php index 36f86f89..0671b84e 100644 --- a/src/Controller/Backend/SetupController.php +++ b/src/Controller/Backend/SetupController.php @@ -12,11 +12,15 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; use UserAccessManager\Config\WordpressConfig; use UserAccessManager\Controller\Controller; use UserAccessManager\Database\Database; +use UserAccessManager\Setup\Database\MissingColumnsException; use UserAccessManager\Setup\SetupHandler; use UserAccessManager\UserAccessManager; use UserAccessManager\Wrapper\Php; @@ -54,12 +58,11 @@ class SetupController extends Controller /** * SetupController constructor. - * - * @param Php $php - * @param Wordpress $wordpress + * @param Php $php + * @param Wordpress $wordpress * @param WordpressConfig $wordpressConfig - * @param Database $database - * @param SetupHandler $setupHandler + * @param Database $database + * @param SetupHandler $setupHandler */ public function __construct( Php $php, @@ -75,20 +78,18 @@ public function __construct( /** * Returns if a database update is necessary. - * * @return bool */ - public function isDatabaseUpdateNecessary() + public function isDatabaseUpdateNecessary(): bool { return $this->setupHandler->getDatabaseHandler()->isDatabaseUpdateNecessary(); } /** * Checks if a network update is nessary. - * * @return bool */ - public function showNetworkUpdate() + public function showNetworkUpdate(): bool { return $this->wordpress->isSuperAdmin() === true && defined('MULTISITE') === true && MULTISITE === true @@ -97,10 +98,9 @@ public function showNetworkUpdate() /** * Returns the existing backups - * * @return array */ - public function getBackups() + public function getBackups(): array { return $this->setupHandler->getDatabaseHandler()->getBackups(); } @@ -113,7 +113,7 @@ public function updateDatabaseAction() $success = true; $this->verifyNonce(self::SETUP_UPDATE_NONCE); $update = $this->getRequestParameter('uam_update_db'); - $backup = (bool)$this->getRequestParameter('uam_backup_db', false); + $backup = (bool) $this->getRequestParameter('uam_backup_db', false); if ($update === self::UPDATE_BLOG || $update === self::UPDATE_NETWORK) { $currentBlogId = $this->database->getCurrentBlogId(); @@ -130,8 +130,8 @@ public function updateDatabaseAction() $this->wordpress->restoreCurrentBlog(); } - $message = $success === true ? TXT_UAM_UAM_DB_UPDATE_SUCCESS : TXT_UAM_UAM_DB_UPDATE_FAILURE; - $this->setUpdateMessage($message); + $message = $success === true ? TXT_UAM_UAM_DB_UPDATE_SUCCESS : TXT_UAM_UAM_DB_UPDATE_FAILURE; + $this->setUpdateMessage($message); } } @@ -150,10 +150,10 @@ public function revertDatabaseAction() /** * Checks if the database is broken. - * * @return bool + * @throws MissingColumnsException */ - public function isDatabaseBroken() + public function isDatabaseBroken(): bool { $information = $this->setupHandler->getDatabaseHandler()->getCorruptedDatabaseInformation(); @@ -170,6 +170,7 @@ function ($carry, $item) { /** * Repairs the database. + * @throws MissingColumnsException */ public function repairDatabaseAction() { @@ -203,6 +204,7 @@ public function deleteDatabaseBackupAction() /** * The reset action. + * @throws MissingColumnsException */ public function resetUamAction() { diff --git a/src/Controller/Backend/TermObjectController.php b/src/Controller/Backend/TermObjectController.php index 86708703..dd12c66f 100644 --- a/src/Controller/Backend/TermObjectController.php +++ b/src/Controller/Backend/TermObjectController.php @@ -12,9 +12,14 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; use UserAccessManager\Object\ObjectHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; +use WP_Term; /** * Class TermObjectController @@ -25,12 +30,10 @@ class TermObjectController extends ObjectController { /** * The function for the manage_categories_columns filter. - * * @param array $defaults The table headers. - * * @return array */ - public function addTermColumnsHeader($defaults) + public function addTermColumnsHeader(array $defaults): array { $defaults[self::COLUMN_NAME] = TXT_UAM_COLUMN_ACCESS; return $defaults; @@ -38,14 +41,13 @@ public function addTermColumnsHeader($defaults) /** * The function for the manage_categories_custom_column action. - * - * @param string $content Content for the column. Multiple filter calls are possible, so we need to append. - * @param string $columnName The column name. - * @param integer $id The id. - * + * @param string $content Content for the column. Multiple filter calls are possible, so we need to append. + * @param string $columnName The column name. + * @param integer $id The id. * @return string $content with content appended for self::COLUMN_NAME column + * @throws UserGroupTypeException */ - public function addTermColumn($content, $columnName, $id) + public function addTermColumn(string $content, string $columnName, int $id): string { if ($columnName === self::COLUMN_NAME) { $term = $this->objectHandler->getTerm($id); @@ -58,12 +60,12 @@ public function addTermColumn($content, $columnName, $id) /** * The function for the edit_{term}_form action. - * - * @param string|\WP_Term $term The term. + * @param string|WP_Term $term The term. + * @throws UserGroupTypeException */ public function showTermEditForm($term) { - if ($term instanceof \WP_Term) { + if ($term instanceof WP_Term) { $this->setObjectInformation($term->taxonomy, $term->term_id); } else { $this->setObjectInformation($term, null); @@ -74,8 +76,8 @@ public function showTermEditForm($term) /** * The function for the edit_term action. - * - * @param integer $termId The term id. + * @param int|string $termId The term id. + * @throws UserGroupTypeException */ public function saveTermData($termId) { @@ -86,8 +88,7 @@ public function saveTermData($termId) /** * The function for the delete_{term} action. - * - * @param integer $termId The id of the term. + * @param int|string $termId The id of the term. */ public function removeTermData($termId) { diff --git a/src/Controller/Backend/UserGroupController.php b/src/Controller/Backend/UserGroupController.php index 5c06d63d..f2642ecf 100644 --- a/src/Controller/Backend/UserGroupController.php +++ b/src/Controller/Backend/UserGroupController.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; +use Exception; use UserAccessManager\Config\WordpressConfig; use UserAccessManager\Controller\Controller; use UserAccessManager\Form\FormHelper; @@ -21,8 +25,11 @@ use UserAccessManager\UserGroup\UserGroup; use UserAccessManager\UserGroup\UserGroupFactory; use UserAccessManager\UserGroup\UserGroupHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Wrapper\Php; use UserAccessManager\Wrapper\Wordpress; +use WP_Post_Type; +use WP_Taxonomy; /** * Class UserGroupController @@ -61,19 +68,18 @@ class UserGroupController extends Controller private $formHelper; /** - * @var \UserAccessManager\UserGroup\UserGroup + * @var UserGroup */ private $userGroup = null; /** * UserGroupController constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param WordpressConfig $wordpressConfig + * @param Php $php + * @param Wordpress $wordpress + * @param WordpressConfig $wordpressConfig * @param UserGroupHandler $userGroupHandler * @param UserGroupFactory $userGroupFactory - * @param FormHelper $formHelper + * @param FormHelper $formHelper */ public function __construct( Php $php, @@ -91,10 +97,9 @@ public function __construct( /** * Returns the tab groups. - * * @return array */ - public function getTabGroups() + public function getTabGroups(): array { return [ self::GROUP_USER_GROUPS => ['user_groups'], @@ -108,24 +113,20 @@ public function getTabGroups() /** * Returns the translated tag group name by the given key. - * * @param string $key - * * @return string */ - public function getGroupText($key) + public function getGroupText(string $key): string { return $this->formHelper->getText($key); } /** * Returns the translated tag group section name by the given key. - * * @param string $key - * * @return string */ - public function getGroupSectionText($key) + public function getGroupSectionText(string $key): string { $objects = $this->wordpress->getPostTypes(['public' => true], 'objects') + $this->wordpress->getTaxonomies(['public' => true], 'objects'); @@ -137,10 +138,10 @@ public function getGroupSectionText($key) } elseif (isset($objects[$key]) === true) { $objectName = $objects[$key]->labels->name; - if ($objects[$key] instanceof \WP_Post_Type) { - $objectName .= ' ('.TXT_UAM_POST_TYPE.')'; - } elseif ($objects[$key] instanceof \WP_Taxonomy) { - $objectName .= ' ('.TXT_UAM_TAXONOMY_TYPE.')'; + if ($objects[$key] instanceof WP_Post_Type) { + $objectName .= ' (' . TXT_UAM_POST_TYPE . ')'; + } elseif ($objects[$key] instanceof WP_Taxonomy) { + $objectName .= ' (' . TXT_UAM_TAXONOMY_TYPE . ')'; } } @@ -149,10 +150,10 @@ public function getGroupSectionText($key) /** * Returns the a user group object. - * - * @return \UserAccessManager\UserGroup\UserGroup + * @return UserGroup + * @throws UserGroupTypeException */ - public function getUserGroup() + public function getUserGroup(): UserGroup { if ($this->userGroup === null) { $userGroupId = $this->getRequestParameter('userGroupId'); @@ -164,12 +165,10 @@ public function getUserGroup() /** * Returns the sort url. - * * @param string $sort - * * @return string */ - public function getSortUrl($sort) + public function getSortUrl(string $sort): string { $requestUrl = $this->getRequestUrl(); $requestUrl = preg_replace('/&orderby[^&]*/i', '', $requestUrl); @@ -181,26 +180,26 @@ public function getSortUrl($sort) /** * Returns all user groups. - * - * @return \UserAccessManager\UserGroup\UserGroup[] + * @return UserGroup[] + * @throws UserGroupTypeException */ - public function getUserGroups() + public function getUserGroups(): array { $userGroups = $this->userGroupHandler->getUserGroups(); $sort = $this->getRequestParameter('orderby'); if ($sort !== null) { - $reverse = (string) $this->getRequestParameter('order') === 'desc' ? true : false; + $reverse = (string) $this->getRequestParameter('order') === 'desc'; uasort( $userGroups, function (UserGroup $userGroupOne, UserGroup $userGroupTwo) use ($sort, $reverse) { $values = ['', '']; - $method = 'get'.ucfirst($sort); + $method = 'get' . ucfirst($sort); if (method_exists($userGroupOne, $method) === true) { - $values = [(string)$userGroupOne->{$method}(), (string)$userGroupTwo->{$method}()]; + $values = [(string) $userGroupOne->{$method}(), (string) $userGroupTwo->{$method}()]; $values = ($reverse === true) ? array_reverse($values) : $values; } @@ -214,10 +213,9 @@ function (UserGroup $userGroupOne, UserGroup $userGroupTwo) use ($sort, $reverse /** * Returns the wordpress role names. - * * @return array */ - public function getRoleNames() + public function getRoleNames(): array { $roles = $this->wordpress->getRoles(); return $roles->role_names; @@ -225,6 +223,8 @@ public function getRoleNames() /** * Action to insert or update a user group. + * @throws UserGroupTypeException + * @throws Exception */ public function insertUpdateUserGroupAction() { @@ -235,7 +235,7 @@ public function insertUpdateUserGroupAction() $userGroup = $this->userGroupFactory->createUserGroup($userGroupId); // Assign parameters - $groupName = $this->getRequestParameter('userGroupName'); + $groupName = (string) $this->getRequestParameter('userGroupName'); if (trim($groupName) === '') { $this->setUpdateMessage(TXT_UAM_GROUP_NAME_ERROR); @@ -277,6 +277,7 @@ public function insertUpdateUserGroupAction() /** * Action to delete user groups. + * @throws UserGroupTypeException */ public function deleteUserGroupAction() { @@ -292,19 +293,21 @@ public function deleteUserGroupAction() /** * Checks if the default user group type should be added. - * - * @param array $defaultUserGroups - * @param string $userGroupId + * @param array $defaultUserGroups + * @param string $userGroupId * @param null|string $fromTime * @param null|string $toTime - * * @return bool */ - private function isDefaultTypeAdd(array $defaultUserGroups, $userGroupId, &$fromTime = null, &$toTime = null) - { + private function isDefaultTypeAdd( + array $defaultUserGroups, + string $userGroupId, + &$fromTime = null, + &$toTime = null + ): bool { $userGroupInfo = isset($defaultUserGroups[$userGroupId]) === true ? $defaultUserGroups[$userGroupId] : []; - if (isset($userGroupInfo['id']) === true && (string)$userGroupInfo['id'] === (string)$userGroupId) { + if (isset($userGroupInfo['id']) === true && (string) $userGroupInfo['id'] === (string) $userGroupId) { $fromTime = empty($userGroupInfo['fromTime']) === false ? $userGroupInfo['fromTime'] : null; $toTime = empty($userGroupInfo['toTime']) === false ? $userGroupInfo['toTime'] : null; return true; @@ -315,6 +318,8 @@ private function isDefaultTypeAdd(array $defaultUserGroups, $userGroupId, &$from /** * Action to set default user groups. + * @throws UserGroupTypeException + * @throws Exception */ public function setDefaultUserGroupsAction() { diff --git a/src/Controller/Backend/UserObjectController.php b/src/Controller/Backend/UserObjectController.php index a5f16657..fc4d8f2a 100644 --- a/src/Controller/Backend/UserObjectController.php +++ b/src/Controller/Backend/UserObjectController.php @@ -12,9 +12,13 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Backend; use UserAccessManager\Object\ObjectHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; /** * Class UserObjectController @@ -25,12 +29,10 @@ class UserObjectController extends ObjectController { /** * The function for the manage_users_columns filter. - * * @param array $defaults The table headers. - * * @return array */ - public function addUserColumnsHeader($defaults) + public function addUserColumnsHeader(array $defaults): array { $defaults[self::COLUMN_NAME] = TXT_UAM_COLUMN_USER_GROUPS; return $defaults; @@ -38,14 +40,14 @@ public function addUserColumnsHeader($defaults) /** * The function for the manage_users_custom_column action. - * - * @param string $return The normal return value. - * @param string $columnName The column name. - * @param integer $id The id. - * + * @param string $return The normal return value. + * @param string $columnName The column name. + * @param integer $id The id. * @return string|null + * @throws UserGroupTypeException + * @throws UserGroupTypeException */ - public function addUserColumn($return, $columnName, $id) + public function addUserColumn(string $return, string $columnName, int $id): ?string { if ($columnName === self::COLUMN_NAME) { $this->setObjectInformation(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $id); @@ -57,6 +59,7 @@ public function addUserColumn($return, $columnName, $id) /** * The function for the edit_user_profile action. + * @throws UserGroupTypeException */ public function showUserProfile() { @@ -68,20 +71,20 @@ public function showUserProfile() /** * The function for the profile_update action. - * * @param integer $userId The user id. + * @throws UserGroupTypeException + * @throws UserGroupTypeException */ - public function saveUserData($userId) + public function saveUserData(int $userId) { $this->saveObjectData(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $userId); } /** * The function for the delete_user action. - * * @param integer $userId The user id. */ - public function removeUserData($userId) + public function removeUserData(int $userId) { $this->removeObjectData(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $userId); } diff --git a/src/Controller/BaseControllerTrait.php b/src/Controller/BaseControllerTrait.php index 05509377..f25b394f 100644 --- a/src/Controller/BaseControllerTrait.php +++ b/src/Controller/BaseControllerTrait.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller; +use Exception; use UserAccessManager\Config\WordpressConfig; use UserAccessManager\Wrapper\Php; @@ -27,12 +31,12 @@ trait BaseControllerTrait /** * @return Php */ - abstract protected function getPhp(); + abstract protected function getPhp(): Php; /** * @return WordpressConfig */ - abstract protected function getWordpressConfig(); + abstract protected function getWordpressConfig(): WordpressConfig; /** * @var string @@ -41,20 +45,17 @@ abstract protected function getWordpressConfig(); /** * Returns the current request url. - * - * @return string + * @return string */ - public function getRequestUrl() + public function getRequestUrl(): string { return htmlentities($_SERVER['REQUEST_URI']); } /** * Sanitize the given value. - * - * @param mixed $value - * - * @return mixed + * @param mixed $value + * @return array|string */ private function sanitizeValue($value) { @@ -80,13 +81,11 @@ private function sanitizeValue($value) /** * Returns the request parameter. - * - * @param string $name - * @param mixed $default - * - * @return mixed + * @param string $name + * @param mixed $default + * @return mixed */ - public function getRequestParameter($name, $default = null) + public function getRequestParameter(string $name, $default = null) { $return = (isset($_POST[$name]) === true) ? $this->sanitizeValue($_POST[$name]) : null; @@ -99,12 +98,10 @@ public function getRequestParameter($name, $default = null) /** * Returns the content of the excluded php file. - * - * @param string $fileName The view file name - * - * @return string + * @param string $fileName The view file name + * @return string */ - protected function getIncludeContents($fileName) + protected function getIncludeContents(string $fileName): string { $contents = ''; $realPath = rtrim($this->getWordpressConfig()->getRealPath(), DIRECTORY_SEPARATOR); @@ -118,7 +115,7 @@ protected function getIncludeContents($fileName) $this->getPhp()->includeFile($this, $fileWithPath); $contents = ob_get_contents(); ob_end_clean(); - } catch (\Exception $exception) { + } catch (Exception $exception) { $contents = "Error on including content '{$fileWithPath}': {$exception->getMessage()}"; ob_end_clean(); } diff --git a/src/Controller/Controller.php b/src/Controller/Controller.php index 52921e42..6e935128 100644 --- a/src/Controller/Controller.php +++ b/src/Controller/Controller.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller; use UserAccessManager\Config\WordpressConfig; @@ -55,8 +58,7 @@ abstract class Controller /** * Controller constructor. - * - * @param Php $php + * @param Php $php * @param Wordpress $wordpress * @param WordpressConfig $wordpressConfig */ @@ -70,7 +72,7 @@ public function __construct(Php $php, Wordpress $wordpress, WordpressConfig $wor /** * @return Php */ - protected function getPhp() + protected function getPhp(): Php { return $this->php; } @@ -78,41 +80,36 @@ protected function getPhp() /** * @return WordpressConfig */ - protected function getWordpressConfig() + protected function getWordpressConfig(): WordpressConfig { return $this->wordpressConfig; } /** * Returns the nonce field. - * - * @param string $name - * - * @return string + * @param string $name + * @return string */ - public function createNonceField($name) + public function createNonceField(string $name): string { return $this->wordpress->getNonceField($name, $name.'Nonce'); } /** * Returns the nonce. - * - * @param string $name - * - * @return string + * @param string $name + * @return string */ - public function getNonce($name) + public function getNonce(string $name): string { return $this->wordpress->createNonce($name); } /** * Verifies the nonce and terminates the application if the nonce is wrong. - * - * @param string $name + * @param string $name */ - protected function verifyNonce($name) + protected function verifyNonce(string $name) { $nonce = $this->getRequestParameter($name.'Nonce'); @@ -123,20 +120,18 @@ protected function verifyNonce($name) /** * Sets the update message. - * - * @param string $message + * @param string $message */ - protected function setUpdateMessage($message) + protected function setUpdateMessage(string $message) { $this->updateMessage = $message; } /** * Adds an error message. - * - * @param string $message + * @param string $message */ - protected function addErrorMessage($message) + protected function addErrorMessage(string $message) { if (isset($_SESSION[BackendController::UAM_ERRORS]) === false) { $_SESSION[BackendController::UAM_ERRORS] = []; @@ -147,20 +142,18 @@ protected function addErrorMessage($message) /** * Returns the update message. - * - * @return string + * @return string */ - public function getUpdateMessage() + public function getUpdateMessage(): ?string { return $this->updateMessage; } /** * Returns true if a update message is set. - * - * @return bool + * @return bool */ - public function hasUpdateMessage() + public function hasUpdateMessage(): bool { return $this->updateMessage !== null; } @@ -170,7 +163,7 @@ public function hasUpdateMessage() */ protected function processAction() { - $postAction = $this->getRequestParameter(self::ACTION_PARAMETER); + $postAction = (string) $this->getRequestParameter(self::ACTION_PARAMETER); $postActionSplit = explode('_', $postAction); $postAction = array_shift($postActionSplit); $postAction .= implode('', array_map('ucfirst', $postActionSplit)); diff --git a/src/Controller/ControllerFactory.php b/src/Controller/ControllerFactory.php index 3ccefe05..770424ff 100644 --- a/src/Controller/ControllerFactory.php +++ b/src/Controller/ControllerFactory.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller; use UserAccessManager\Access\AccessHandler; @@ -166,8 +169,7 @@ class ControllerFactory /** * ControllerFactory constructor. - * - * @param Php $php + * @param Php $php * @param Wordpress $wordpress * @param Database $database * @param WordpressConfig $wordpressConfig @@ -237,10 +239,9 @@ public function __construct( /** * Creates and returns a new backend controller. - * - * @return BackendController + * @return BackendController */ - public function createBackendController() + public function createBackendController(): BackendController { return new BackendController( $this->php, @@ -254,10 +255,9 @@ public function createBackendController() /** * Creates and returns a new backend about controller. - * - * @return AboutController + * @return AboutController */ - public function createBackendAboutController() + public function createBackendAboutController(): AboutController { return new AboutController( $this->php, @@ -268,10 +268,9 @@ public function createBackendAboutController() /** * Creates and returns a new backend object controller. - * - * @return ObjectController + * @return ObjectController */ - public function createBackendObjectController() + public function createBackendObjectController(): ObjectController { return new ObjectController( $this->php, @@ -291,10 +290,9 @@ public function createBackendObjectController() /** * Creates and returns a new backend cache controller. - * - * @return CacheController + * @return CacheController */ - public function createBackendCacheController() + public function createBackendCacheController(): CacheController { return new CacheController( $this->cache @@ -303,10 +301,9 @@ public function createBackendCacheController() /** * Creates and returns a new backend post object controller. - * - * @return PostObjectController + * @return PostObjectController */ - public function createBackendPostObjectController() + public function createBackendPostObjectController(): PostObjectController { return new PostObjectController( $this->php, @@ -326,10 +323,9 @@ public function createBackendPostObjectController() /** * Creates and returns a new backend term object controller. - * - * @return TermObjectController + * @return TermObjectController */ - public function createBackendTermObjectController() + public function createBackendTermObjectController(): TermObjectController { return new TermObjectController( $this->php, @@ -349,10 +345,9 @@ public function createBackendTermObjectController() /** * Creates and returns a new backend user object controller. - * - * @return UserObjectController + * @return UserObjectController */ - public function createBackendUserObjectController() + public function createBackendUserObjectController(): UserObjectController { return new UserObjectController( $this->php, @@ -372,10 +367,9 @@ public function createBackendUserObjectController() /** * Creates and returns a new backend dynamic group controller. - * - * @return DynamicGroupsController + * @return DynamicGroupsController */ - public function createBackendDynamicGroupsController() + public function createBackendDynamicGroupsController(): DynamicGroupsController { return new DynamicGroupsController( $this->php, @@ -395,10 +389,9 @@ public function createBackendDynamicGroupsController() /** * Creates and returns a new backend setup controller. - * - * @return SettingsController + * @return SettingsController */ - public function createBackendSettingsController() + public function createBackendSettingsController(): SettingsController { return new SettingsController( $this->php, @@ -414,10 +407,9 @@ public function createBackendSettingsController() /** * Creates and returns a new backend setup controller. - * - * @return SetupController + * @return SetupController */ - public function createBackendSetupController() + public function createBackendSetupController(): SetupController { return new SetupController( $this->php, @@ -430,10 +422,9 @@ public function createBackendSetupController() /** * Creates and returns a new backend user group controller. - * - * @return UserGroupController + * @return UserGroupController */ - public function createBackendUserGroupController() + public function createBackendUserGroupController(): UserGroupController { return new UserGroupController( $this->php, @@ -447,10 +438,9 @@ public function createBackendUserGroupController() /** * Creates and returns a new frontend controller. - * - * @return FrontendController + * @return FrontendController */ - public function createFrontendController() + public function createFrontendController(): FrontendController { return new FrontendController( $this->php, @@ -463,10 +453,9 @@ public function createFrontendController() /** * Creates and returns a new frontend post controller. - * - * @return PostController + * @return PostController */ - public function createFrontendPostController() + public function createFrontendPostController(): PostController { return new PostController( $this->php, @@ -484,10 +473,9 @@ public function createFrontendPostController() /** * Creates and returns a new frontend redirect controller. - * - * @return RedirectController + * @return RedirectController */ - public function createFrontendRedirectController() + public function createFrontendRedirectController(): RedirectController { return new RedirectController( $this->php, @@ -506,10 +494,9 @@ public function createFrontendRedirectController() /** * Creates and returns a new frontend short code controller. - * - * @return ShortCodeController + * @return ShortCodeController */ - public function createFrontendShortCodeController() + public function createFrontendShortCodeController(): ShortCodeController { return new ShortCodeController( $this->php, @@ -521,10 +508,9 @@ public function createFrontendShortCodeController() /** * Creates and returns a new frontend term controller. - * - * @return TermController + * @return TermController */ - public function createFrontendTermController() + public function createFrontendTermController(): TermController { return new TermController( $this->php, diff --git a/src/Controller/Frontend/AdminOutputControllerTrait.php b/src/Controller/Frontend/AdminOutputControllerTrait.php index cfc5f489..8d6805a8 100644 --- a/src/Controller/Frontend/AdminOutputControllerTrait.php +++ b/src/Controller/Frontend/AdminOutputControllerTrait.php @@ -12,12 +12,16 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Frontend; use UserAccessManager\Config\MainConfig; use UserAccessManager\Config\WordpressConfig; use UserAccessManager\User\UserHandler; use UserAccessManager\UserGroup\UserGroupHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Util\Util; use UserAccessManager\Wrapper\Wordpress; @@ -31,39 +35,38 @@ trait AdminOutputControllerTrait /** * @return Wordpress */ - abstract protected function getWordpress(); + abstract protected function getWordpress(): Wordpress; /** * @return WordpressConfig */ - abstract protected function getWordpressConfig(); + abstract protected function getWordpressConfig(): WordpressConfig; /** * @return MainConfig */ - abstract protected function getMainConfig(); + abstract protected function getMainConfig(): MainConfig; /** * @return Util */ - abstract protected function getUtil(); + abstract protected function getUtil(): Util; /** * @return UserHandler */ - abstract protected function getUserHandler(); + abstract protected function getUserHandler(): UserHandler; /** * @return UserGroupHandler */ - abstract protected function getUserGroupHandler(); + abstract protected function getUserGroupHandler(): UserGroupHandler; /** * Returns true if the hint text should be shown. - * * @return bool */ - private function showAdminHint() + private function showAdminHint(): bool { return $this->getWordpressConfig()->atAdminPanel() === false && $this->getMainConfig()->blogAdminHint() === true; @@ -71,31 +74,28 @@ private function showAdminHint() /** * Returns the admin hint. - * - * @param string $objectType The object type. - * @param integer $objectId The object id we want to check. - * @param string $text The text on which we want to append the hint. - * + * @param string $objectType The object type. + * @param int|string $objectId The object id we want to check. + * @param null $text The text on which we want to append the hint. * @return string + * @throws UserGroupTypeException */ - public function adminOutput($objectType, $objectId, $text = null) + public function adminOutput(string $objectType, $objectId, $text = null): string { - $output = ''; - if ($this->showAdminHint() === true) { $hintText = $this->getMainConfig()->getBlogAdminHintText(); if ($text !== null && $this->getUtil()->endsWith($text, $hintText) === true) { - return $output; + return ''; } if ($this->getUserHandler()->userIsAdmin($this->getWordpress()->getCurrentUser()->ID) === true && count($this->getUserGroupHandler()->getUserGroupsForObject($objectType, $objectId)) > 0 ) { - $output .= $hintText; + return $hintText; } } - return $output; + return ''; } } diff --git a/src/Controller/Frontend/ContentController.php b/src/Controller/Frontend/ContentController.php index bd98bde4..fa691e15 100644 --- a/src/Controller/Frontend/ContentController.php +++ b/src/Controller/Frontend/ContentController.php @@ -1,5 +1,7 @@ wordpress; } @@ -102,7 +103,7 @@ protected function getWordpress() /** * @return MainConfig */ - protected function getMainConfig() + protected function getMainConfig(): MainConfig { return $this->mainConfig; } @@ -110,7 +111,7 @@ protected function getMainConfig() /** * @return Util */ - protected function getUtil() + protected function getUtil(): Util { return $this->util; } @@ -118,7 +119,7 @@ protected function getUtil() /** * @return UserHandler */ - protected function getUserHandler() + protected function getUserHandler(): UserHandler { return $this->userHandler; } @@ -126,12 +127,12 @@ protected function getUserHandler() /** * @return UserGroupHandler */ - protected function getUserGroupHandler() + protected function getUserGroupHandler(): UserGroupHandler { return $this->userGroupHandler; } - protected function removePostFromList($postType) + protected function removePostFromList($postType): bool { return $this->mainConfig->hidePostType($postType) === true || $this->wordpressConfig->atAdminPanel() === true; diff --git a/src/Controller/Frontend/FrontendController.php b/src/Controller/Frontend/FrontendController.php index fbb7743a..7ab96228 100644 --- a/src/Controller/Frontend/FrontendController.php +++ b/src/Controller/Frontend/FrontendController.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Frontend; use UserAccessManager\Access\AccessHandler; @@ -19,6 +22,7 @@ use UserAccessManager\Config\WordpressConfig; use UserAccessManager\Controller\Controller; use UserAccessManager\UserAccessManager; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Wrapper\Php; use UserAccessManager\Wrapper\Wordpress; @@ -43,8 +47,7 @@ class FrontendController extends Controller /** * FrontendController constructor. - * - * @param Php $php + * @param Php $php * @param Wordpress $wordpress * @param WordpressConfig $wordpressConfig * @param MainConfig $mainConfig @@ -93,14 +96,13 @@ public function enqueueStylesAndScripts() /** * The function for the get_ancestors filter. - * - * @param array $ancestors - * @param int $objectId + * @param array $ancestors + * @param int|string $objectId * @param string $objectType - * - * @return array + * @return array + * @throws UserGroupTypeException */ - public function showAncestors($ancestors, $objectId, $objectType) + public function showAncestors(array $ancestors, $objectId, string $objectType): array { if ($this->mainConfig->lockRecursive() === true && $this->accessHandler->checkObjectAccess($objectType, $objectId) === false @@ -124,16 +126,14 @@ public function showAncestors($ancestors, $objectId, $objectType) /** * Filter for Yoast SEO Plugin - * - * Hides the url from the site map if the user has no access - * - * @param string $url The url to check - * @param string $type The object type + * Hides the url from the site map if the user has no access + * @param string $url The url to check + * @param string $type The object type * @param object $object The object - * - * @return false|string + * @return false|string + * @throws UserGroupTypeException */ - public function getWpSeoUrl($url, $type, $object) + public function getWpSeoUrl(string $url, string $type, object $object) { return ($this->accessHandler->checkObjectAccess($type, $object->ID) === true) ? $url : false; } diff --git a/src/Controller/Frontend/LoginControllerTrait.php b/src/Controller/Frontend/LoginControllerTrait.php index 49a59feb..742342b0 100644 --- a/src/Controller/Frontend/LoginControllerTrait.php +++ b/src/Controller/Frontend/LoginControllerTrait.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Frontend; use UserAccessManager\Wrapper\Wordpress; @@ -26,27 +29,25 @@ trait LoginControllerTrait /** * @return Wordpress */ - abstract protected function getWordpress(); + abstract protected function getWordpress(): Wordpress; /** * @return string */ - abstract public function getRequestUrl(); + abstract public function getRequestUrl(): string; /** * @param string $name - * @param mixed $default - * - * @return mixed + * @param mixed $default + * @return mixed */ - abstract public function getRequestParameter($name, $default = null); + abstract public function getRequestParameter(string $name, $default = null); /** * Returns the user login name. - * - * @return string + * @return string */ - public function getUserLogin() + public function getUserLogin(): string { $userLogin = $this->getRequestParameter('log'); return $this->getWordpress()->escHtml(stripslashes($userLogin)); @@ -54,40 +55,36 @@ public function getUserLogin() /** * Returns true if the user is logged in. - * - * @return bool + * @return bool */ - public function isUserLoggedIn() + public function isUserLoggedIn(): bool { return $this->getWordpress()->isUserLoggedIn(); } /** * Returns the user name of the current user - * - * @return string + * @return string */ - public function getCurrentUserName() + public function getCurrentUserName(): string { return $this->getWordpress()->getCurrentUser()->display_name; } /** * Returns the login url. - * - * @return string + * @return string */ - public function getLoginUrl() + public function getLoginUrl(): string { return $this->getWordpress()->wpLoginUrl($this->getRequestUrl()); } /** * Returns the logout url. - * - * @return string + * @return string */ - public function getLogoutUrl() + public function getLogoutUrl(): string { return $this->getWordpress()->wpLogoutUrl($this->getRequestUrl()); } @@ -95,38 +92,34 @@ public function getLogoutUrl() /** * Returns the registration url. - * - * @return string + * @return string */ - public function getRegistrationUrl() + public function getRegistrationUrl(): string { return $this->getWordpress()->wpRegistrationUrl(); } /** * Returns the lost password url. - * - * @return string + * @return string */ - public function getLostPasswordUrl() + public function getLostPasswordUrl(): string { return $this->getWordpress()->wpLostPasswordUrl($this->getRequestUrl()); } /** * Checks if we allowed show the login form. - * - * @return bool + * @return bool */ - public function showLoginForm() + public function showLoginForm(): bool { return $this->getWordpress()->isSingle() === true || $this->getWordpress()->isPage() === true; } /** * Returns the login redirect url. - * - * @return mixed + * @return mixed */ public function getRedirectLoginUrl() { diff --git a/src/Controller/Frontend/PostController.php b/src/Controller/Frontend/PostController.php index 615063ad..ef2abc2b 100644 --- a/src/Controller/Frontend/PostController.php +++ b/src/Controller/Frontend/PostController.php @@ -12,19 +12,28 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Frontend; +use stdClass; use UserAccessManager\Access\AccessHandler; use UserAccessManager\Config\MainConfig; use UserAccessManager\Config\WordpressConfig; use UserAccessManager\Database\Database; use UserAccessManager\Object\ObjectHandler; -use UserAccessManager\UserGroup\AbstractUserGroup; use UserAccessManager\User\UserHandler; +use UserAccessManager\UserGroup\AbstractUserGroup; use UserAccessManager\UserGroup\UserGroupHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Util\Util; use UserAccessManager\Wrapper\Php; use UserAccessManager\Wrapper\Wordpress; +use WP_Comment; +use WP_Hook; +use WP_Post; +use WP_Query; /** * Class FrontendPostController @@ -44,23 +53,22 @@ class PostController extends ContentController private $wordpressFilters = []; /** - * @var null|\stdClass + * @var null|stdClass */ private $cachedCounts = []; /** * PostController constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param WordpressConfig $wordpressConfig - * @param MainConfig $mainConfig - * @param Database $database - * @param Util $util - * @param ObjectHandler $objectHandler - * @param UserHandler $userHandler + * @param Php $php + * @param Wordpress $wordpress + * @param WordpressConfig $wordpressConfig + * @param MainConfig $mainConfig + * @param Database $database + * @param Util $util + * @param ObjectHandler $objectHandler + * @param UserHandler $userHandler * @param UserGroupHandler $userGroupHandler - * @param AccessHandler $accessHandler + * @param AccessHandler $accessHandler */ public function __construct( Php $php, @@ -88,16 +96,21 @@ public function __construct( $this->database = $database; } - + /** + * Return the wordpress filters. + * @return array + */ + public function getWordpressFilters(): array + { + return $this->wordpressFilters; + } /** * Returns true if the filters are suppressed. - * - * @param \WP_Query $wpQuery - * + * @param WP_Query $wpQuery * @return bool */ - private function filtersSuppressed($wpQuery) + private function filtersSuppressed(WP_Query $wpQuery): bool { return isset($wpQuery->query_vars['suppress_filters']) === true && $wpQuery->query_vars['suppress_filters'] === true; @@ -105,10 +118,10 @@ private function filtersSuppressed($wpQuery) /** * Manipulates the wordpress query object to filter content. - * - * @param \WP_Query $wpQuery The wordpress query object. + * @param WP_Query $wpQuery The wordpress query object. + * @throws UserGroupTypeException */ - public function parseQuery($wpQuery) + public function parseQuery(WP_Query $wpQuery) { if ($this->filtersSuppressed($wpQuery) === true) { $excludedPosts = $this->accessHandler->getExcludedPosts(); @@ -126,12 +139,10 @@ public function parseQuery($wpQuery) /** * Extracts the user access manager filters and returns true if it was successful. - * - * @param \WP_Hook[] $filters - * + * @param WP_Hook[] $filters * @return bool */ - private function extractOwnFilters(array &$filters) + private function extractOwnFilters(array $filters): bool { if (isset($filters['the_posts']->callbacks[10]) === true) { foreach ($filters['the_posts']->callbacks[10] as $postFilter) { @@ -153,13 +164,11 @@ private function extractOwnFilters(array &$filters) * If filters are suppressed we still want to filter posts, so we have to turn the suppression off, * remove all other filters than the ones from the user access manager and store them to restore * them later. - * - * @param array $posts - * @param \WP_Query $query - * - * @return mixed + * @param array|null $posts + * @param WP_Query $query + * @return null|array */ - public function postsPreQuery($posts, \WP_Query $query) + public function postsPreQuery(?array $posts, WP_Query $query): ?array { if ($this->filtersSuppressed($query) === true) { $filters = $this->wordpress->getFilters(); @@ -199,14 +208,12 @@ private function restoreFilters() /** * Tries to get the post from the given mixed data. - * * @param mixed $post - * - * @return false|\WP_Post + * @return false|WP_Post */ private function getPost($post) { - if ($post instanceof \WP_post) { + if ($post instanceof WP_post) { return $post; } elseif (is_int($post) === true) { return $this->objectHandler->getPost($post); @@ -219,19 +226,17 @@ private function getPost($post) /** * Processes the post content and searches for the more tag. - * - * @param \WP_Post $post - * + * @param WP_Post $post * @return string */ - private function processPostContent(\WP_Post $post) + private function processPostContent(WP_Post $post): string { $uamPostContent = htmlspecialchars_decode($this->mainConfig->getPostTypeContent($post->post_type)); if ($this->mainConfig->showPostTypeContentBeforeMore($post->post_type) === true && preg_match('//', $post->post_content, $matches) ) { - $uamPostContent = explode($matches[0], $post->post_content)[0].' '.$uamPostContent; + $uamPostContent = explode($matches[0], $post->post_content)[0] . ' ' . $uamPostContent; } return stripslashes($uamPostContent); @@ -239,12 +244,11 @@ private function processPostContent(\WP_Post $post) /** * Modifies the content of the post by the given settings. - * - * @param \WP_Post $post The current post. - * - * @return null|\WP_Post + * @param WP_Post $post The current post. + * @return null|WP_Post + * @throws UserGroupTypeException */ - private function processPost(\WP_Post $post) + private function processPost(WP_Post $post): ?WP_Post { $post->post_title .= $this->adminOutput($post->post_type, $post->ID); @@ -269,12 +273,11 @@ private function processPost(\WP_Post $post) /** * Filters the raw posts. - * * @param array $rawPosts - * * @return array + * @throws UserGroupTypeException */ - private function filterRawPosts(array $rawPosts) + private function filterRawPosts(array $rawPosts): array { $filteredPosts = []; @@ -297,12 +300,11 @@ private function filterRawPosts(array $rawPosts) /** * The function for the the_posts filter. - * * @param array $showPosts The posts. - * * @return array + * @throws UserGroupTypeException */ - public function showPosts($showPosts = []) + public function showPosts($showPosts = []): array { if ($this->wordpress->isFeed() === false || $this->mainConfig->protectFeed() === true) { $showPosts = $this->filterRawPosts($showPosts); @@ -315,29 +317,27 @@ public function showPosts($showPosts = []) /** * The function for the get_pages filter. - * - * @param \WP_Post[] $rawPages The pages. - * + * @param WP_Post[] $rawPages The pages. * @return array + * @throws UserGroupTypeException */ - public function showPages($rawPages = []) + public function showPages($rawPages = []): array { return $this->filterRawPosts($rawPages); } /** * Checks the access of the attached file. - * * @param string $file - * @param int $attachmentId - * + * @param int $attachmentId * @return string|false + * @throws UserGroupTypeException */ - public function getAttachedFile($file, $attachmentId) + public function getAttachedFile(string $file, int $attachmentId) { $isImage = (bool) preg_match('/(?i)\.(jpg|jpeg|jpe|png|gif)$/', $file); - if ($this->mainConfig->lockFile() === true && $isImage === false) { + if ($isImage === false && $this->mainConfig->lockFile() === true) { $hasAccess = $this->accessHandler->checkObjectAccess(ObjectHandler::ATTACHMENT_OBJECT_TYPE, $attachmentId); return ($hasAccess === true) ? $file : false; } @@ -347,13 +347,12 @@ public function getAttachedFile($file, $attachmentId) /** * Adds the excluded posts filter to the given query. - * * @param string $query * @param string $table - * * @return string + * @throws UserGroupTypeException */ - private function addQueryExcludedPostFilter($query, $table) + private function addQueryExcludedPostFilter(string $query, string $table): string { $excludedPosts = $this->accessHandler->getExcludedPosts(); @@ -367,12 +366,11 @@ private function addQueryExcludedPostFilter($query, $table) /** * The function for the posts_where_paged filter. - * * @param string $query The where sql statement. - * * @return string + * @throws UserGroupTypeException */ - public function showPostSql($query) + public function showPostSql(string $query): string { return $this->addQueryExcludedPostFilter($query, $this->database->getPostsTable()); } @@ -380,26 +378,23 @@ public function showPostSql($query) /** * The function for the get_previous_post_where and * the get_next_post_where filter. - * * @param string $query The current sql string. - * * @return string + * @throws UserGroupTypeException */ - public function showNextPreviousPost($query) + public function showNextPreviousPost(string $query): string { return $this->addQueryExcludedPostFilter($query, 'p'); } /** * Returns the post count query. - * - * @param array $excludedPosts + * @param array $excludedPosts * @param string $type * @param string $perm - * * @return string */ - private function getPostCountQuery(array $excludedPosts, $type, $perm) + private function getPostCountQuery(array $excludedPosts, string $type, string $perm): string { $excludedPosts = implode('\', \'', $excludedPosts); $query = "SELECT post_status, COUNT(*) AS num_posts @@ -425,21 +420,20 @@ private function getPostCountQuery(array $excludedPosts, $type, $perm) /** * Function for the wp_count_posts filter. - * - * @param \stdClass $counts - * @param string $type - * @param string $perm - * - * @return \stdClass + * @param stdClass $counts + * @param string $type + * @param string $perm + * @return stdClass + * @throws UserGroupTypeException */ - public function showPostCount($counts, $type, $perm) + public function showPostCount(stdClass $counts, string $type, string $perm): stdClass { if (isset($this->cachedCounts[$type]) === false) { $excludedPosts = $this->accessHandler->getExcludedPosts(); if ($excludedPosts !== []) { $query = $this->getPostCountQuery($excludedPosts, $type, $perm); - $results = (array)$this->database->getResults( + $results = (array) $this->database->getResults( $this->database->prepare($query, $type), ARRAY_A ); @@ -459,12 +453,10 @@ public function showPostCount($counts, $type, $perm) /** * Checks if the post comment should be completely hidden. - * * @param string $postType - * * @return bool */ - private function hidePostComment($postType) + private function hidePostComment(string $postType): bool { return $this->mainConfig->lockPostTypeComments($postType) === true || $this->mainConfig->hidePostType($postType) === true @@ -473,12 +465,11 @@ private function hidePostComment($postType) /** * The function for the comments_array filter. - * - * @param \WP_Comment[] $comments The comments. - * + * @param WP_Comment[] $comments The comments. * @return array + * @throws UserGroupTypeException */ - public function showComment($comments = []) + public function showComment($comments = []): array { $showComments = []; @@ -505,13 +496,12 @@ public function showComment($comments = []) /** * The function for the edit_post_link filter. - * - * @param string $link The edit link. + * @param string $link The edit link. * @param integer $postId The _iId of the post. - * * @return string + * @throws UserGroupTypeException */ - public function showEditLink($link, $postId) + public function showEditLink(string $link, int $postId): string { if ($this->mainConfig->hideEditLinkOnNoAccess() === true && $this->accessHandler->checkObjectAccess(ObjectHandler::GENERAL_POST_OBJECT_TYPE, $postId, true) === false @@ -534,7 +524,7 @@ function (AbstractUserGroup $group) { ); $link .= $link !== '' ? ' | ' : ' '; - $link .= TXT_UAM_ASSIGNED_GROUPS.': '.implode(', ', $escapedGroups); + $link .= TXT_UAM_ASSIGNED_GROUPS . ': ' . implode(', ', $escapedGroups); } } diff --git a/src/Controller/Frontend/RedirectController.php b/src/Controller/Frontend/RedirectController.php index 0a2c561b..4a4ce7f2 100644 --- a/src/Controller/Frontend/RedirectController.php +++ b/src/Controller/Frontend/RedirectController.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Frontend; use UserAccessManager\Access\AccessHandler; @@ -24,6 +27,7 @@ use UserAccessManager\File\FileObject; use UserAccessManager\File\FileObjectFactory; use UserAccessManager\Object\ObjectHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Util\Util; use UserAccessManager\Wrapper\Php; use UserAccessManager\Wrapper\Wordpress; @@ -81,17 +85,16 @@ class RedirectController extends Controller /** * RedirectController constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param WordpressConfig $wordpressConfig - * @param MainConfig $mainConfig - * @param Database $database - * @param Util $util - * @param Cache $cache - * @param ObjectHandler $objectHandler - * @param AccessHandler $accessHandler - * @param FileHandler $fileHandler + * @param Php $php + * @param Wordpress $wordpress + * @param WordpressConfig $wordpressConfig + * @param MainConfig $mainConfig + * @param Database $database + * @param Util $util + * @param Cache $cache + * @param ObjectHandler $objectHandler + * @param AccessHandler $accessHandler + * @param FileHandler $fileHandler * @param FileObjectFactory $fileObjectFactory */ public function __construct( @@ -121,19 +124,17 @@ public function __construct( /** * @return Wordpress */ - protected function getWordpress() + protected function getWordpress(): Wordpress { return $this->wordpress; } /** * Returns the post by the given url. - * * @param string $url The url of the post(attachment). - * * @return int */ - public function getPostIdByUrl($url) + public function getPostIdByUrl(string $url): int { $postUrls = (array)$this->cache->getFromRuntimeCache(self::POST_URL_CACHE_KEY); @@ -142,9 +143,9 @@ public function getPostIdByUrl($url) } //Filter size - $newUrlPieces = preg_split('/-[0-9]{1,}x[0-9]{1,}(_[a-z])?/', $url); - $newUrl = (count($newUrlPieces) === 2) ? $newUrlPieces[0].$newUrlPieces[1] : $newUrlPieces[0]; - $newUrl = preg_replace('/\-pdf\.jpg$/', '.pdf', $newUrl); + $newUrlPieces = preg_split('/-[0-9]+x[0-9]+(_[a-z])?/', $url); + $newUrl = (count($newUrlPieces) === 2) ? $newUrlPieces[0] . $newUrlPieces[1] : $newUrlPieces[0]; + $newUrl = preg_replace('/-pdf\.jpg$/', '.pdf', $newUrl); $postUrls[$url] = $this->wordpress->attachmentUrlToPostId($newUrl); $this->cache->addToRuntimeCache(self::POST_URL_CACHE_KEY, $postUrls); @@ -154,35 +155,32 @@ public function getPostIdByUrl($url) /** * Returns the file object by the given type and url. - * * @param string $objectType The type of the requested file. - * @param string $objectUrl The file url. - * + * @param string $objectUrl The file url. * @return null|FileObject */ - private function getFileSettingsByType($objectType, $objectUrl) + private function getFileSettingsByType(string $objectType, string $objectUrl): ?FileObject { $fileObject = null; if ($objectType === ObjectHandler::ATTACHMENT_OBJECT_TYPE) { $uploadDirs = $this->wordpress->getUploadDir(); $uploadDir = str_replace(ABSPATH, '/', $uploadDirs['basedir']); - $regex = '/.*'.str_replace('/', '\/', $uploadDir).'\//i'; + $regex = '/.*' . str_replace('/', '\/', $uploadDir) . '\//i'; $cleanObjectUrl = preg_replace($regex, '', $objectUrl); $uploadUrl = str_replace('/files', $uploadDir, $uploadDirs['baseurl']); - $objectUrl = rtrim($uploadUrl, '/').'/'.ltrim($cleanObjectUrl, '/'); + $objectUrl = rtrim($uploadUrl, '/') . '/' . ltrim($cleanObjectUrl, '/'); $post = $this->objectHandler->getPost($this->getPostIdByUrl($objectUrl)); + $postType = $post->post_type ?? ''; - if ($post !== false - && $post->post_type === ObjectHandler::ATTACHMENT_OBJECT_TYPE - ) { + if ($postType === ObjectHandler::ATTACHMENT_OBJECT_TYPE) { $multiPath = str_replace('/files', $uploadDir, $uploadDirs['baseurl']); $fileObject = $this->fileObjectFactory->createFileObject( $post->ID, $objectType, - $uploadDirs['basedir'].str_replace($multiPath, '', $objectUrl), + $uploadDirs['basedir'] . str_replace($multiPath, '', $objectUrl), $this->wordpress->attachmentIsImage($post->ID) ); } @@ -203,11 +201,11 @@ private function getFileSettingsByType($objectType, $objectUrl) /** * Delivers the content of the requested file. - * * @param string $objectType The type of the requested file. - * @param string $objectUrl The file url. + * @param string $objectUrl The file url. + * @throws UserGroupTypeException */ - public function getFile($objectType, $objectUrl) + public function getFile(string $objectType, string $objectUrl) { $fileObject = $this->getFileSettingsByType($objectType, $objectUrl); @@ -222,7 +220,7 @@ public function getFile($objectType, $objectUrl) $file = $this->mainConfig->getCustomNoAccessImage(); } else { $realPath = $this->wordpressConfig->getRealPath(); - $file = $realPath.'assets'.DIRECTORY_SEPARATOR.'gfx'.DIRECTORY_SEPARATOR.'noAccessPic.png'; + $file = $realPath . 'assets' . DIRECTORY_SEPARATOR . 'gfx' . DIRECTORY_SEPARATOR . 'noAccessPic.png'; } } else { $this->wordpress->wpDie(TXT_UAM_NO_RIGHTS_MESSAGE, TXT_UAM_NO_RIGHTS_TITLE, ['response' => 403]); @@ -234,12 +232,10 @@ public function getFile($objectType, $objectUrl) /** * Returns the redirect url and the permalink of the post if exists. - * * @param null|string $permalink - * * @return null|string */ - private function getRedirectUrlAndPermalink(&$permalink) + private function getRedirectUrlAndPermalink(?string &$permalink): ?string { $permalink = null; $redirect = $this->mainConfig->getRedirect(); @@ -266,8 +262,8 @@ private function getRedirectUrlAndPermalink(&$permalink) /** * Redirects the user to his destination. - * * @param bool $checkPosts + * @throws UserGroupTypeException */ public function redirectUser($checkPosts = true) { @@ -292,12 +288,10 @@ public function redirectUser($checkPosts = true) /** * Returns the post id by the post name. - * * @param string $name - * * @return int */ - private function getPostIdByName($name) + private function getPostIdByName(string $name): int { $postableTypes = implode('\',\'', $this->objectHandler->getPostTypes()); @@ -309,17 +303,16 @@ private function getPostIdByName($name) $name ); - return (int)$this->database->getVariable($query); + return (int) $this->database->getVariable($query); } /** * Extracts the object type and id. - * - * @param object $pageParams + * @param object $pageParams * @param null|string $objectType - * @param null|string $objectId + * @param null|int|string $objectId */ - private function extractObjectTypeAndId($pageParams, &$objectType, &$objectId) + private function extractObjectTypeAndId(object $pageParams, ?string &$objectType, ?string &$objectId) { $objectType = null; $objectId = null; @@ -344,21 +337,20 @@ private function extractObjectTypeAndId($pageParams, &$objectType, &$objectId) $object = $this->wordpress->getPageByPath($pageParams->query_vars['pagename']); if ($object !== null) { - $objectType = $object->post_type; - $objectId = $object->ID; + $objectType = $object->post_type ?? null; + $objectId = $object->ID ?? null; } } } /** * Redirects to a page or to content. - * - * @param string $headers The headers which are given from wordpress. + * @param array $headers The headers which are given from wordpress. * @param object $pageParams The params of the current page. - * - * @return string + * @return array + * @throws UserGroupTypeException */ - public function redirect($headers, $pageParams) + public function redirect(array $headers, object $pageParams): array { $fileUrl = $this->getRequestParameter('uamgetfile'); $fileType = $this->getRequestParameter('uamfiletype'); @@ -380,13 +372,11 @@ public function redirect($headers, $pageParams) /** * Returns the url for a locked file. - * - * @param string $url The base url. - * @param integer $id The _iId of the file. - * + * @param string $url The base url. + * @param integer $id The _iId of the file. * @return string */ - public function getFileUrl($url, $id) + public function getFileUrl(string $url, int $id): string { // Nginx always supports real urls so we need the new urls only // if we don't use nginx and mod_rewrite is disabled @@ -398,13 +388,13 @@ public function getFileUrl($url, $id) if ($post !== null) { $type = explode('/', $post->post_mime_type); - $type = (isset($type[1]) === true) ? $type[1] : $type[0]; + $type = $type[1] ?? $type[0]; $lockedFileTypes = $this->mainConfig->getLockedFiles(); $fileTypes = explode(',', $lockedFileTypes); if ($lockedFileTypes === 'all' || in_array($type, $fileTypes) === true) { - $url = $this->wordpress->getHomeUrl('/').'?uamfiletype=attachment&uamgetfile='.$url; + $url = $this->wordpress->getHomeUrl('/') . '?uamfiletype=attachment&uamgetfile=' . $url; } } } @@ -414,15 +404,13 @@ public function getFileUrl($url, $id) /** * Caches the urls for the post for a later lookup. - * - * @param string $url The url of the post. + * @param string $url The url of the post. * @param object $post The post object. - * * @return string */ - public function cachePostLinks($url, $post) + public function cachePostLinks(string $url, object $post): string { - $postUrls = (array)$this->cache->getFromRuntimeCache(self::POST_URL_CACHE_KEY); + $postUrls = (array) $this->cache->getFromRuntimeCache(self::POST_URL_CACHE_KEY); $postUrls[$url] = $post->ID; $this->cache->addToRuntimeCache(self::POST_URL_CACHE_KEY, $postUrls); return $url; diff --git a/src/Controller/Frontend/ShortCodeController.php b/src/Controller/Frontend/ShortCodeController.php index 072002ff..f13783b6 100644 --- a/src/Controller/Frontend/ShortCodeController.php +++ b/src/Controller/Frontend/ShortCodeController.php @@ -12,11 +12,15 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Frontend; use UserAccessManager\Config\WordpressConfig; use UserAccessManager\Controller\Controller; use UserAccessManager\UserGroup\UserGroupHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Wrapper\Php; use UserAccessManager\Wrapper\Wordpress; @@ -36,8 +40,7 @@ class ShortCodeController extends Controller /** * ShortCodeController constructor. - * - * @param Php $php + * @param Php $php * @param Wordpress $wordpress * @param WordpressConfig $wordpressConfig * @param UserGroupHandler $userGroupHandler @@ -55,17 +58,16 @@ public function __construct( /** * @return Wordpress */ - protected function getWordpress() + protected function getWordpress(): Wordpress { return $this->wordpress; } /** * Returns the login bar. - * - * @return string + * @return string */ - public function getLoginFormHtml() + public function getLoginFormHtml(): string { $loginForm = ''; @@ -78,49 +80,43 @@ public function getLoginFormHtml() /** * Handles the login form short code. - * - * @return string + * @return string */ - public function loginFormShortCode() + public function loginFormShortCode(): string { return $this->getLoginFormHtml(); } /** * Handles the public short code. - * - * @param array $attributes + * @param array $attributes * @param string $content - * - * @return string + * @return string */ - public function publicShortCode($attributes, $content = '') + public function publicShortCode(array $attributes, $content = ''): string { return ($this->wordpress->isUserLoggedIn() === false) ? $this->wordpress->doShortCode($content) : ''; } /** * Returns the user group map from the short code attribute. - * - * @param array $attributes - * - * @return array + * @param array $attributes + * @return array */ - private function getUserGroupsMapFromAttributes(array $attributes) + private function getUserGroupsMapFromAttributes(array $attributes): array { $userGroups = (isset($attributes['group']) === true) ? explode(',', $attributes['group']) : []; - return (array)array_flip(array_map('trim', $userGroups)); + return (array) array_flip(array_map('trim', $userGroups)); } /** * Handles the private short code. - * - * @param array $attributes + * @param array $attributes * @param string $content - * - * @return string + * @return string + * @throws UserGroupTypeException */ - public function privateShortCode($attributes, $content = '') + public function privateShortCode(array $attributes, $content = ''): string { if ($this->wordpress->isUserLoggedIn() === true) { $userGroupMap = $this->getUserGroupsMapFromAttributes($attributes); diff --git a/src/Controller/Frontend/TermController.php b/src/Controller/Frontend/TermController.php index 2c98f238..101e7157 100644 --- a/src/Controller/Frontend/TermController.php +++ b/src/Controller/Frontend/TermController.php @@ -12,8 +12,13 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Controller\Frontend; +use Exception; +use stdClass; use UserAccessManager\Access\AccessHandler; use UserAccessManager\Config\MainConfig; use UserAccessManager\Config\WordpressConfig; @@ -21,9 +26,12 @@ use UserAccessManager\Object\ObjectMapHandler; use UserAccessManager\User\UserHandler; use UserAccessManager\UserGroup\UserGroupHandler; +use UserAccessManager\UserGroup\UserGroupTypeException; use UserAccessManager\Util\Util; use UserAccessManager\Wrapper\Php; use UserAccessManager\Wrapper\Wordpress; +use WP_Post; +use WP_Term; /** * Class FrontendTermController @@ -44,17 +52,16 @@ class TermController extends ContentController /** * TermController constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param WordpressConfig $wordpressConfig - * @param MainConfig $mainConfig - * @param Util $util - * @param ObjectHandler $objectHandler + * @param Php $php + * @param Wordpress $wordpress + * @param WordpressConfig $wordpressConfig + * @param MainConfig $mainConfig + * @param Util $util + * @param ObjectHandler $objectHandler * @param ObjectMapHandler $objectMapHandler - * @param UserHandler $userHandler + * @param UserHandler $userHandler * @param UserGroupHandler $userGroupHandler - * @param AccessHandler $accessHandler + * @param AccessHandler $accessHandler */ public function __construct( Php $php, @@ -84,10 +91,9 @@ public function __construct( /** * Returns the post object hide config. - * * @return array */ - private function getPostObjectHideConfig() + private function getPostObjectHideConfig(): ?array { if ($this->postObjectHideConfig === null) { $this->postObjectHideConfig = []; @@ -102,13 +108,11 @@ private function getPostObjectHideConfig() /** * Returns all posts for the given term. - * * @param string $termType - * @param int $termId - * + * @param int $termId * @return array */ - private function getAllPostForTerm($termType, $termId) + private function getAllPostForTerm(string $termType, int $termId): array { $fullTerms = [$termId => $termType]; $termTreeMap = $this->objectMapHandler->getTermTreeMap(); @@ -133,15 +137,14 @@ private function getAllPostForTerm($termType, $termId) /** * Returns the post count for the term. - * * @param string $termType - * @param int $termId - * + * @param int $termId * @return int + * @throws UserGroupTypeException */ - private function getVisibleElementsCount($termType, $termId) + private function getVisibleElementsCount(string $termType, int $termId): int { - $key = $termType.'|'.$termId; + $key = $termType . '|' . $termId; if (isset($this->visibleElementsCount[$key]) === false) { $count = 0; @@ -167,12 +170,10 @@ private function getVisibleElementsCount($termType, $termId) /** * Checks if the category is empty. - * * @param $term - * * @return bool */ - private function isCategoryEmpty($term) + private function isCategoryEmpty($term): bool { return $term->count <= 0 && $this->wordpressConfig->atAdminPanel() === false @@ -181,12 +182,11 @@ private function isCategoryEmpty($term) /** * Updates the term parent. - * - * @param \WP_Term $term - * - * @return \WP_Term + * @param WP_Term $term + * @return WP_Term + * @throws UserGroupTypeException */ - private function updateTermParent(\WP_Term $term) + private function updateTermParent(WP_Term $term): WP_Term { $currentTerm = $term; @@ -213,17 +213,17 @@ private function updateTermParent(\WP_Term $term) /** * Modifies the content of the term by the given settings. - * - * @param mixed $term - * @param bool $isEmpty - * - * @return null|\WP_Term + * @param stdClass|WP_Term $term + * @param bool $isEmpty + * @return null|stdClass|WP_Term + * @throws UserGroupTypeException + * @throws Exception */ private function processTerm($term, &$isEmpty = null) { $isEmpty = false; - if (($term instanceof \WP_Term) === false + if (($term instanceof WP_Term) === false || $this->objectHandler->isValidObjectType($term->taxonomy) === false ) { return $term; @@ -246,10 +246,9 @@ private function processTerm($term, &$isEmpty = null) /** * The function for the get_term filter. - * - * @param \WP_Term $term - * + * @param stdClass|WP_Term $term * @return null|object + * @throws UserGroupTypeException */ public function showTerm($term) { @@ -258,16 +257,15 @@ public function showTerm($term) /** * The function for the get_terms filter. - * * @param array $terms The terms. - * * @return array + * @throws UserGroupTypeException */ - public function showTerms($terms = []) + public function showTerms($terms = []): array { foreach ($terms as $key => $term) { if (is_numeric($term) === true) { - if ((int)$term === 0) { + if ((int) $term === 0) { unset($terms[$key]); continue; } @@ -287,12 +285,11 @@ public function showTerms($terms = []) /** * Processes a post menu item. - * - * @param \stdClass $item - * + * @param object $item * @return bool + * @throws UserGroupTypeException */ - private function processPostMenuItem(&$item) + private function processPostMenuItem(object $item): bool { if ($this->accessHandler->checkObjectAccess($item->object, $item->object_id) === false) { if ($this->removePostFromList($item->object) === true) { @@ -309,12 +306,11 @@ private function processPostMenuItem(&$item) /** * Processes a term menu item. - * - * @param \stdClass $item - * + * @param mixed $item * @return bool + * @throws UserGroupTypeException */ - private function processTermMenuItem(&$item) + private function processTermMenuItem(&$item): bool { $rawTerm = $this->objectHandler->getTerm($item->object_id); $term = $this->processTerm($rawTerm, $isEmpty); @@ -324,12 +320,11 @@ private function processTermMenuItem(&$item) /** * The function for the wp_get_nav_menu_items filter. - * * @param array $items The menu item. - * * @return array + * @throws UserGroupTypeException */ - public function showCustomMenu($items) + public function showCustomMenu(array $items): array { $showItems = []; @@ -354,12 +349,11 @@ public function showCustomMenu($items) /** * Sets the excluded terms as argument. - * * @param array $arguments - * * @return array + * @throws UserGroupTypeException */ - public function getTermArguments(array $arguments) + public function getTermArguments(array $arguments): array { $exclude = (isset($arguments['exclude']) === true) ? $this->wordpress->parseIdList($arguments['exclude']) : []; diff --git a/src/Database/Database.php b/src/Database/Database.php index 4006c0bc..7c8724b2 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -13,9 +13,12 @@ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ +declare(strict_types=1); + namespace UserAccessManager\Database; use UserAccessManager\Wrapper\Wordpress; +use wpdb; /** * Class Database @@ -33,13 +36,12 @@ class Database private $wordpress; /** - * @var \wpdb + * @var wpdb */ private $wpDatabase; /** * Database constructor. - * * @param Wordpress $wordpress */ public function __construct(Wordpress $wordpress) @@ -50,61 +52,54 @@ public function __construct(Wordpress $wordpress) /** * Returns the wordpress database. - * - * @return \wpdb + * @return wpdb */ - public function getWordpressDatabase() + public function getWordpressDatabase(): wpdb { return $this->wpDatabase; } /** * Returns the user group table name. - * * @return string */ - public function getUserGroupTable() + public function getUserGroupTable(): string { - return $this->wpDatabase->prefix.self::USER_GROUP_TABLE_NAME; + return $this->wpDatabase->prefix . self::USER_GROUP_TABLE_NAME; } /** * Returns the user group table name. - * * @return string */ - public function getUserGroupToObjectTable() + public function getUserGroupToObjectTable(): string { - return $this->wpDatabase->prefix.self::USER_GROUP_TO_OBJECT_TABLE_NAME; + return $this->wpDatabase->prefix . self::USER_GROUP_TO_OBJECT_TABLE_NAME; } /** - * @see dbDelta() - * * @param string $queries - * @param bool $execute - * + * @param bool $execute * @return array + * @see dbDelta() */ - public function dbDelta($queries = '', $execute = true) + public function dbDelta($queries = '', $execute = true): array { return $this->wordpress->dbDelta($queries, $execute); } /** - * @see \wpdb::$prefix - * * @return string + * @see \wpdb::$prefix */ - public function getPrefix() + public function getPrefix(): string { return $this->wpDatabase->prefix; } /** * Returns the last insert id. - * - * @return int + * @return mixed */ public function getLastInsertId() { @@ -113,8 +108,7 @@ public function getLastInsertId() /** * Returns the current blog id. - * - * @return int + * @return int|string */ public function getCurrentBlogId() { @@ -123,85 +117,75 @@ public function getCurrentBlogId() /** * Returns the blogs table name. - * * @return string */ - public function getBlogsTable() + public function getBlogsTable(): string { return $this->wpDatabase->blogs; } /** * Returns the posts table name. - * * @return string */ - public function getPostsTable() + public function getPostsTable(): string { return $this->wpDatabase->posts; } /** * Returns the term_relationships table name. - * * @return string */ - public function getTermRelationshipsTable() + public function getTermRelationshipsTable(): string { return $this->wpDatabase->term_relationships; } /** * Returns the term_taxonomy table name. - * * @return string */ - public function getTermTaxonomyTable() + public function getTermTaxonomyTable(): string { return $this->wpDatabase->term_taxonomy; } /** * Returns the users table name. - * * @return string */ - public function getUsersTable() + public function getUsersTable(): string { return $this->wpDatabase->users; } /** * Returns the capabilities table name. - * * @return string */ - public function getCapabilitiesTable() + public function getCapabilitiesTable(): string { - return $this->wpDatabase->prefix.'capabilities'; + return $this->wpDatabase->prefix . 'capabilities'; } /** - * @see \wpdb::get_col() - * * @param string $query - * @param int $column - * + * @param int $column * @return array + * @see \wpdb::get_col() */ - public function getColumn($query = null, $column = 0) + public function getColumn($query = null, $column = 0): array { return $this->wpDatabase->get_col($query, $column); } /** - * @see \wpdb::get_row() - * * @param string $query * @param string $output - * @param int $row - * + * @param int $row * @return array|null|object + * @see \wpdb::get_row() */ public function getRow($query = null, $output = OBJECT, $row = 0) { @@ -209,13 +193,11 @@ public function getRow($query = null, $output = OBJECT, $row = 0) } /** - * @see \wpdb::get_var() - * * @param null|string $query - * @param int $column - * @param int $row - * - * @return null|string + * @param int $column + * @param int $row + * @return null|int|string + * @see \wpdb::get_var() */ public function getVariable($query = null, $column = 0, $row = 0) { @@ -223,49 +205,41 @@ public function getVariable($query = null, $column = 0, $row = 0) } /** - * @see \wpdb::get_blog_prefix() - * * @param int $blogId - * * @return string + * @see \wpdb::get_blog_prefix() */ - public function getBlogPrefix($blogId = null) + public function getBlogPrefix($blogId = null): string { return $this->wpDatabase->get_blog_prefix($blogId); } /** - * @see \wpdb::prepare() - * * @param string $query - * @param mixed $arguments - * + * @param mixed $arguments * @return string + * @see \wpdb::prepare() */ - public function prepare($query, $arguments) + public function prepare(string $query, $arguments): string { return $this->wpDatabase->prepare($query, $arguments); } /** - * @see \wpdb::query() - * * @param string $query - * * @return false|int + * @see \wpdb::query() */ - public function query($query) + public function query(string $query) { return $this->wpDatabase->query($query); } /** - * @see \wpdb::get_results() - * * @param string $query * @param string $output - * * @return array|null|object + * @see \wpdb::get_results() */ public function getResults($query = null, $output = OBJECT) { @@ -273,69 +247,60 @@ public function getResults($query = null, $output = OBJECT) } /** - * @see \wpdb::insert() - * - * @param string $table - * @param array $data - * @param array|string $format - * + * @param string $table + * @param array $data + * @param null $format * @return false|int + * @see \wpdb::insert() */ - public function insert($table, array $data, $format = null) + public function insert(string $table, array $data, $format = null) { return $this->wpDatabase->insert($table, $data, $format); } /** - * @see \wpdb::update() - * - * @param string $table - * @param array $data - * @param array $where - * @param array|string $format - * @param array|string $whereFormat - * + * @param string $table + * @param array $data + * @param array $where + * @param null $format + * @param null $whereFormat * @return false|int + * @see \wpdb::update() */ - public function update($table, array $data, array $where, $format = null, $whereFormat = null) + public function update(string $table, array $data, array $where, $format = null, $whereFormat = null) { return $this->wpDatabase->update($table, $data, $where, $format, $whereFormat); } /** - * @see \wpdb::insert() - * - * @param string $table - * @param array $data - * @param array|string $format - * + * @param string $table + * @param array $data + * @param null $format * @return false|int + * @see \wpdb::insert() */ - public function replace($table, array $data, $format = null) + public function replace(string $table, array $data, $format = null) { return $this->wpDatabase->replace($table, $data, $format); } /** - * @see \wpdb::delete() - * - * @param string $table - * @param array $where - * @param array|string $whereFormat - * + * @param string $table + * @param array $where + * @param null $whereFormat * @return false|int + * @see \wpdb::delete() */ - public function delete($table, array $where, $whereFormat = null) + public function delete(string $table, array $where, $whereFormat = null) { return $this->wpDatabase->delete($table, $where, $whereFormat); } /** * Returns the database charset. - * * @return string */ - public function getCharset() + public function getCharset(): string { $charsetCollate = ''; diff --git a/src/File/ApacheFileProtection.php b/src/File/ApacheFileProtection.php index 313c2f1f..0d782995 100644 --- a/src/File/ApacheFileProtection.php +++ b/src/File/ApacheFileProtection.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\File; +use Exception; use UserAccessManager\Object\ObjectHandler; /** @@ -27,10 +31,9 @@ class ApacheFileProtection extends FileProtection implements FileProtectionInter /** * Returns the file types. - * * @return null|string */ - private function getFileTypes() + private function getFileTypes(): ?string { $fileTypes = null; $lockedFileTypes = $this->mainConfig->getLockedFileType(); @@ -48,13 +51,12 @@ private function getFileTypes() /** * Returns the directory match. - * * @return null|string */ - protected function getDirectoryMatch() + protected function getDirectoryMatch(): ?string { if ($this->mainConfig->getLockedDirectoryType() === 'wordpress') { - return '^.*'.DIRECTORY_SEPARATOR.parent::getDirectoryMatch().'.*$'; + return '^.*' . DIRECTORY_SEPARATOR . parent::getDirectoryMatch() . '.*$'; } return parent::getDirectoryMatch(); @@ -62,10 +64,9 @@ protected function getDirectoryMatch() /** * @param string $content - * * @return string */ - private function applyFilters($content) + private function applyFilters(string $content): string { $fileTypes = $this->getFileTypes(); @@ -79,39 +80,35 @@ private function applyFilters($content) /** * Creates the file content if no permalinks are active. - * * @param string $directory - * * @return string */ - private function getFileContent($directory) + private function getFileContent(string $directory): string { $areaName = 'WP-Files'; // make .htaccess and .htpasswd - $content = "AuthType Basic"."\n"; - $content .= "AuthName \"{$areaName}\""."\n"; - $content .= "AuthUserFile {$directory}.htpasswd"."\n"; - $content .= "require valid-user"."\n"; + $content = "AuthType Basic" . "\n"; + $content .= "AuthName \"{$areaName}\"" . "\n"; + $content .= "AuthUserFile {$directory}.htpasswd" . "\n"; + $content .= "require valid-user" . "\n"; return $this->applyFilters($content); } /** * Creates the file content if permalinks are active. - * - * @param string $objectType - * @param bool $isSubSite - * + * @param string|null $objectType + * @param bool|null $isSubSite * @return string */ - private function getPermalinkFileContent($objectType, $isSubSite = false) + private function getPermalinkFileContent(?string $objectType, ?bool $isSubSite = false): string { if ($objectType === null) { $objectType = ObjectHandler::ATTACHMENT_OBJECT_TYPE; } $homeRoot = parse_url($this->wordpress->getSiteUrl()); - $homeRoot = (isset($homeRoot['path']) === true) ? '/'.trim($homeRoot['path'], '/\\').'/' : '/'; + $homeRoot = (isset($homeRoot['path']) === true) ? '/' . trim($homeRoot['path'], '/\\') . '/' : '/'; $content = "RewriteEngine On\n"; $content .= "RewriteBase {$homeRoot}\n"; @@ -140,27 +137,24 @@ private function getPermalinkFileContent($objectType, $isSubSite = false) /** * Returns the htaccess file name with path. - * * @param null|string $directory - * * @return string */ - public function getFileNameWithPath($directory = null) + public function getFileNameWithPath($directory = null): string { - return $directory.self::FILE_NAME; + return $directory . self::FILE_NAME; } /** * Generates the htaccess file. - * * @param string $directory - * @param string $objectType - * + * @param string|null $objectType + * @param string|null $absolutePath * @return bool */ - public function create($directory, $objectType = null) + public function create(string $directory, ?string $objectType = null, ?string $absolutePath = null): bool { - $directory = rtrim($directory, '/').'/'; + $directory = rtrim($directory, '/') . '/'; if ($this->wordpress->gotModRewrite() === false) { $content = $this->getFileContent($directory); @@ -178,7 +172,7 @@ public function create($directory, $objectType = null) try { file_put_contents($fileWithPath, $content); return true; - } catch (\Exception $exception) { + } catch (Exception $exception) { // Because file_put_contents can throw exceptions we use this try catch block // to return the success result instead of an exception } @@ -188,12 +182,10 @@ public function create($directory, $objectType = null) /** * Deletes the htaccess files. - * * @param string $directory - * * @return bool */ - public function delete($directory) + public function delete(string $directory): bool { return $this->deleteFiles($directory); } diff --git a/src/File/FileHandler.php b/src/File/FileHandler.php index 46e364ba..4f58d3eb 100644 --- a/src/File/FileHandler.php +++ b/src/File/FileHandler.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\File; use UserAccessManager\Config\MainConfig; @@ -55,11 +58,10 @@ class FileHandler /** * FileHandler constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param WordpressConfig $wordpressConfig - * @param MainConfig $mainConfig + * @param Php $php + * @param Wordpress $wordpress + * @param WordpressConfig $wordpressConfig + * @param MainConfig $mainConfig * @param FileProtectionFactory $fileProtectionFactory */ public function __construct( @@ -82,7 +84,7 @@ public function __construct( private function clearBuffer() { //prevent '\n' / '0A' - if ((int)$this->php->iniGet('output_buffering') === 0 + if ((int) $this->php->iniGet('output_buffering') === 0 && is_numeric(ob_get_length()) === true ) { ob_clean(); @@ -93,12 +95,10 @@ private function clearBuffer() /** * Returns the file mine type. - * * @param string $file - * * @return string */ - private function getFileMineType($file) + private function getFileMineType(string $file): string { $fileName = basename($file); @@ -125,32 +125,30 @@ private function getFileMineType($file) $fileMimeType = 'application/octet-stream'; } - return (string)$fileMimeType; + return (string) $fileMimeType; } /** * Adds the default header. - * * @param string $file - * @param bool $isInline + * @param bool $isInline */ - private function addDefaultHeader($file, $isInline) + private function addDefaultHeader(string $file, bool $isInline) { $fileMimeType = $this->getFileMineType($file); $contentDisposition = ($isInline === true) ? 'inline' : 'attachment'; $baseName = str_replace(' ', '_', basename($file)); header('Content-Description: File Transfer'); - header('Content-Type: '.$fileMimeType); + header('Content-Type: ' . $fileMimeType); header("Content-Disposition: {$contentDisposition}; filename=\"{$baseName}\""); } /** * Delivers the file via fopen. - * * @param string $file */ - private function deliverFileViaFopen($file) + private function deliverFileViaFopen(string $file) { $handler = fopen($file, 'r'); @@ -165,11 +163,10 @@ private function deliverFileViaFopen($file) /** * Delivers the file. - * * @param string $file - * @param bool $isInline + * @param bool $isInline */ - private function deliverFile($file, $isInline) + private function deliverFile(string $file, bool $isInline) { $downloadType = $this->mainConfig->getDownloadType(); @@ -181,7 +178,7 @@ private function deliverFile($file, $isInline) if ($downloadType !== 'xsendfile') { header('Content-Transfer-Encoding: binary'); - header('Content-Length: '.filesize($file)); + header('Content-Length: ' . filesize($file)); $this->clearBuffer(); if ($downloadType === 'fopen') { @@ -194,20 +191,18 @@ private function deliverFile($file, $isInline) /** * Sets the seek start and end. - * * @param string $range - * @param int $fileSize - * @param int $seekStart - * @param int $seekEnd - * + * @param int $fileSize + * @param int|null $seekStart + * @param int|null $seekEnd * @return bool */ - private function getSeekStartEnd($range, $fileSize, &$seekStart, &$seekEnd) + private function getSeekStartEnd(string $range, int $fileSize, ?int &$seekStart, ?int &$seekEnd): bool { //Figure out download piece from range (if set) $seek = explode('-', $range); - $seekStart = ($seek[0] !== '') ? abs((int)$seek[0]) : null; - $seekEnd = (isset($seek[1]) === true && $seek[1] !== '') ? abs((int)$seek[1]) : null; + $seekStart = ($seek[0] !== '') ? abs((int) $seek[0]) : null; + $seekEnd = (isset($seek[1]) === true && $seek[1] !== '') ? abs((int) $seek[1]) : null; $maxSize = $fileSize - 1; if ($seekStart === null) { @@ -225,11 +220,10 @@ private function getSeekStartEnd($range, $fileSize, &$seekStart, &$seekEnd) /** * Reads the file partly. - * * @param resource $fileHandler - * @param int $bytes + * @param int $bytes */ - private function readFilePartly($fileHandler, $bytes) + private function readFilePartly($fileHandler, int $bytes) { $bytesLeft = $bytes; $bufferSize = 1024; @@ -249,12 +243,10 @@ private function readFilePartly($fileHandler, $bytes) /** * Returns the http ranges. - * * @param int $fileSize - * * @return array */ - private function getRanges($fileSize) + private function getRanges(int $fileSize): array { $httpRange = explode('=', $_SERVER['HTTP_RANGE']); $originRanges = isset($httpRange[1]) === true ? $httpRange[1] : ''; @@ -278,15 +270,13 @@ private function getRanges($fileSize) /** * Returns the extra contents. - * * @param string $file - * @param array $ranges - * @param int $contentLength - * @param string $boundary - * + * @param array $ranges + * @param int|null $contentLength + * @param string|null $boundary * @return array */ - private function getExtraContents($file, array $ranges, &$contentLength, &$boundary) + private function getExtraContents(string $file, array $ranges, ?int &$contentLength, ?string &$boundary): array { $contentLength = 0; $extraContents = []; @@ -317,11 +307,10 @@ private function getExtraContents($file, array $ranges, &$contentLength, &$bound /** * Delivers the file partial. - * * @param string $file - * @param bool $isInline + * @param bool $isInline */ - private function deliverFilePartial($file, $isInline) + private function deliverFilePartial(string $file, bool $isInline) { $fileSize = filesize($file); $ranges = $this->getRanges($fileSize); @@ -367,14 +356,12 @@ private function deliverFilePartial($file, $isInline) /** * Checks if the file is an inline file - * * @param string $file - * * @return bool */ - private function isInlineFile($file) + private function isInlineFile(string $file): bool { - $inlineFiles = array_map('trim', explode(',', $this->mainConfig->getInlineFiles())); + $inlineFiles = array_map('trim', explode(',', (string) $this->mainConfig->getInlineFiles())); $map = array_flip($inlineFiles); $extension = pathinfo($file, PATHINFO_EXTENSION); @@ -383,11 +370,10 @@ private function isInlineFile($file) /** * Delivers the content of the requested file. - * * @param string $file - * @param bool $isImage + * @param bool $isImage */ - public function getFile($file, $isImage) + public function getFile(string $file, bool $isImage) { //Deliver content if (file_exists($file) === true) { @@ -414,10 +400,9 @@ public function getFile($file, $isImage) /** * Returns the current file protection handler. - * * @return FileProtectionInterface */ - private function getCurrentFileProtectionHandler() + private function getCurrentFileProtectionHandler(): FileProtectionInterface { if ($this->wordpress->isNginx() === true) { return $this->fileProtectionFactory->createNginxFileProtection(); @@ -428,10 +413,9 @@ private function getCurrentFileProtectionHandler() /** * Returns the file protection file. - * * @return string */ - public function getFileProtectionFileName() + public function getFileProtectionFileName(): string { return $this->getCurrentFileProtectionHandler()->getFileNameWithPath( $this->wordpressConfig->getUploadDirectory() @@ -440,13 +424,11 @@ public function getFileProtectionFileName() /** * Creates a protection file. - * - * @param string $dir The destination directory. + * @param string $dir The destination directory. * @param string $objectType The object type. - * * @return false */ - public function createFileProtection($dir = null, $objectType = null) + public function createFileProtection($dir = null, $objectType = null): bool { $dir = ($dir === null) ? $this->wordpressConfig->getUploadDirectory() : $dir; @@ -459,12 +441,10 @@ public function createFileProtection($dir = null, $objectType = null) /** * Deletes the protection files. - * * @param string $dir The destination directory. - * * @return false */ - public function deleteFileProtection($dir = null) + public function deleteFileProtection($dir = null): bool { $dir = ($dir === null) ? $this->wordpressConfig->getUploadDirectory() : $dir; @@ -480,12 +460,12 @@ public function deleteFileProtection($dir = null) */ public function deliverXSendFileTestFile() { - $file = $this->wordpressConfig->getUploadDirectory().DIRECTORY_SEPARATOR.self::X_SEND_FILE_TEST_FILE; + $file = $this->wordpressConfig->getUploadDirectory() . DIRECTORY_SEPARATOR . self::X_SEND_FILE_TEST_FILE; file_put_contents($file, 'success'); header("X-Sendfile: {$file}"); header('Content-Type: application/octet-stream'); - header('Content-Disposition: attachment; filename="'.basename($file).'"'); + header('Content-Disposition: attachment; filename="' . basename($file) . '"'); $this->php->callExit(); } @@ -494,7 +474,7 @@ public function deliverXSendFileTestFile() */ public function removeXSendFileTestFile() { - $file = $this->wordpressConfig->getUploadDirectory().DIRECTORY_SEPARATOR.self::X_SEND_FILE_TEST_FILE; + $file = $this->wordpressConfig->getUploadDirectory() . DIRECTORY_SEPARATOR . self::X_SEND_FILE_TEST_FILE; if (file_exists($file) === true) { unlink($file); diff --git a/src/File/FileObject.php b/src/File/FileObject.php index 64998741..acec08da 100644 --- a/src/File/FileObject.php +++ b/src/File/FileObject.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\File; /** @@ -42,13 +45,12 @@ class FileObject /** * FileObject constructor. - * * @param string $id * @param string $type * @param string $file - * @param bool $isImage + * @param bool $isImage */ - public function __construct($id, $type, $file, $isImage = false) + public function __construct(string $id, string $type, string $file, $isImage = false) { $this->id = $id; $this->type = $type; @@ -58,8 +60,7 @@ public function __construct($id, $type, $file, $isImage = false) /** * Returns the file object id. - * - * @return string + * @return string|int */ public function getId() { @@ -68,30 +69,27 @@ public function getId() /** * Returns the file object type. - * * @return string */ - public function getType() + public function getType(): string { return $this->type; } /** * Returns the file object file. - * * @return string */ - public function getFile() + public function getFile(): string { return $this->file; } /** * Returns true if the file is a image. - * * @return bool */ - public function isImage() + public function isImage(): bool { return $this->isImage; } diff --git a/src/File/FileObjectFactory.php b/src/File/FileObjectFactory.php index 218302fd..15037fe0 100644 --- a/src/File/FileObjectFactory.php +++ b/src/File/FileObjectFactory.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\File; /** @@ -22,16 +25,14 @@ class FileObjectFactory { /** * Returns a new file object. - * - * @param string $id + * @param int|string $id * @param string $type * @param string $file - * @param bool $isImage - * + * @param bool $isImage * @return FileObject */ - public function createFileObject($id, $type, $file, $isImage = false) + public function createFileObject($id, string $type, string $file, $isImage = false): FileObject { - return new FileObject($id, $type, $file, $isImage); + return new FileObject((string) $id, $type, $file, $isImage); } } diff --git a/src/File/FileProtection.php b/src/File/FileProtection.php index 2aba5498..792cc531 100644 --- a/src/File/FileProtection.php +++ b/src/File/FileProtection.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\File; +use Exception; use UserAccessManager\Config\MainConfig; use UserAccessManager\Config\WordpressConfig; use UserAccessManager\Util\Util; @@ -57,12 +61,11 @@ abstract class FileProtection /** * FileProtection constructor. - * - * @param Php $php - * @param Wordpress $wordpress + * @param Php $php + * @param Wordpress $wordpress * @param WordpressConfig $wordpressConfig - * @param MainConfig $mainConfig - * @param Util $util + * @param MainConfig $mainConfig + * @param Util $util */ public function __construct( Php $php, @@ -80,16 +83,15 @@ public function __construct( /** * Returns the directory match. - * * @return null|string */ - protected function getDirectoryMatch() + protected function getDirectoryMatch(): ?string { $directoryMatch = null; $lockedDirectoryType = $this->mainConfig->getLockedDirectoryType(); if ($lockedDirectoryType === 'wordpress') { - $directoryMatch = '[0-9]{4}'.DIRECTORY_SEPARATOR.'[0-9]{2}'; + $directoryMatch = '[0-9]{4}' . DIRECTORY_SEPARATOR . '[0-9]{2}'; } elseif ($lockedDirectoryType === 'custom') { $directoryMatch = $this->mainConfig->getCustomLockedDirectories(); } @@ -99,12 +101,10 @@ protected function getDirectoryMatch() /** * Cleans up the file types. - * * @param string $fileTypes The file types which should be cleaned up. - * * @return string */ - protected function cleanUpFileTypes($fileTypes) + protected function cleanUpFileTypes(string $fileTypes): string { $validFileTypes = []; $fileTypes = explode(',', $fileTypes); @@ -123,29 +123,26 @@ protected function cleanUpFileTypes($fileTypes) /** * Returns the password file name with the path. - * - * @param string $dir - * + * @param string|null $dir * @return null|string */ - private function getDefaultPasswordFileWithPath($dir) + private function getDefaultPasswordFileWithPath(?string $dir): ?string { if ($dir === null) { $wordpressUploadDir = $this->wordpress->getUploadDir(); if (empty($wordpressUploadDir['error']) === true) { - $dir = $wordpressUploadDir['basedir'].DIRECTORY_SEPARATOR; + $dir = $wordpressUploadDir['basedir'] . DIRECTORY_SEPARATOR; } } - return ($dir !== null) ? $dir.static::PASSWORD_FILE_NAME : null; + return ($dir !== null) ? $dir . static::PASSWORD_FILE_NAME : null; } /** * Creates a htpasswd file. - * * @param boolean $createNew Force to create new file. - * @param string $dir The destination directory. + * @param string $dir The destination directory. */ public function createPasswordFile($createNew = false, $dir = null) { @@ -161,7 +158,7 @@ public function createPasswordFile($createNew = false, $dir = null) try { $randomPassword = $this->util->getRandomPassword(); $password = md5($randomPassword); - } catch (\Exception $exception) { + } catch (Exception $exception) { // Do nothing } } @@ -178,22 +175,20 @@ public function createPasswordFile($createNew = false, $dir = null) /** * Deletes the htaccess files. - * * @param string $directory - * * @return bool */ - public function deleteFiles($directory) + public function deleteFiles(string $directory): bool { $success = true; - $directory = rtrim($directory, '/').'/'; - $fileName = $directory.static::FILE_NAME; + $directory = rtrim($directory, '/') . '/'; + $fileName = $directory . static::FILE_NAME; if (file_exists($fileName) === true) { $success = ($this->php->unlink($fileName) === true) && $success; } - $passwordFile = $directory.static::PASSWORD_FILE_NAME; + $passwordFile = $directory . static::PASSWORD_FILE_NAME; if (file_exists($passwordFile) === true) { $success = ($this->php->unlink($passwordFile) === true) && $success; diff --git a/src/File/FileProtectionFactory.php b/src/File/FileProtectionFactory.php index 06d34de3..ad0dc9f7 100644 --- a/src/File/FileProtectionFactory.php +++ b/src/File/FileProtectionFactory.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\File; use UserAccessManager\Config\MainConfig; @@ -54,12 +57,11 @@ class FileProtectionFactory /** * FileProtectionFactory constructor. - * - * @param Php $php - * @param Wordpress $wordpress + * @param Php $php + * @param Wordpress $wordpress * @param WordpressConfig $wordpressConfig - * @param MainConfig $mainConfig - * @param Util $util + * @param MainConfig $mainConfig + * @param Util $util */ public function __construct( Php $php, @@ -77,10 +79,9 @@ public function __construct( /** * Returns a new ApacheFileProtection object. - * * @return ApacheFileProtection */ - public function createApacheFileProtection() + public function createApacheFileProtection(): ApacheFileProtection { return new ApacheFileProtection( $this->php, @@ -93,10 +94,9 @@ public function createApacheFileProtection() /** * Returns a new NginxFileProtection object. - * * @return NginxFileProtection */ - public function createNginxFileProtection() + public function createNginxFileProtection(): NginxFileProtection { return new NginxFileProtection( $this->php, diff --git a/src/File/FileProtectionInterface.php b/src/File/FileProtectionInterface.php index 49be2a9c..87367771 100644 --- a/src/File/FileProtectionInterface.php +++ b/src/File/FileProtectionInterface.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\File; use UserAccessManager\Config\MainConfig; @@ -29,12 +32,11 @@ interface FileProtectionInterface { /** * FileProtectionInterface constructor. - * - * @param Php $php - * @param Wordpress $wordpress + * @param Php $php + * @param Wordpress $wordpress * @param WordpressConfig $wordpressConfig - * @param MainConfig $mainConfig - * @param Util $util + * @param MainConfig $mainConfig + * @param Util $util */ public function __construct( Php $php, @@ -46,29 +48,24 @@ public function __construct( /** * Returns the file with path. - * * @param null|string $directory - * * @return string */ - public function getFileNameWithPath($directory = null); + public function getFileNameWithPath($directory = null): string; /** * Creates the file protection. - * * @param string $directory - * @param string $objectType - * + * @param string|null $objectType + * @param string|null $absolutePath * @return bool */ - public function create($directory, $objectType = null); + public function create(string $directory, ?string $objectType = null, ?string $absolutePath = null): bool; /** * Deletes the file protection. - * * @param string $directory - * * @return bool */ - public function delete($directory); + public function delete(string $directory): bool; } diff --git a/src/File/NginxFileProtection.php b/src/File/NginxFileProtection.php index 2fe0eb9e..4e4746fd 100644 --- a/src/File/NginxFileProtection.php +++ b/src/File/NginxFileProtection.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\File; +use Exception; use UserAccessManager\Object\ObjectHandler; /** @@ -27,15 +31,13 @@ class NginxFileProtection extends FileProtection implements FileProtectionInterf /** * Returns the location. - * * @param string $directory - * * @return string */ - protected function getLocation($directory) + protected function getLocation(string $directory): string { if ($this->mainConfig->getLockedDirectoryType() === 'wordpress') { - return "^{$directory}".$this->getDirectoryMatch(); + return "^{$directory}" . $this->getDirectoryMatch(); } $directoryMatch = $this->getDirectoryMatch(); @@ -44,14 +46,12 @@ protected function getLocation($directory) /** * Creates the file content if permalinks are active. - * * @param string $absolutePath * @param string $directory - * @param string $objectType - * + * @param string|null $objectType * @return string */ - private function getFileContent($absolutePath, $directory, $objectType) + private function getFileContent(string $absolutePath, string $directory, ?string $objectType): string { if ($objectType === null) { $objectType = ObjectHandler::ATTACHMENT_OBJECT_TYPE; @@ -71,38 +71,34 @@ private function getFileContent($absolutePath, $directory, $objectType) /** * Returns the nginx config file name with path. - * * @param string null|$directory - * * @return string */ - public function getFileNameWithPath($directory = null) + public function getFileNameWithPath($directory = null): string { - return ABSPATH.self::FILE_NAME; + return ABSPATH . self::FILE_NAME; } /** * Generates the conf file. - * * @param string $directory - * @param string $objectType - * @param string $absolutePath - * + * @param string|null $objectType + * @param string|null $absolutePath * @return bool */ - public function create($directory, $objectType = null, $absolutePath = ABSPATH) + public function create(string $directory, ?string $objectType = null, ?string $absolutePath = ABSPATH): bool { - $directory = rtrim($directory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; - $absolutePath = rtrim($absolutePath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; + $directory = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + $absolutePath = rtrim($absolutePath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; $content = $this->getFileContent($absolutePath, $directory, $objectType); // save files - $fileWithPath = $absolutePath.self::FILE_NAME; + $fileWithPath = $absolutePath . self::FILE_NAME; try { file_put_contents($fileWithPath, $content); return true; - } catch (\Exception $exception) { + } catch (Exception $exception) { // Because file_put_contents can throw exceptions we use this try catch block // to return the success result instead of an exception } @@ -112,12 +108,10 @@ public function create($directory, $objectType = null, $absolutePath = ABSPATH) /** * Deletes the conf file. - * * @param string $directory - * * @return bool */ - public function delete($directory) + public function delete(string $directory): bool { return $this->deleteFiles($directory); } diff --git a/src/Form/Form.php b/src/Form/Form.php index 49710fd8..4997ae5b 100644 --- a/src/Form/Form.php +++ b/src/Form/Form.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; /** @@ -37,7 +40,7 @@ public function addElement(FormElement $element) /** * @return FormElement[] */ - public function getElements() + public function getElements(): array { return $this->elements; } diff --git a/src/Form/FormElement.php b/src/Form/FormElement.php index 5453886d..ef5577f3 100644 --- a/src/Form/FormElement.php +++ b/src/Form/FormElement.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; /** @@ -36,13 +39,12 @@ abstract class FormElement /** * FormElement constructor. - * - * @param string $id - * @param mixed|null $value + * @param string $id + * @param mixed|null $value * @param string|null $label * @param string|null $description */ - public function __construct($id, $value = null, $label = null, $description = null) + public function __construct(string $id, $value = null, $label = null, $description = null) { $this->id = $id; $this->value = $value; @@ -53,7 +55,7 @@ public function __construct($id, $value = null, $label = null, $description = nu /** * @return string */ - public function getId() + public function getId(): string { return $this->id; } @@ -61,7 +63,7 @@ public function getId() /** * @return null|string */ - public function getDescription() + public function getDescription(): ?string { return $this->description; } diff --git a/src/Form/FormFactory.php b/src/Form/FormFactory.php index a1e25556..bef0143e 100644 --- a/src/Form/FormFactory.php +++ b/src/Form/FormFactory.php @@ -12,8 +12,13 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; +use Exception; + /** * Class FormFactory * @@ -23,99 +28,97 @@ class FormFactory { /** * Creates a form object. - * * @return Form */ - public function createFrom() + public function createFrom(): Form { return new Form(); } /** * Creates a ValueSetFormElementValue object. - * - * @param mixed $value + * @param mixed $value * @param string $label - * * @return ValueSetFormElementValue */ - public function createValueSetFromElementValue($value, $label) + public function createValueSetFromElementValue($value, string $label): ValueSetFormElementValue { return new ValueSetFormElementValue($value, $label); } /** * Creates a MultipleFormElementValue object. - * - * @param mixed $value + * @param mixed $value * @param string $label - * * @return MultipleFormElementValue */ - public function createMultipleFormElementValue($value, $label) + public function createMultipleFormElementValue($value, string $label): MultipleFormElementValue { return new MultipleFormElementValue($value, $label); } /** * Creates a Input object. - * - * @param string $id - * @param null|mixed $value + * @param string $id + * @param null|mixed $value * @param null|string $label * @param null|string $description - * * @return Input */ - public function createInput($id, $value = null, $label = null, $description = null) + public function createInput(string $id, $value = null, $label = null, $description = null): Input { return new Input($id, $value, $label, $description); } /** * Creates a Textarea object. - * - * @param string $id - * @param null|mixed $value + * @param string $id + * @param null|mixed $value * @param null|string $label * @param null|string $description - * * @return Textarea */ - public function createTextarea($id, $value = null, $label = null, $description = null) + public function createTextarea(string $id, $value = null, $label = null, $description = null): Textarea { return new Textarea($id, $value, $label, $description); } /** * Creates a Select object. - * - * @param string $id + * @param string $id * @param ValueSetFormElementValue[] $possibleValues - * @param null|mixed $value - * @param null|string $label - * @param null|string $description - * + * @param null|mixed $value + * @param null|string $label + * @param null|string $description * @return Select */ - public function createSelect($id, array $possibleValues, $value = null, $label = null, $description = null) - { + public function createSelect( + string $id, + array $possibleValues, + $value = null, + $label = null, + $description = null + ): Select { return new Select($id, $possibleValues, $value, $label, $description); } /** * Creates a Radio object. - * - * @param string $id + * @param string $id * @param MultipleFormElementValue[] $possibleValues - * @param null|mixed $value - * @param null|string $label - * @param null|string $description - * + * @param null|mixed $value + * @param null|string $label + * @param null|string $description * @return Radio + * @throws Exception */ - public function createRadio($id, array $possibleValues, $value = null, $label = null, $description = null) - { + public function createRadio( + string $id, + array $possibleValues, + $value = null, + $label = null, + $description = null + ): Radio { return new Radio($id, $possibleValues, $value, $label, $description); } } diff --git a/src/Form/FormHelper.php b/src/Form/FormHelper.php index 59ba5366..4f311c68 100644 --- a/src/Form/FormHelper.php +++ b/src/Form/FormHelper.php @@ -12,12 +12,16 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; +use Exception; use UserAccessManager\Config\BooleanConfigParameter; use UserAccessManager\Config\Config; -use UserAccessManager\Config\MainConfig; use UserAccessManager\Config\ConfigParameter; +use UserAccessManager\Config\MainConfig; use UserAccessManager\Config\SelectionConfigParameter; use UserAccessManager\Config\StringConfigParameter; use UserAccessManager\Wrapper\Php; @@ -52,10 +56,9 @@ class FormHelper /** * FormHelper constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param MainConfig $config + * @param Php $php + * @param Wordpress $wordpress + * @param MainConfig $config * @param FormFactory $formFactory */ public function __construct( @@ -72,14 +75,12 @@ public function __construct( /** * Returns the right translation string. - * * @param string $ident - * @param bool $description - * @param string $objectKey - * + * @param bool $description + * @param null $objectKey * @return mixed|string */ - private function getObjectText($ident, $description = false, $objectKey = null) + private function getObjectText(string $ident, $description = false, $objectKey = null): string { $ident .= ($description === true) ? '_DESC' : ''; @@ -106,14 +107,13 @@ private function getObjectText($ident, $description = false, $objectKey = null) /** * @param string $key - * @param bool $description - * + * @param bool $description * @return string */ - public function getText($key, $description = false) + public function getText(string $key, $description = false): string { return $this->getObjectText( - 'TXT_UAM_'.strtoupper($key).'_SETTING', + 'TXT_UAM_' . strtoupper($key) . '_SETTING', $description, $key ); @@ -121,16 +121,14 @@ public function getText($key, $description = false) /** * Returns the label for the parameter. - * * @param ConfigParameter $configParameter - * @param bool $description - * @param string $objectKey - * + * @param bool $description + * @param string $objectKey * @return string */ - public function getParameterText(ConfigParameter $configParameter, $description = false, $objectKey = null) + public function getParameterText(ConfigParameter $configParameter, $description = false, $objectKey = null): string { - $ident = 'TXT_UAM_'.strtoupper($configParameter->getId()); + $ident = 'TXT_UAM_' . strtoupper($configParameter->getId()); return $this->getObjectText( $ident, @@ -141,17 +139,17 @@ public function getParameterText(ConfigParameter $configParameter, $description /** * Creates a multiple form element. - * - * @param string $value - * @param string $label - * @param ConfigParameter $parameter - * + * @param string $value + * @param string $label + * @param ConfigParameter|null $parameter * @return MultipleFormElementValue - * - * @throws \Exception + * @throws Exception */ - public function createMultipleFromElement($value, $label, ConfigParameter $parameter = null) - { + public function createMultipleFromElement( + string $value, + string $label, + ?ConfigParameter $parameter = null + ): MultipleFormElementValue { $value = $this->formFactory->createMultipleFormElementValue($value, $label); if ($parameter !== null) { @@ -167,12 +165,10 @@ public function createMultipleFromElement($value, $label, ConfigParameter $param /** * @param SelectionConfigParameter $configParameter - * @param null|string $objectKey - * @param array $overwrittenValues - * + * @param null|string $objectKey + * @param array $overwrittenValues * @return mixed - * - * @throws \Exception + * @throws Exception */ private function convertSelectionParameter( SelectionConfigParameter $configParameter, @@ -182,7 +178,7 @@ private function convertSelectionParameter( $values = []; foreach ($configParameter->getSelections() as $selection) { - $optionNameKey = 'TXT_UAM_'.strtoupper($configParameter->getId().'_'.$selection); + $optionNameKey = 'TXT_UAM_' . strtoupper($configParameter->getId() . '_' . $selection); $label = (defined($optionNameKey) === true) ? constant($optionNameKey) : $optionNameKey; if ($overwrittenValues === []) { @@ -206,12 +202,10 @@ private function convertSelectionParameter( /** * @param ConfigParameter $configParameter - * @param null|string $objectKey - * @param array $overwrittenValues - * + * @param null|string $objectKey + * @param array $overwrittenValues * @return null|Input|Radio|Select - * - * @throws \Exception + * @throws Exception */ public function convertConfigParameter( ConfigParameter $configParameter, @@ -246,15 +240,12 @@ public function convertConfigParameter( /** * Returns the settings form for the given config parameters. - * - * @param array $parameters + * @param array $parameters * @param string|null $objectKey - * - * @return \UserAccessManager\Form\Form - * - * @throws \Exception + * @return Form + * @throws Exception */ - public function getSettingsForm(array $parameters, $objectKey = null) + public function getSettingsForm(array $parameters, $objectKey = null): Form { $configParameters = $this->config->getConfigParameters(); $form = $this->formFactory->createFrom(); @@ -292,14 +283,11 @@ function ($parameterKey) use ($configParameters) { /** * Converts config parameters to a form. - * * @param Config $config - * * @return Form - * - * @throws \Exception + * @throws Exception */ - public function getSettingsFormByConfig(Config $config) + public function getSettingsFormByConfig(Config $config): Form { $form = $this->formFactory->createFrom(); $configParameters = $config->getConfigParameters(); diff --git a/src/Form/Input.php b/src/Form/Input.php index 478ca8c5..37009bf2 100644 --- a/src/Form/Input.php +++ b/src/Form/Input.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; /** diff --git a/src/Form/LabelTrait.php b/src/Form/LabelTrait.php index a1d90f7a..0badaee1 100644 --- a/src/Form/LabelTrait.php +++ b/src/Form/LabelTrait.php @@ -1,4 +1,7 @@ label; } diff --git a/src/Form/MultipleFormElement.php b/src/Form/MultipleFormElement.php index 519903f0..09f0bd14 100644 --- a/src/Form/MultipleFormElement.php +++ b/src/Form/MultipleFormElement.php @@ -12,8 +12,13 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; +use Exception; + /** * Class MultipleFormElement * @@ -28,20 +33,18 @@ abstract class MultipleFormElement extends ValueSetFormElement /** * MultipleFormElement constructor. - * - * @param string $id + * @param string $id * @param MultipleFormElementValue[] $possibleValues - * @param mixed|null $value - * @param string|null $label - * @param string|null $description - * - * @throws \Exception + * @param mixed|null $value + * @param string|null $label + * @param string|null $description + * @throws Exception */ - public function __construct($id, array $possibleValues, $value = null, $label = null, $description = null) + public function __construct(string $id, array $possibleValues, $value = null, $label = null, $description = null) { foreach ($possibleValues as $possibleValue) { if (($possibleValue instanceof MultipleFormElementValue) === false) { - throw new \Exception('Values must be MultipleFormElementValue objects'); + throw new Exception('Values must be MultipleFormElementValue objects'); } } @@ -51,7 +54,7 @@ public function __construct($id, array $possibleValues, $value = null, $label = /** * @return MultipleFormElementValue[] */ - public function getPossibleValues() + public function getPossibleValues(): array { return $this->possibleValues; } diff --git a/src/Form/MultipleFormElementValue.php b/src/Form/MultipleFormElementValue.php index c1126c87..8a8ae7c9 100644 --- a/src/Form/MultipleFormElementValue.php +++ b/src/Form/MultipleFormElementValue.php @@ -12,8 +12,13 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; +use Exception; + /** * Class MultipleFormElementValue * @@ -28,22 +33,21 @@ class MultipleFormElementValue extends ValueSetFormElementValue /** * @param FormElement $subElement - * - * @throws \Exception + * @throws Exception */ public function setSubElement(FormElement $subElement) { if ($subElement instanceof MultipleFormElement) { - throw new \Exception('Invalid form type for sub element.'); + throw new Exception('Invalid form type for sub element.'); } $this->subElement = $subElement; } /** - * @return FormElement + * @return FormElement|null */ - public function getSubElement() + public function getSubElement(): ?FormElement { return $this->subElement; } diff --git a/src/Form/Radio.php b/src/Form/Radio.php index 95cb9aa0..1a9d76ed 100644 --- a/src/Form/Radio.php +++ b/src/Form/Radio.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; /** diff --git a/src/Form/Select.php b/src/Form/Select.php index aa78f3d9..4e492341 100644 --- a/src/Form/Select.php +++ b/src/Form/Select.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; /** diff --git a/src/Form/Textarea.php b/src/Form/Textarea.php index e6b5e4c6..3f9acba6 100644 --- a/src/Form/Textarea.php +++ b/src/Form/Textarea.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; /** diff --git a/src/Form/ValueSetFormElement.php b/src/Form/ValueSetFormElement.php index 5af133a8..c68a8b48 100644 --- a/src/Form/ValueSetFormElement.php +++ b/src/Form/ValueSetFormElement.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; /** @@ -28,14 +31,13 @@ abstract class ValueSetFormElement extends FormElement /** * MultipleFormElement constructor. - * - * @param string $id + * @param string $id * @param ValueSetFormElementValue[] $possibleValues - * @param mixed|null $value - * @param string|null $label - * @param string|null $description + * @param mixed|null $value + * @param string|null $label + * @param string|null $description */ - public function __construct($id, array $possibleValues, $value = null, $label = null, $description = null) + public function __construct(string $id, array $possibleValues, $value = null, $label = null, $description = null) { parent::__construct($id, $value, $label, $description); @@ -52,7 +54,7 @@ function (ValueSetFormElementValue $value) { /** * @return ValueSetFormElementValue[] */ - public function getPossibleValues() + public function getPossibleValues(): array { return $this->possibleValues; } diff --git a/src/Form/ValueSetFormElementValue.php b/src/Form/ValueSetFormElementValue.php index f2cca1d1..8ddf6fbb 100644 --- a/src/Form/ValueSetFormElementValue.php +++ b/src/Form/ValueSetFormElementValue.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Form; /** @@ -26,11 +29,10 @@ class ValueSetFormElementValue /** * ValueSetFormElementValue constructor. - * - * @param mixed $value + * @param mixed $value * @param string $label */ - public function __construct($value, $label) + public function __construct($value, string $label) { $this->value = $value; $this->label = $label; @@ -51,10 +53,9 @@ public function markDisabled() /** * Returns true if the option is disabled. - * * @return bool */ - public function isDisabled() + public function isDisabled(): bool { return $this->isDisabled; } diff --git a/src/Form/ValueTrait.php b/src/Form/ValueTrait.php index 69f8025a..f79ceb16 100644 --- a/src/Form/ValueTrait.php +++ b/src/Form/ValueTrait.php @@ -1,4 +1,7 @@ postTypes === null) { $this->postTypes = $this->wordpress->getPostTypes(['public' => true]); @@ -134,10 +140,9 @@ public function getPostTypes() /** * Returns the taxonomies. - * * @return array */ - public function getTaxonomies() + public function getTaxonomies(): ?array { if ($this->taxonomies === null) { $this->taxonomies = $this->wordpress->getTaxonomies(['public' => true]); @@ -148,10 +153,8 @@ public function getTaxonomies() /** * Returns a user. - * * @param int|string $id The user id. - * - * @return \WP_User|false + * @return WP_User|false */ public function getUser($id) { @@ -164,16 +167,14 @@ public function getUser($id) /** * Returns a post. - * - * @param int $id The post id. - * - * @return \WP_Post|false + * @param int|string $id The post id. + * @return WP_Post|false */ public function getPost($id) { if (isset($this->posts[$id]) === false) { $post = $this->wordpress->getPost($id); - $this->posts[$id] = ($post instanceof \WP_Post) ? $post : false; + $this->posts[$id] = ($post instanceof WP_Post) ? $post : false; } return $this->posts[$id]; @@ -181,19 +182,17 @@ public function getPost($id) /** * Returns a term. - * - * @param int $id The term id. + * @param int|string $id The term id. * @param string $taxonomy The taxonomy. - * - * @return false|\WP_Term + * @return false|WP_Term */ public function getTerm($id, $taxonomy = '') { - $fullId = $id.'|'.$taxonomy; + $fullId = $id . '|' . $taxonomy; if (isset($this->terms[$fullId]) === false) { $term = $this->wordpress->getTerm($id, $taxonomy); - $this->terms[$fullId] = ($term instanceof \WP_Term) ? $term : false; + $this->terms[$fullId] = ($term instanceof WP_Term) ? $term : false; } return $this->terms[$fullId]; @@ -202,13 +201,12 @@ public function getTerm($id, $taxonomy = '') /** * Used for adding custom post types using the registered_post_type hook * @see http://wordpress.org/support/topic/modifying-post-type-using-the-registered_post_type-hook - * - * @param string $postType The string for the new post_type - * @param \WP_Post_Type $arguments The array of arguments used to create the post_type + * @param string $postType The string for the new post_type + * @param WP_Post_Type $arguments The array of arguments used to create the post_type */ - public function registeredPostType($postType, \WP_Post_Type $arguments) + public function registeredPostType(string $postType, WP_Post_Type $arguments) { - if ((bool)$arguments->public === true) { + if ((bool) $arguments->public === true) { $this->postTypes = $this->getPostTypes(); $this->postTypes[$postType] = $postType; $this->objectTypes = null; @@ -220,14 +218,13 @@ public function registeredPostType($postType, \WP_Post_Type $arguments) /** * Adds an custom taxonomy. - * * @param string $taxonomy * @param string $objectType - * @param array $arguments + * @param array $arguments */ - public function registeredTaxonomy($taxonomy, $objectType, array $arguments) + public function registeredTaxonomy(string $taxonomy, string $objectType, array $arguments) { - if ((bool)$arguments['public'] === true) { + if ((bool) $arguments['public'] === true) { $this->taxonomies = $this->getTaxonomies(); $this->taxonomies[$taxonomy] = $taxonomy; $this->objectTypes = null; @@ -239,12 +236,10 @@ public function registeredTaxonomy($taxonomy, $objectType, array $arguments) /** * Checks if type is postable. - * * @param string $type - * * @return bool */ - public function isPostType($type) + public function isPostType(string $type): bool { $postableTypes = $this->getPostTypes(); return isset($postableTypes[$type]); @@ -252,12 +247,10 @@ public function isPostType($type) /** * Checks if the taxonomy is a valid one. - * * @param string $taxonomy - * * @return bool */ - public function isTaxonomy($taxonomy) + public function isTaxonomy(string $taxonomy): bool { $taxonomies = $this->getTaxonomies(); return in_array($taxonomy, $taxonomies); @@ -265,10 +258,9 @@ public function isTaxonomy($taxonomy) /** * Returns the predefined object types. - * * @return array */ - public function getObjectTypes() + public function getObjectTypes(): ?array { if ($this->objectTypes === null) { $this->objectTypes = array_merge( @@ -282,10 +274,10 @@ public function getObjectTypes() /** * Returns the object types map. - * * @return array + * @throws Exception */ - private function getAllObjectsTypesMap() + private function getAllObjectsTypesMap(): ?array { if ($this->allObjectTypesMap === null) { $this->allObjectTypesMap = []; @@ -312,10 +304,10 @@ private function getAllObjectsTypesMap() /** * Returns all objects types. - * * @return array + * @throws Exception */ - public function getAllObjectTypes() + public function getAllObjectTypes(): ?array { if ($this->allObjectTypes === null) { $objectTypes = array_keys($this->getAllObjectsTypesMap()); @@ -327,12 +319,11 @@ public function getAllObjectTypes() /** * Returns the general object type. - * - * @param string $objectType - * + * @param string|null $objectType * @return string + * @throws Exception */ - public function getGeneralObjectType($objectType) + public function getGeneralObjectType(?string $objectType): ?string { $objectsTypeMap = $this->getAllObjectsTypesMap(); return (isset($objectsTypeMap[$objectType]) === true) ? $objectsTypeMap[$objectType] : null; @@ -340,12 +331,11 @@ public function getGeneralObjectType($objectType) /** * Checks if the object type is a valid one. - * - * @param string $objectType The object type to check. - * + * @param string|null $objectType The object type to check. * @return bool + * @throws Exception */ - public function isValidObjectType($objectType) + public function isValidObjectType(?string $objectType): bool { if (isset($this->validObjectTypes[$objectType]) === false) { $objectTypesMap = $this->getAllObjectTypes(); @@ -357,10 +347,10 @@ public function isValidObjectType($objectType) /** * Returns the object membership handlers. - * * @return ObjectMembershipHandler[] + * @throws Exception */ - private function getObjectMembershipHandlers() + private function getObjectMembershipHandlers(): ?array { if ($this->objectMembershipHandlers === null) { $factory = $this->membershipHandlerFactory; @@ -388,14 +378,12 @@ private function getObjectMembershipHandlers() /** * Returns the membership handler for the given object type. - * - * @param string $objectType - * + * @param null|string $objectType * @return ObjectMembershipHandler - * * @throws MissingObjectMembershipHandlerException + * @throws Exception */ - public function getObjectMembershipHandler($objectType) + public function getObjectMembershipHandler(?string $objectType): ObjectMembershipHandler { $objectMembershipHandlers = $this->getObjectMembershipHandlers(); $generalObjectType = $this->getGeneralObjectType($objectType); diff --git a/src/Object/ObjectMapHandler.php b/src/Object/ObjectMapHandler.php index a92f8a83..f392a328 100644 --- a/src/Object/ObjectMapHandler.php +++ b/src/Object/ObjectMapHandler.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Object; use UserAccessManager\Cache\Cache; @@ -64,9 +67,8 @@ class ObjectMapHandler /** * ObjectMapHandler constructor. - * * @param Database $database - * @param Cache $cache + * @param Cache $cache */ public function __construct( Database $database, @@ -78,14 +80,12 @@ public function __construct( /** * Resolves all tree map elements - * * @param array $map - * @param array $subMap + * @param array|null $subMap * @param array $processed - * * @return array */ - private function processTreeMapElements(array &$map, array $subMap = null, array &$processed = []) + private function processTreeMapElements(array &$map, array $subMap = null, array &$processed = []): array { $processMap = ($subMap === null) ? $map : $subMap; @@ -103,13 +103,11 @@ private function processTreeMapElements(array &$map, array $subMap = null, array /** * Returns the tree map for the query. - * * @param string $select * @param string $generalType - * * @return array */ - private function getTreeMap($select, $generalType) + private function getTreeMap(string $select, string $generalType): array { $treeMap = [ self::TREE_MAP_CHILDREN => [ @@ -119,7 +117,7 @@ private function getTreeMap($select, $generalType) $generalType => [] ] ]; - $results = (array)$this->database->getResults($select); + $results = (array) $this->database->getResults($select); foreach ($results as $result) { $treeMap[self::TREE_MAP_CHILDREN][$generalType][$result->parentId][$result->id] = $result->type; @@ -140,14 +138,12 @@ private function getTreeMap($select, $generalType) /** * Checks if a cache key exists and returns the map. - * * @param string $cacheKey * @param string $generalType * @param string $query - * * @return array */ - private function getCachedTreeMap($cacheKey, $generalType, $query) + private function getCachedTreeMap(string $cacheKey, string $generalType, string $query): array { $map = $this->cache->get($cacheKey); @@ -162,18 +158,19 @@ private function getCachedTreeMap($cacheKey, $generalType, $query) /** * Returns the post tree map. - * * @return array */ - public function getPostTreeMap() + public function getPostTreeMap(): ?array { if ($this->postTreeMap === null) { + $query = "SELECT ID AS id, post_parent AS parentId, post_type AS type + FROM {$this->database->getPostsTable()} + WHERE post_parent != 0 AND post_type != 'revision'"; + $this->postTreeMap = $this->getCachedTreeMap( self::POST_TREE_MAP_CACHE_KEY, ObjectHandler::GENERAL_POST_OBJECT_TYPE, - "SELECT ID AS id, post_parent AS parentId, post_type AS type - FROM {$this->database->getPostsTable()} - WHERE post_parent != 0 AND post_type != 'revision'" + $query ); } @@ -182,18 +179,19 @@ public function getPostTreeMap() /** * Returns the term tree map. - * * @return array */ - public function getTermTreeMap() + public function getTermTreeMap(): ?array { if ($this->termTreeMap === null) { + $query = "SELECT term_id AS id, parent AS parentId, taxonomy AS type + FROM {$this->database->getTermTaxonomyTable()} + WHERE parent != 0"; + $this->termTreeMap = $this->getCachedTreeMap( self::TERM_TREE_MAP_CACHE_KEY, ObjectHandler::GENERAL_TERM_OBJECT_TYPE, - "SELECT term_id AS id, parent AS parentId, taxonomy AS type - FROM {$this->database->getTermTaxonomyTable()} - WHERE parent != 0" + $query ); } @@ -202,19 +200,17 @@ public function getTermTreeMap() /** * Returns the cached map. - * * @param string $cacheKey * @param string $query - * * @return array */ - private function getCachedMap($cacheKey, $query) + private function getCachedMap(string $cacheKey, string $query): array { $map = $this->cache->get($cacheKey); if ($map === null) { $map = []; - $results = (array)$this->database->getResults($query); + $results = (array) $this->database->getResults($query); foreach ($results as $result) { $map[$result->parentId][$result->objectId] = $result->type; @@ -228,10 +224,9 @@ private function getCachedMap($cacheKey, $query) /** * Returns the term post map. - * * @return array */ - public function getTermPostMap() + public function getTermPostMap(): ?array { if ($this->termPostMap === null) { $select = " @@ -250,10 +245,9 @@ public function getTermPostMap() /** * Returns the post term map. - * * @return array */ - public function getPostTermMap() + public function getPostTermMap(): ?array { if ($this->postTermMap === null) { $select = " diff --git a/src/ObjectMembership/MissingObjectMembershipHandlerException.php b/src/ObjectMembership/MissingObjectMembershipHandlerException.php index a4226647..c438aa1d 100644 --- a/src/ObjectMembership/MissingObjectMembershipHandlerException.php +++ b/src/ObjectMembership/MissingObjectMembershipHandlerException.php @@ -12,14 +12,19 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\ObjectMembership; +use Exception; + /** * Class MissingMembershipHandlerException * * @package UserAccessManager\UserGroup */ -class MissingObjectMembershipHandlerException extends \Exception +class MissingObjectMembershipHandlerException extends Exception { } diff --git a/src/ObjectMembership/MissingObjectTypeException.php b/src/ObjectMembership/MissingObjectTypeException.php index 946aa85a..99ccfd6a 100644 --- a/src/ObjectMembership/MissingObjectTypeException.php +++ b/src/ObjectMembership/MissingObjectTypeException.php @@ -12,14 +12,19 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\ObjectMembership; +use Exception; + /** * Class MissingObjectTypeException * * @package UserAccessManager\ObjectMembership */ -class MissingObjectTypeException extends \Exception +class MissingObjectTypeException extends Exception { } diff --git a/src/ObjectMembership/ObjectMembershipHandler.php b/src/ObjectMembership/ObjectMembershipHandler.php index 442e3b12..ecc7a771 100644 --- a/src/ObjectMembership/ObjectMembershipHandler.php +++ b/src/ObjectMembership/ObjectMembershipHandler.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\ObjectMembership; +use Exception; use UserAccessManager\UserGroup\AbstractUserGroup; use UserAccessManager\UserGroup\AssignmentInformation; use UserAccessManager\UserGroup\AssignmentInformationFactory; @@ -35,17 +39,10 @@ abstract class ObjectMembershipHandler */ protected $generalObjectType; - /** - * @var array - */ - protected $assignedObjects; - /** * MembershipHandler constructor. - * - * @param AssignmentInformationFactory $assignmentInformationFactory - * - * @throws \Exception + * @param AssignmentInformationFactory $assignmentInformationFactory + * @throws Exception */ public function __construct( AssignmentInformationFactory $assignmentInformationFactory @@ -59,42 +56,36 @@ public function __construct( /** * Returns the object name. - * - * @param string $objectId + * @param int|string $objectId * @param string $typeName - * - * @return string + * @return int|string */ - abstract public function getObjectName($objectId, &$typeName = ''); + abstract public function getObjectName($objectId, string &$typeName = ''); /** * Returns the general object type. - * - * @return string + * @return string */ - public function getGeneralObjectType() + public function getGeneralObjectType(): string { return $this->generalObjectType; } /** * Returns the handled objects. - * - * @return array + * @return array */ - public function getHandledObjects() + public function getHandledObjects(): array { return [$this->generalObjectType => $this->generalObjectType]; } /** * Returns if the object is handled by this handler. - * - * @param $objectType - * - * @return bool + * @param $objectType + * @return bool */ - public function handlesObject($objectType) + public function handlesObject($objectType): bool { $objectTypes = $this->getHandledObjects(); return isset($objectTypes[$objectType]); @@ -102,12 +93,11 @@ public function handlesObject($objectType) /** * Assigns recursive membership to the assignment information object. - * - * @param null|AssignmentInformation $assignmentInformation - * @param array $recursiveMembership + * @param null|AssignmentInformation $assignmentInformation + * @param array $recursiveMembership */ protected function assignRecursiveMembership( - &$assignmentInformation, + ?AssignmentInformation &$assignmentInformation, array $recursiveMembership ) { if ($assignmentInformation === null) { @@ -119,18 +109,16 @@ protected function assignRecursiveMembership( /** * Checks for the access and assigns the recursive membership array if access. - * - * @param bool $isMember - * @param array $recursiveMembership + * @param bool $isMember + * @param array $recursiveMembership * @param null|AssignmentInformation $assignmentInformation - * - * @return bool + * @return bool */ protected function checkAccessWithRecursiveMembership( - $isMember, + bool $isMember, array $recursiveMembership, - &$assignmentInformation - ) { + ?AssignmentInformation &$assignmentInformation + ): bool { if ($isMember === true || count($recursiveMembership) > 0) { $this->assignRecursiveMembership($assignmentInformation, $recursiveMembership); return true; @@ -141,13 +129,11 @@ protected function checkAccessWithRecursiveMembership( /** * Returns the assigned objects as array map. - * - * @param AbstractUserGroup $userGroup - * @param string $objectType - * - * @return array + * @param AbstractUserGroup $userGroup + * @param string $objectType + * @return array */ - protected function getSimpleAssignedObjects(AbstractUserGroup $userGroup, $objectType) + protected function getSimpleAssignedObjects(AbstractUserGroup $userGroup, string $objectType): array { $objects = $userGroup->getAssignedObjects($objectType); @@ -161,29 +147,29 @@ function (AssignmentInformation $element) { /** * Checks if the object is a member of the user group. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param string $objectId + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param int|string $objectId * @param null|AssignmentInformation $assignmentInformation - * - * @return bool + * @return bool */ abstract public function isMember( AbstractUserGroup $userGroup, - $lockRecursive, + bool $lockRecursive, $objectId, - &$assignmentInformation = null - ); + ?AssignmentInformation &$assignmentInformation = null + ): bool; /** * Returns the full objects. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param string $objectType - * - * @return array + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param null $objectType + * @return array */ - abstract public function getFullObjects(AbstractUserGroup $userGroup, $lockRecursive, $objectType = null); + abstract public function getFullObjects( + AbstractUserGroup $userGroup, + bool $lockRecursive, + $objectType = null + ): array; } diff --git a/src/ObjectMembership/ObjectMembershipHandlerFactory.php b/src/ObjectMembership/ObjectMembershipHandlerFactory.php index 7e8c0af9..608f350c 100644 --- a/src/ObjectMembership/ObjectMembershipHandlerFactory.php +++ b/src/ObjectMembership/ObjectMembershipHandlerFactory.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\ObjectMembership; +use Exception; use UserAccessManager\Database\Database; use UserAccessManager\Object\ObjectHandler; use UserAccessManager\Object\ObjectMapHandler; @@ -55,8 +59,7 @@ class ObjectMembershipHandlerFactory /** * MembershipHandlerFactory constructor. - * - * @param Php $php + * @param Php $php * @param Wordpress $wordpress * @param Database $database * @param ObjectMapHandler $objectMapHandler @@ -78,12 +81,11 @@ public function __construct( /** * Creates a PostMembershipHandler object. - * - * @param ObjectHandler $objectHandler - * - * @return PostMembershipHandler + * @param ObjectHandler $objectHandler + * @return PostMembershipHandler + * @throws Exception */ - public function createPostMembershipHandler(ObjectHandler $objectHandler) + public function createPostMembershipHandler(ObjectHandler $objectHandler): PostMembershipHandler { return new PostMembershipHandler( $this->assignmentInformationFactory, @@ -95,22 +97,21 @@ public function createPostMembershipHandler(ObjectHandler $objectHandler) /** * Creates a RoleMembershipHandler object. - * - * @return RoleMembershipHandler + * @return RoleMembershipHandler + * @throws Exception */ - public function createRoleMembershipHandler() + public function createRoleMembershipHandler(): RoleMembershipHandler { return new RoleMembershipHandler($this->assignmentInformationFactory, $this->wordpress); } /** * Creates a TermMembershipHandler object. - * - * @param ObjectHandler $objectHandler - * - * @return TermMembershipHandler + * @param ObjectHandler $objectHandler + * @return TermMembershipHandler + * @throws Exception */ - public function createTermMembershipHandler(ObjectHandler $objectHandler) + public function createTermMembershipHandler(ObjectHandler $objectHandler): TermMembershipHandler { return new TermMembershipHandler( $this->assignmentInformationFactory, @@ -122,12 +123,11 @@ public function createTermMembershipHandler(ObjectHandler $objectHandler) /** * Creates an UserMembershipHandler object. - * - * @param ObjectHandler $objectHandler - * - * @return UserMembershipHandler + * @param ObjectHandler $objectHandler + * @return UserMembershipHandler + * @throws Exception */ - public function createUserMembershipHandler(ObjectHandler $objectHandler) + public function createUserMembershipHandler(ObjectHandler $objectHandler): UserMembershipHandler { return new UserMembershipHandler( $this->assignmentInformationFactory, diff --git a/src/ObjectMembership/ObjectMembershipWithMapHandler.php b/src/ObjectMembership/ObjectMembershipWithMapHandler.php index 79c2178c..5a010a14 100644 --- a/src/ObjectMembership/ObjectMembershipWithMapHandler.php +++ b/src/ObjectMembership/ObjectMembershipWithMapHandler.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\ObjectMembership; +use Exception; use UserAccessManager\Object\ObjectMapHandler; use UserAccessManager\UserGroup\AbstractUserGroup; use UserAccessManager\UserGroup\AssignmentInformation; @@ -27,27 +31,25 @@ abstract class ObjectMembershipWithMapHandler extends ObjectMembershipHandler { /** * Returns the map. - * - * @return array + * @return array */ - abstract protected function getMap(); + abstract protected function getMap(): array; /** * Uses a map function to resolve the recursive membership. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param string $objectId + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param int|string $objectId * @param null|AssignmentInformation $assignmentInformation - * - * @return bool + * @return bool + * @throws Exception */ protected function getMembershipByMap( AbstractUserGroup $userGroup, - $lockRecursive, + bool $lockRecursive, $objectId, &$assignmentInformation = null - ) { + ): bool { // Reset value to prevent errors $recursiveMembership = []; @@ -77,14 +79,13 @@ protected function getMembershipByMap( /** * Returns the objects by the given type including the children. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param string $objectType - * - * @return array + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param string $objectType + * @return array + * @throws Exception */ - protected function getFullObjectsByMap(AbstractUserGroup $userGroup, $lockRecursive, $objectType) + protected function getFullObjectsByMap(AbstractUserGroup $userGroup, bool $lockRecursive, string $objectType): array { $objects = $this->getSimpleAssignedObjects($userGroup, $objectType); diff --git a/src/ObjectMembership/PostMembershipHandler.php b/src/ObjectMembership/PostMembershipHandler.php index 0a9aa0d8..ba76972a 100644 --- a/src/ObjectMembership/PostMembershipHandler.php +++ b/src/ObjectMembership/PostMembershipHandler.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\ObjectMembership; +use Exception; use UserAccessManager\Object\ObjectHandler; use UserAccessManager\Object\ObjectMapHandler; use UserAccessManager\UserGroup\AbstractUserGroup; @@ -50,13 +54,11 @@ class PostMembershipHandler extends ObjectMembershipWithMapHandler /** * PostMembershipHandler constructor. - * - * @param AssignmentInformationFactory $assignmentInformationFactory + * @param AssignmentInformationFactory $assignmentInformationFactory * @param Wordpress $wordpress * @param ObjectHandler $objectHandler * @param ObjectMapHandler $objectMapHandler - * - * @throws \Exception + * @throws Exception */ public function __construct( AssignmentInformationFactory $assignmentInformationFactory, @@ -73,11 +75,9 @@ public function __construct( /** * Returns the object and type name. - * - * @param string $objectId + * @param int|string $objectId * @param string $typeName - * - * @return string + * @return int|string */ public function getObjectName($objectId, &$typeName = '') { @@ -94,10 +94,9 @@ public function getObjectName($objectId, &$typeName = '') /** * Returns the handled objects. - * - * @return array + * @return array */ - public function getHandledObjects() + public function getHandledObjects(): array { $keys = array_keys($this->objectHandler->getPostTypes()); return array_merge(parent::getHandledObjects(), array_combine($keys, $keys)); @@ -105,20 +104,19 @@ public function getHandledObjects() /** * Returns the map. - * - * @return array + * @return array */ - protected function getMap() + protected function getMap(): array { return $this->objectMapHandler->getPostTreeMap(); } /** * Assigns the recursive member ship by the group terms. - * - * @param AbstractUserGroup $userGroup - * @param string $objectId - * @param array $recursiveMembership + * @param AbstractUserGroup $userGroup + * @param int|string $objectId + * @param array $recursiveMembership + * @throws Exception */ private function assignRecursiveMembershipByTerm( AbstractUserGroup $userGroup, @@ -138,20 +136,19 @@ private function assignRecursiveMembershipByTerm( /** * Checks if the post is a member of the user group. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param string $objectId + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param int|string $objectId * @param null|AssignmentInformation $assignmentInformation - * - * @return bool + * @return bool + * @throws Exception */ public function isMember( AbstractUserGroup $userGroup, - $lockRecursive, + bool $lockRecursive, $objectId, - &$assignmentInformation = null - ) { + ?AssignmentInformation &$assignmentInformation = null + ): bool { $isMember = $this->getMembershipByMap($userGroup, $lockRecursive, $objectId, $assignmentInformation); if ($lockRecursive === true) { @@ -168,14 +165,13 @@ public function isMember( /** * Returns the full post objects. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param null|string $objectType - * - * @return array + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param null|string $objectType + * @return array + * @throws Exception */ - public function getFullObjects(AbstractUserGroup $userGroup, $lockRecursive, $objectType = null) + public function getFullObjects(AbstractUserGroup $userGroup, bool $lockRecursive, $objectType = null): array { $objectType = ($objectType === null) ? $this->generalObjectType : $objectType; $posts = $this->getFullObjectsByMap($userGroup, $lockRecursive, $objectType); diff --git a/src/ObjectMembership/RoleMembershipHandler.php b/src/ObjectMembership/RoleMembershipHandler.php index aa8e5073..6394a140 100644 --- a/src/ObjectMembership/RoleMembershipHandler.php +++ b/src/ObjectMembership/RoleMembershipHandler.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\ObjectMembership; +use Exception; use UserAccessManager\Object\ObjectHandler; use UserAccessManager\UserGroup\AbstractUserGroup; use UserAccessManager\UserGroup\AssignmentInformation; @@ -39,11 +43,9 @@ class RoleMembershipHandler extends ObjectMembershipHandler /** * RoleMembershipHandler constructor. - * - * @param AssignmentInformationFactory $assignmentInformationFactory + * @param AssignmentInformationFactory $assignmentInformationFactory * @param Wordpress $wordpress - * - * @throws \Exception + * @throws Exception */ public function __construct(AssignmentInformationFactory $assignmentInformationFactory, Wordpress $wordpress) { @@ -53,11 +55,9 @@ public function __construct(AssignmentInformationFactory $assignmentInformationF /** * Returns the object and type name. - * - * @param string $objectId + * @param int|string $objectId * @param string $typeName - * - * @return string + * @return int|string */ public function getObjectName($objectId, &$typeName = '') { @@ -68,16 +68,18 @@ public function getObjectName($objectId, &$typeName = '') /** * Checks if the role is a member of the user group. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param string $objectId + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param int|string $objectId * @param null|AssignmentInformation $assignmentInformation - * - * @return bool + * @return bool */ - public function isMember(AbstractUserGroup $userGroup, $lockRecursive, $objectId, &$assignmentInformation = null) - { + public function isMember( + AbstractUserGroup $userGroup, + bool $lockRecursive, + $objectId, + ?AssignmentInformation &$assignmentInformation = null + ): bool { $isMember = $userGroup->isObjectAssignedToGroup( $this->generalObjectType, $objectId, @@ -90,14 +92,12 @@ public function isMember(AbstractUserGroup $userGroup, $lockRecursive, $objectId /** * Returns the full role objects. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param null $objectType - * - * @return array + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param null $objectType + * @return array */ - public function getFullObjects(AbstractUserGroup $userGroup, $lockRecursive, $objectType = null) + public function getFullObjects(AbstractUserGroup $userGroup, bool $lockRecursive, $objectType = null): array { $objectType = ($objectType === null) ? $this->generalObjectType : $objectType; diff --git a/src/ObjectMembership/TermMembershipHandler.php b/src/ObjectMembership/TermMembershipHandler.php index 642b248e..3e09d3d7 100644 --- a/src/ObjectMembership/TermMembershipHandler.php +++ b/src/ObjectMembership/TermMembershipHandler.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\ObjectMembership; +use Exception; use UserAccessManager\Object\ObjectHandler; use UserAccessManager\Object\ObjectMapHandler; use UserAccessManager\UserGroup\AbstractUserGroup; @@ -50,13 +54,11 @@ class TermMembershipHandler extends ObjectMembershipWithMapHandler /** * TermMembershipHandler constructor. - * - * @param AssignmentInformationFactory $assignmentInformationFactory + * @param AssignmentInformationFactory $assignmentInformationFactory * @param Wordpress $wordpress * @param ObjectHandler $objectHandler * @param ObjectMapHandler $objectMapHandler - * - * @throws \Exception + * @throws Exception */ public function __construct( AssignmentInformationFactory $assignmentInformationFactory, @@ -73,11 +75,9 @@ public function __construct( /** * Returns the object and type name. - * - * @param string $objectId + * @param int|string $objectId * @param string $typeName - * - * @return string + * @return int|string */ public function getObjectName($objectId, &$typeName = '') { @@ -94,10 +94,9 @@ public function getObjectName($objectId, &$typeName = '') /** * Returns the handled objects. - * - * @return array + * @return array */ - public function getHandledObjects() + public function getHandledObjects(): array { $keys = array_keys($this->objectHandler->getTaxonomies()); return array_merge(parent::getHandledObjects(), array_combine($keys, $keys)); @@ -105,39 +104,40 @@ public function getHandledObjects() /** * Returns the map. - * - * @return array + * @return array */ - protected function getMap() + protected function getMap(): array { return $this->objectMapHandler->getTermTreeMap(); } /** * Checks if the term is a member of the user group. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param string $objectId + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param int|string $objectId * @param null|AssignmentInformation $assignmentInformation - * - * @return bool + * @return bool + * @throws Exception */ - public function isMember(AbstractUserGroup $userGroup, $lockRecursive, $objectId, &$assignmentInformation = null) - { + public function isMember( + AbstractUserGroup $userGroup, + bool $lockRecursive, + $objectId, + ?AssignmentInformation &$assignmentInformation = null + ): bool { return $this->getMembershipByMap($userGroup, $lockRecursive, $objectId, $assignmentInformation); } /** * Returns the term role objects. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param null $objectType - * - * @return array + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param null $objectType + * @return array + * @throws Exception */ - public function getFullObjects(AbstractUserGroup $userGroup, $lockRecursive, $objectType = null) + public function getFullObjects(AbstractUserGroup $userGroup, bool $lockRecursive, $objectType = null): array { $objectType = ($objectType === null) ? $this->generalObjectType : $objectType; return $this->getFullObjectsByMap($userGroup, $lockRecursive, $objectType); diff --git a/src/ObjectMembership/UserMembershipHandler.php b/src/ObjectMembership/UserMembershipHandler.php index b3a7b1bc..fdb8fa0d 100644 --- a/src/ObjectMembership/UserMembershipHandler.php +++ b/src/ObjectMembership/UserMembershipHandler.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\ObjectMembership; +use Exception; use UserAccessManager\Database\Database; use UserAccessManager\Object\ObjectHandler; use UserAccessManager\UserGroup\AbstractUserGroup; @@ -50,13 +54,11 @@ class UserMembershipHandler extends ObjectMembershipHandler /** * UserMembershipHandler constructor. - * - * @param AssignmentInformationFactory $assignmentInformationFactory + * @param AssignmentInformationFactory $assignmentInformationFactory * @param Php $php * @param Database $database * @param ObjectHandler $objectHandler - * - * @throws \Exception + * @throws Exception */ public function __construct( AssignmentInformationFactory $assignmentInformationFactory, @@ -73,11 +75,9 @@ public function __construct( /** * Returns the object and type name. - * - * @param string $objectId + * @param int|string $objectId * @param string $typeName - * - * @return string + * @return int|string */ public function getObjectName($objectId, &$typeName = '') { @@ -88,16 +88,18 @@ public function getObjectName($objectId, &$typeName = '') /** * Checks if the user is a member of the user group. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param string $objectId + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param int|string $objectId * @param null|AssignmentInformation $assignmentInformation - * - * @return bool + * @return bool */ - public function isMember(AbstractUserGroup $userGroup, $lockRecursive, $objectId, &$assignmentInformation = null) - { + public function isMember( + AbstractUserGroup $userGroup, + bool $lockRecursive, + $objectId, + ?AssignmentInformation &$assignmentInformation = null + ): bool { $assignmentInformation = null; $recursiveMembership = []; $user = $this->objectHandler->getUser($objectId); @@ -141,18 +143,17 @@ public function isMember(AbstractUserGroup $userGroup, $lockRecursive, $objectId /** * Returns the user role objects. - * - * @param AbstractUserGroup $userGroup - * @param bool $lockRecursive - * @param null $objectType - * - * @return array + * @param AbstractUserGroup $userGroup + * @param bool $lockRecursive + * @param null $objectType + * @return array + * @throws Exception */ - public function getFullObjects(AbstractUserGroup $userGroup, $lockRecursive, $objectType = null) + public function getFullObjects(AbstractUserGroup $userGroup, bool $lockRecursive, $objectType = null): array { $users = []; - $databaseUsers = (array)$this->database->getResults( + $databaseUsers = (array) $this->database->getResults( "SELECT ID, user_nicename FROM {$this->database->getUsersTable()}" ); diff --git a/src/Setup/Database/Column.php b/src/Setup/Database/Column.php index c7c8ac98..c629c880 100644 --- a/src/Setup/Database/Column.php +++ b/src/Setup/Database/Column.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Database; /** @@ -34,7 +37,7 @@ class Column /** * @var int|string */ - private $default = null; + private $default; /** * @var bool @@ -53,17 +56,16 @@ class Column /** * Column constructor. - * * @param string $name * @param string $type - * @param bool $isNull - * @param mixed $default - * @param bool $isKey - * @param bool $isAutoIncrement + * @param bool $isNull + * @param mixed $default + * @param bool $isKey + * @param bool $isAutoIncrement */ public function __construct( - $name, - $type, + string $name, + string $type, $isNull = false, $default = null, $isKey = false, @@ -80,7 +82,7 @@ public function __construct( /** * @return string */ - public function getName() + public function getName(): string { return $this->name; } @@ -88,7 +90,7 @@ public function getName() /** * @return string */ - public function getType() + public function getType(): string { return $this->type; } @@ -104,7 +106,7 @@ public function getDefault() /** * @return bool */ - public function isNull() + public function isNull(): bool { return $this->isNull; } @@ -112,7 +114,7 @@ public function isNull() /** * @return bool */ - public function isKey() + public function isKey(): bool { return $this->isKey; } @@ -120,17 +122,16 @@ public function isKey() /** * @return bool */ - public function isAutoIncrement() + public function isAutoIncrement(): bool { return $this->isAutoIncrement; } /** * Returns a mysql column string. - * * @return string */ - public function __toString() + public function __toString(): string { $nullConstraint = ($this->isNull) ? 'NULL' : 'NOT NULL'; $column = "`{$this->name}` {$this->type} {$nullConstraint}"; diff --git a/src/Setup/Database/DatabaseHandler.php b/src/Setup/Database/DatabaseHandler.php index 48f4834b..37e0654e 100644 --- a/src/Setup/Database/DatabaseHandler.php +++ b/src/Setup/Database/DatabaseHandler.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Database; use UserAccessManager\Database\Database; @@ -54,11 +57,10 @@ class DatabaseHandler /** * DatabaseHandler constructor. - * - * @param Wordpress $wordpress - * @param Database $database + * @param Wordpress $wordpress + * @param Database $database * @param DatabaseObjectFactory $databaseObjectFactory - * @param UpdateFactory $updateFactory + * @param UpdateFactory $updateFactory */ public function __construct( Wordpress $wordpress, @@ -74,12 +76,10 @@ public function __construct( /** * Checks if the table exists. - * * @param string $table - * * @return bool */ - private function tableExists($table) + private function tableExists(string $table): bool { $dbTable = $this->database->getVariable("SHOW TABLES LIKE '{$table}'"); @@ -88,20 +88,19 @@ private function tableExists($table) /** * Adds a table. - * * @param Table $table */ private function addTable(Table $table) { - $this->database->dbDelta((string)$table); + $this->database->dbDelta((string) $table); } /** * Returns all tables. - * * @return Table[] + * @throws MissingColumnsException */ - private function getTables() + private function getTables(): array { $charsetCollate = $this->database->getCharset(); $tables = []; @@ -138,6 +137,7 @@ private function getTables() /** * Adds the tables to the database. + * @throws MissingColumnsException */ public function install() { @@ -152,15 +152,13 @@ public function install() /** * Returns the existing columns for a table. - * * @param Table $table - * * @return Column[] */ - private function getExistingColumns(Table $table) + private function getExistingColumns(Table $table): array { $query = "SHOW COLUMNS FROM `{$table->getName()}`;"; - $existingRawColumns = (array)$this->database->getResults($query); + $existingRawColumns = (array) $this->database->getResults($query); $existingColumns = []; foreach ($existingRawColumns as $existingRawColumn) { @@ -179,7 +177,6 @@ private function getExistingColumns(Table $table) /** * Add corrupted columns to the information array if the are some. - * * @param Table $table * @param array $information */ @@ -196,7 +193,7 @@ private function addCorruptedRows(Table $table, array &$information) $existingColumn = $existingColumns[$column->getName()]; unset($existingColumns[$column->getName()]); - if ((string)$column !== (string)$existingColumn) { + if ((string) $column !== (string) $existingColumn) { $information[self::MODIFIED_COLUMNS][] = [$table, $column]; continue; } @@ -209,10 +206,10 @@ private function addCorruptedRows(Table $table, array &$information) /** * Returns corrupted database information. - * * @return array + * @throws MissingColumnsException */ - public function getCorruptedDatabaseInformation() + public function getCorruptedDatabaseInformation(): array { $information = [ self::MISSING_TABLES => [], @@ -235,51 +232,44 @@ public function getCorruptedDatabaseInformation() /** * Adds a new column. - * - * @param Table $table + * @param Table $table * @param Column $column - * * @return bool */ - private function addColumn(Table $table, Column $column) + private function addColumn(Table $table, Column $column): bool { return $this->database->query("ALTER TABLE `{$table->getName()}` ADD $column;") !== false; } /** * Modify an existing column. - * - * @param Table $table + * @param Table $table * @param Column $column - * * @return bool */ - private function modifyColumn(Table $table, Column $column) + private function modifyColumn(Table $table, Column $column): bool { return $this->database->query("ALTER TABLE `{$table->getName()}` MODIFY $column;") !== false; } /** * Drops an existing column. - * - * @param Table $table + * @param Table $table * @param Column $column - * * @return bool */ - private function dropColumn(Table $table, Column $column) + private function dropColumn(Table $table, Column $column): bool { return $this->database->query("ALTER TABLE `{$table->getName()}` DROP `{$column->getName()}`;") !== false; } /** * Repairs a corrupt database. - * * @param array $information - * * @return bool + * @throws MissingColumnsException */ - public function repairDatabase(array $information = []) + public function repairDatabase(array $information = []): bool { $success = true; $information = ($information === []) ? $this->getCorruptedDatabaseInformation() : $information; @@ -305,16 +295,15 @@ public function repairDatabase(array $information = []) /** * Returns all sites where the user access manager is active. - * * @return array */ - private function getActivePluginSites() + private function getActivePluginSites(): array { $activeSites = []; foreach ($this->wordpress->getSites() as $site) { $this->wordpress->switchToBlog($site->blog_id); - $plugins = (array)$this->wordpress->getOption('active_plugins', []); + $plugins = (array) $this->wordpress->getOption('active_plugins', []); $pluginsMap = array_flip($plugins); if (isset($pluginsMap['user-access-manager/user-access-manager.php']) === true) { @@ -329,14 +318,13 @@ private function getActivePluginSites() /** * Checks if a database update is necessary. - * * @return bool */ - public function isDatabaseUpdateNecessary() + public function isDatabaseUpdateNecessary(): bool { if ($this->wordpress->isSuperAdmin() === true) { foreach ($this->getActivePluginSites() as $siteId) { - $table = $this->database->getBlogPrefix($siteId).'options'; + $table = $this->database->getBlogPrefix($siteId) . 'options'; $select = "SELECT option_value FROM {$table} WHERE option_name = '%s' LIMIT 1"; $select = $this->database->prepare($select, 'uam_db_version'); $currentDbVersion = $this->database->getVariable($select); @@ -355,10 +343,9 @@ public function isDatabaseUpdateNecessary() /** * Creates a database backup. - * * @return bool */ - public function backupDatabase() + public function backupDatabase(): bool { $currentDbVersion = $this->wordpress->getOption('uam_db_version'); @@ -388,18 +375,17 @@ public function backupDatabase() /** * Returns the version for which a backup was created. - * * @return array */ - public function getBackups() + public function getBackups(): array { $versions = []; - $tables = (array)$this->database->getColumn( + $tables = (array) $this->database->getColumn( "SHOW TABLES LIKE '{$this->database->getPrefix()}uam_%'" ); foreach ($tables as $table) { - if (preg_match('/.*\_([0-9\-]+)/i', $table, $matches) === 1) { + if (preg_match('/.*_([0-9\-]+)/i', $table, $matches) === 1) { $version = str_replace('-', '.', $matches[1]); $versions[$version] = $version; } @@ -410,12 +396,10 @@ public function getBackups() /** * Returns the backup tables for the given version. - * * @param string $version - * * @return array */ - private function getBackupTables($version) + private function getBackupTables(string $version): array { $backupTables = []; $tables = [ @@ -426,7 +410,7 @@ private function getBackupTables($version) $versionForDb = str_replace('.', '-', $version); foreach ($tables as $table) { - $backupTable = (string)$this->database->getVariable( + $backupTable = (string) $this->database->getVariable( "SHOW TABLES LIKE '{$table}_{$versionForDb}'" ); @@ -440,12 +424,10 @@ private function getBackupTables($version) /** * Reverts the database to the given version. - * * @param string $version - * * @return bool */ - public function revertDatabase($version) + public function revertDatabase(string $version): bool { $success = true; $tables = $this->getBackupTables($version); @@ -466,12 +448,10 @@ public function revertDatabase($version) /** * Deletes the given database backup. - * * @param string $version - * * @return bool */ - public function deleteBackup($version) + public function deleteBackup(string $version): bool { $success = true; $tables = $this->getBackupTables($version); @@ -486,10 +466,9 @@ public function deleteBackup($version) /** * Returns the ordered updates. - * * @return UpdateInterface[] */ - private function getOrderedDatabaseUpdates() + private function getOrderedDatabaseUpdates(): array { $rawUpdates = $this->updateFactory->getDatabaseUpdates(); $updates = []; @@ -504,10 +483,9 @@ private function getOrderedDatabaseUpdates() /** * Updates the database. - * * @return bool */ - public function updateDatabase() + public function updateDatabase(): bool { $currentDbVersion = $this->wordpress->getOption('uam_db_version'); @@ -532,6 +510,7 @@ public function updateDatabase() /** * Removes the tables. + * @throws MissingColumnsException */ public function removeTables() { diff --git a/src/Setup/Database/DatabaseObjectFactory.php b/src/Setup/Database/DatabaseObjectFactory.php index 3e986bc6..b8be5d02 100644 --- a/src/Setup/Database/DatabaseObjectFactory.php +++ b/src/Setup/Database/DatabaseObjectFactory.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Database; /** @@ -23,38 +26,35 @@ class DatabaseObjectFactory { /** * Creates a table object. - * * @param string $name * @param string $charsetCollate - * @param array $columns - * + * @param array $columns * @return Table + * @throws MissingColumnsException */ - public function createTable($name, $charsetCollate, array $columns) + public function createTable(string $name, string $charsetCollate, array $columns): Table { return new Table($name, $charsetCollate, $columns); } /** * Creates a column object. - * * @param string $name * @param string $type - * @param bool $isNull - * @param mixed $default - * @param bool $isKey - * @param bool $isAutoIncrement - * + * @param bool $isNull + * @param mixed $default + * @param bool $isKey + * @param bool $isAutoIncrement * @return Column */ public function createColumn( - $name, - $type, + string $name, + string $type, $isNull = false, $default = null, $isKey = false, $isAutoIncrement = false - ) { + ): Column { return new Column($name, $type, $isNull, $default, $isKey, $isAutoIncrement); } } diff --git a/src/Setup/Database/DatabaseUpdate.php b/src/Setup/Database/DatabaseUpdate.php index e2c8fee6..f4ac9031 100644 --- a/src/Setup/Database/DatabaseUpdate.php +++ b/src/Setup/Database/DatabaseUpdate.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Database; use UserAccessManager\Database\Database; @@ -37,8 +40,7 @@ abstract class DatabaseUpdate implements UpdateInterface /** * Update constructor. - * - * @param Database $database + * @param Database $database * @param ObjectHandler $objectHandler */ public function __construct(Database $database, ObjectHandler $objectHandler) diff --git a/src/Setup/Database/MissingColumnsException.php b/src/Setup/Database/MissingColumnsException.php index 39cf8f12..a9fa6e3b 100644 --- a/src/Setup/Database/MissingColumnsException.php +++ b/src/Setup/Database/MissingColumnsException.php @@ -1,13 +1,17 @@ name = $name; $this->charsetCollate = $charsetCollate; @@ -60,7 +61,7 @@ public function __construct($name, $charsetCollate, array $columns) /** * @return string */ - public function getName() + public function getName(): string { return $this->name; } @@ -68,7 +69,7 @@ public function getName() /** * @return string */ - public function getCharsetCollate() + public function getCharsetCollate(): string { return $this->charsetCollate; } @@ -76,17 +77,16 @@ public function getCharsetCollate() /** * @return Column[] */ - public function getColumns() + public function getColumns(): array { return $this->columns; } /** * Returns the table in sql format. - * * @return string */ - public function __toString() + public function __toString(): string { $columns = implode(', ', $this->columns); $primaryKeys = []; @@ -104,10 +104,8 @@ public function __toString() $primaryKeysQuery = ", PRIMARY KEY ({$primaryKeysQuery})"; } - $table = "CREATE TABLE `{$this->name}` ( + return "CREATE TABLE `{$this->name}` ( {$columns}{$primaryKeysQuery} ) {$this->charsetCollate};"; - - return $table; } } diff --git a/src/Setup/SetupHandler.php b/src/Setup/SetupHandler.php index 2f402ba2..ce638c35 100644 --- a/src/Setup/SetupHandler.php +++ b/src/Setup/SetupHandler.php @@ -12,12 +12,16 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup; use UserAccessManager\Config\MainConfig; use UserAccessManager\Database\Database; use UserAccessManager\File\FileHandler; use UserAccessManager\Setup\Database\DatabaseHandler; +use UserAccessManager\Setup\Database\MissingColumnsException; use UserAccessManager\Wrapper\Wordpress; /** @@ -54,12 +58,11 @@ class SetupHandler /** * SetupHandler constructor. - * - * @param Wordpress $wordpress - * @param Database $database + * @param Wordpress $wordpress + * @param Database $database * @param DatabaseHandler $databaseHandler - * @param MainConfig $mainConfig - * @param FileHandler $fileHandler + * @param MainConfig $mainConfig + * @param FileHandler $fileHandler */ public function __construct( Wordpress $wordpress, @@ -77,20 +80,18 @@ public function __construct( /** * Returns the database handler object. - * * @return DatabaseHandler */ - public function getDatabaseHandler() + public function getDatabaseHandler(): DatabaseHandler { return $this->databaseHandler; } /** * Returns all blog of the network. - * * @return integer[] */ - public function getBlogIds() + public function getBlogIds(): array { $currentBlogId = $this->database->getCurrentBlogId(); $blogIds = [$currentBlogId => $currentBlogId]; @@ -105,6 +106,7 @@ public function getBlogIds() /** * Creates the needed tables at the database and adds the options + * @throws MissingColumnsException */ private function runInstall() { @@ -113,8 +115,8 @@ private function runInstall() /** * Installs the user access manager. - * * @param bool $networkWide + * @throws MissingColumnsException */ public function install($networkWide = false) { @@ -133,10 +135,9 @@ public function install($networkWide = false) /** * Updates the user access manager if an old version was installed. - * * @return bool */ - public function update() + public function update(): bool { $uamVersion = $this->wordpress->getOption('uam_version', '0'); @@ -153,6 +154,7 @@ public function update() /** * Clean up wordpress if the plugin will be uninstalled. + * @throws MissingColumnsException */ public function uninstall() { @@ -173,10 +175,9 @@ public function uninstall() /** * Remove the htaccess file if the plugin is deactivated. - * * @return bool */ - public function deactivate() + public function deactivate(): bool { return $this->fileHandler->deleteFileProtection(); } diff --git a/src/Setup/Update/DatabaseUpdate1.php b/src/Setup/Update/DatabaseUpdate1.php index 9465b423..4787efaf 100644 --- a/src/Setup/Update/DatabaseUpdate1.php +++ b/src/Setup/Update/DatabaseUpdate1.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Update; use UserAccessManager\Setup\Database\DatabaseUpdate; @@ -25,22 +28,19 @@ class DatabaseUpdate1 extends DatabaseUpdate { /** * Returns the version. - * * @return string */ - public function getVersion() + public function getVersion(): string { return '1.0'; } /** * Updates the user group table to version 1.0. - * * @param string $userGroupTable - * * @return bool */ - private function updateToUserGroupTableUpdate($userGroupTable) + private function updateToUserGroupTableUpdate(string $userGroupTable): bool { $alterQuery = "ALTER TABLE {$userGroupTable} ADD read_access TINYTEXT NOT NULL DEFAULT '', @@ -53,7 +53,7 @@ private function updateToUserGroupTableUpdate($userGroupTable) $success = $this->database->query($updateQuery) !== false; $selectQuery = "SHOW columns FROM {$userGroupTable} LIKE 'ip_range'"; - $dbIpRange = (string)$this->database->getVariable($selectQuery); + $dbIpRange = (string) $this->database->getVariable($selectQuery); if ($dbIpRange !== 'ip_range') { $alterQuery = "ALTER TABLE {$userGroupTable} ADD ip_range MEDIUMTEXT NULL DEFAULT ''"; @@ -65,27 +65,25 @@ private function updateToUserGroupTableUpdate($userGroupTable) /** * Returns the select query for the object type. - * * @param string $objectType * @param string $userGroupToPost * @param string $userGroupToCategory * @param string $userGroupToUser * @param string $userGroupToRole - * * @return null|string */ private function getObjectSelectQuery( - $objectType, - $userGroupToPost, - $userGroupToCategory, - $userGroupToUser, - $userGroupToRole - ) { + string $objectType, + string $userGroupToPost, + string $userGroupToCategory, + string $userGroupToUser, + string $userGroupToRole + ): ?string { $addition = ''; if ($this->objectHandler->isPostType($objectType) === true) { $dbIdName = 'post_id'; - $database = $userGroupToPost.', '.$this->database->getPostsTable(); + $database = $userGroupToPost . ', ' . $this->database->getPostsTable(); $addition = " WHERE post_id = ID AND post_type = '{$objectType}'"; } elseif ($objectType === 'category') { $dbIdName = 'category_id'; @@ -106,16 +104,16 @@ private function getObjectSelectQuery( /** * Updates the user group to object table to version 1.0. */ - private function updateToUserGroupToObjectTableUpdate() + private function updateToUserGroupToObjectTableUpdate(): bool { $prefix = $this->database->getPrefix(); $charsetCollate = $this->database->getCharset(); - $userGroupToObject = $prefix.'uam_accessgroup_to_object'; - $userGroupToPost = $prefix.'uam_accessgroup_to_post'; - $userGroupToUser = $prefix.'uam_accessgroup_to_user'; - $userGroupToCategory = $prefix.'uam_accessgroup_to_category'; - $userGroupToRole = $prefix.'uam_accessgroup_to_role'; + $userGroupToObject = $prefix . 'uam_accessgroup_to_object'; + $userGroupToPost = $prefix . 'uam_accessgroup_to_post'; + $userGroupToUser = $prefix . 'uam_accessgroup_to_user'; + $userGroupToCategory = $prefix . 'uam_accessgroup_to_category'; + $userGroupToRole = $prefix . 'uam_accessgroup_to_role'; $alterQuery = "ALTER TABLE '{$userGroupToObject}' CHANGE 'object_id' 'object_id' VARCHAR(64) {$charsetCollate}"; @@ -140,7 +138,7 @@ private function updateToUserGroupToObjectTableUpdate() continue; } - $dbObjects = (array)$this->database->getResults($query); + $dbObjects = (array) $this->database->getResults($query); foreach ($dbObjects as $dbObject) { $insert = $this->database->insert( @@ -170,10 +168,9 @@ private function updateToUserGroupToObjectTableUpdate() /** * Executes the update. - * * @return bool */ - public function update() + public function update(): bool { $success = true; $userGroupTable = $this->database->getUserGroupTable(); diff --git a/src/Setup/Update/DatabaseUpdate2.php b/src/Setup/Update/DatabaseUpdate2.php index 1e8fe9b4..04b52b53 100644 --- a/src/Setup/Update/DatabaseUpdate2.php +++ b/src/Setup/Update/DatabaseUpdate2.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Update; use UserAccessManager\Setup\Database\DatabaseUpdate; @@ -25,20 +28,18 @@ class DatabaseUpdate2 extends DatabaseUpdate { /** * Returns the version. - * * @return string */ - public function getVersion() + public function getVersion(): string { return '1.2'; } /** * Executes the update. - * * @return bool */ - public function update() + public function update(): bool { $dbAccessGroupToObject = $this->database->getUserGroupToObjectTable(); $query = "ALTER TABLE `{$dbAccessGroupToObject}` diff --git a/src/Setup/Update/DatabaseUpdate3.php b/src/Setup/Update/DatabaseUpdate3.php index 36b485b8..dc59c045 100644 --- a/src/Setup/Update/DatabaseUpdate3.php +++ b/src/Setup/Update/DatabaseUpdate3.php @@ -13,6 +13,8 @@ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ +declare(strict_types=1); + namespace UserAccessManager\Setup\Update; use UserAccessManager\Object\ObjectHandler; @@ -27,20 +29,18 @@ class DatabaseUpdate3 extends DatabaseUpdate { /** * Returns the version. - * * @return string */ - public function getVersion() + public function getVersion(): string { return '1.3'; } /** * Executes the update. - * * @return bool */ - public function update() + public function update(): bool { $dbAccessGroupToObject = $this->database->getUserGroupToObjectTable(); $generalTermType = ObjectHandler::GENERAL_TERM_OBJECT_TYPE; diff --git a/src/Setup/Update/DatabaseUpdate4.php b/src/Setup/Update/DatabaseUpdate4.php index fecdce73..afdef653 100644 --- a/src/Setup/Update/DatabaseUpdate4.php +++ b/src/Setup/Update/DatabaseUpdate4.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Update; use UserAccessManager\Object\ObjectHandler; @@ -26,20 +29,18 @@ class DatabaseUpdate4 extends DatabaseUpdate { /** * Returns the version. - * * @return string */ - public function getVersion() + public function getVersion(): string { return '1.4.1'; } /** * Executes the update. - * * @return bool */ - public function update() + public function update(): bool { $success = true; diff --git a/src/Setup/Update/DatabaseUpdate5.php b/src/Setup/Update/DatabaseUpdate5.php index 29887b96..dc25fdc4 100644 --- a/src/Setup/Update/DatabaseUpdate5.php +++ b/src/Setup/Update/DatabaseUpdate5.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Update; +use Exception; use UserAccessManager\Setup\Database\DatabaseUpdate; /** @@ -25,27 +29,26 @@ class DatabaseUpdate5 extends DatabaseUpdate { /** * Returns the version. - * * @return string */ - public function getVersion() + public function getVersion(): string { return '1.5.1'; } /** * Executes the update. - * * @return bool + * @throws Exception */ - public function update() + public function update(): bool { $dbAccessGroupToObject = $this->database->getUserGroupToObjectTable(); $query = "SELECT object_id AS objectId, object_type AS objectType, group_id AS groupId FROM {$dbAccessGroupToObject} WHERE general_object_type = ''"; - $dbObjects = (array)$this->database->getResults($query); + $dbObjects = (array) $this->database->getResults($query); $success = true; foreach ($dbObjects as $dbObject) { diff --git a/src/Setup/Update/DatabaseUpdate6.php b/src/Setup/Update/DatabaseUpdate6.php index 6e6993d7..7157df30 100644 --- a/src/Setup/Update/DatabaseUpdate6.php +++ b/src/Setup/Update/DatabaseUpdate6.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Update; use UserAccessManager\Setup\Database\DatabaseUpdate; @@ -26,20 +29,18 @@ class DatabaseUpdate6 extends DatabaseUpdate { /** * Returns the version. - * * @return string */ - public function getVersion() + public function getVersion(): string { return '1.6.1'; } /** * Executes the update. - * * @return bool */ - public function update() + public function update(): bool { $dbAccessGroupToObject = $this->database->getUserGroupToObjectTable(); diff --git a/src/Setup/Update/UpdateFactory.php b/src/Setup/Update/UpdateFactory.php index 5b6066a0..3ed2556c 100644 --- a/src/Setup/Update/UpdateFactory.php +++ b/src/Setup/Update/UpdateFactory.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Update; use UserAccessManager\Database\Database; @@ -36,8 +39,7 @@ class UpdateFactory /** * UpdateFactory constructor. - * - * @param Database $database + * @param Database $database * @param ObjectHandler $objectHandler */ public function __construct(Database $database, ObjectHandler $objectHandler) @@ -48,10 +50,9 @@ public function __construct(Database $database, ObjectHandler $objectHandler) /** * Returns all available updates. - * * @return UpdateInterface[] */ - public function getDatabaseUpdates() + public function getDatabaseUpdates(): array { return [ new DatabaseUpdate1($this->database, $this->objectHandler), diff --git a/src/Setup/Update/UpdateInterface.php b/src/Setup/Update/UpdateInterface.php index cafbf8a6..973077c1 100644 --- a/src/Setup/Update/UpdateInterface.php +++ b/src/Setup/Update/UpdateInterface.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Setup\Update; /** @@ -24,10 +27,10 @@ interface UpdateInterface /** * @return string */ - public function getVersion(); + public function getVersion(): string; /** * @return bool */ - public function update(); + public function update(): bool; } diff --git a/src/User/UserHandler.php b/src/User/UserHandler.php index d207a07f..96e01677 100644 --- a/src/User/UserHandler.php +++ b/src/User/UserHandler.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\User; use UserAccessManager\Config\MainConfig; @@ -19,6 +22,7 @@ use UserAccessManager\Object\ObjectHandler; use UserAccessManager\UserGroup\UserGroup; use UserAccessManager\Wrapper\Wordpress; +use WP_User; /** * Class UserHandler @@ -51,11 +55,10 @@ class UserHandler /** * The constructor - * - * @param Wordpress $wordpress - * @param MainConfig $config - * @param Database $database - * @param ObjectHandler $objectHandler + * @param Wordpress $wordpress + * @param MainConfig $config + * @param Database $database + * @param ObjectHandler $objectHandler */ public function __construct( Wordpress $wordpress, @@ -71,12 +74,10 @@ public function __construct( /** * Converts the ip to an integer. - * * @param string $ip - * * @return string|false */ - private function calculateIp($ip) + private function calculateIp(string $ip) { if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false) { return base_convert(ip2long($ip), 10, 2); @@ -89,7 +90,7 @@ private function calculateIp($ip) $binaryIp = ''; while ($bits >= 0) { - $binaryIp = sprintf('%08b', (ord($packedIp[$bits]))).$binaryIp; + $binaryIp = sprintf('%08b', (ord($packedIp[$bits]))) . $binaryIp; $bits--; } @@ -98,12 +99,10 @@ private function calculateIp($ip) /** * Calculates the ip range. - * * @param string $ipRange - * * @return array */ - private function getCalculatedRange($ipRange) + private function getCalculatedRange(string $ipRange): array { $ipRange = explode('-', $ipRange); $rangeBegin = $ipRange[0]; @@ -117,13 +116,11 @@ private function getCalculatedRange($ipRange) /** * Checks if the given ip matches with the range. - * * @param string $currentIp The ip of the current user. - * @param array $ipRanges The ip ranges. - * + * @param array $ipRanges The ip ranges. * @return bool */ - public function isIpInRange($currentIp, array $ipRanges) + public function isIpInRange(string $currentIp, array $ipRanges): bool { $currentIp = $this->calculateIp($currentIp); @@ -144,15 +141,13 @@ public function isIpInRange($currentIp, array $ipRanges) /** * Return the role of the user. - * - * @param \WP_User|false $user The user. - * + * @param WP_User|false $user The user. * @return array */ - public function getUserRole($user) + public function getUserRole($user): array { - if ($user instanceof \WP_User && isset($user->{$this->database->getPrefix().'capabilities'}) === true) { - $capabilities = (array)$user->{$this->database->getPrefix().'capabilities'}; + if ($user instanceof WP_User && isset($user->{$this->database->getPrefix() . 'capabilities'}) === true) { + $capabilities = (array) $user->{$this->database->getPrefix() . 'capabilities'}; } else { $capabilities = []; } @@ -162,12 +157,10 @@ public function getUserRole($user) /** * Checks the user access by user level. - * * @param bool|string $allowedCapability If set check also for the capability. - * * @return bool */ - public function checkUserAccess($allowedCapability = false) + public function checkUserAccess($allowedCapability = false): bool { $currentUser = $this->wordpress->getCurrentUser(); @@ -194,12 +187,10 @@ public function checkUserAccess($allowedCapability = false) /** * Checks if the user is an admin user - * - * @param integer $userId The user id. - * + * @param int|string $userId The user id. * @return bool */ - public function userIsAdmin($userId) + public function userIsAdmin($userId): bool { $user = $this->objectHandler->getUser($userId); $roles = $this->getUserRole($user); diff --git a/src/UserAccessManager.php b/src/UserAccessManager.php index 02c55580..3835e140 100644 --- a/src/UserAccessManager.php +++ b/src/UserAccessManager.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager; use UserAccessManager\Access\AccessHandler; @@ -32,7 +35,6 @@ use UserAccessManager\Object\ObjectHandler; use UserAccessManager\ObjectMembership\ObjectMembershipHandlerFactory; use UserAccessManager\Setup\SetupHandler; -use UserAccessManager\UserGroup\UserGroupAssignmentHandler; use UserAccessManager\UserGroup\UserGroupFactory; use UserAccessManager\User\UserHandler; use UserAccessManager\UserGroup\UserGroupHandler; @@ -48,7 +50,7 @@ */ class UserAccessManager { - const VERSION = '2.1.13'; + const VERSION = '2.2.0'; const DB_VERSION = '1.6.1'; /** @@ -96,11 +98,6 @@ class UserAccessManager */ private $userGroupHandler; - /** - * @var UserGroupAssignmentHandler - */ - private $userGroupAssignmentHandler; - /** * @var AccessHandler */ @@ -163,8 +160,7 @@ class UserAccessManager /** * UserAccessManager constructor. - * - * @param Php $php + * @param Php $php * @param Wordpress $wordpress * @param Util $util * @param Cache $cache @@ -237,7 +233,7 @@ public function __construct( /** * @return Php */ - public function getPhp() + public function getPhp(): Php { return $this->php; } @@ -245,7 +241,7 @@ public function getPhp() /** * @return Wordpress */ - public function getWordpress() + public function getWordpress(): Wordpress { return $this->wordpress; } @@ -253,7 +249,7 @@ public function getWordpress() /** * @return Util */ - public function getUtil() + public function getUtil(): Util { return $this->util; } @@ -261,7 +257,7 @@ public function getUtil() /** * @return Cache */ - public function getCache() + public function getCache(): Cache { return $this->cache; } @@ -269,7 +265,7 @@ public function getCache() /** * @return MainConfig */ - public function getConfig() + public function getConfig(): MainConfig { return $this->config; } @@ -277,7 +273,7 @@ public function getConfig() /** * @return Database */ - public function getDatabase() + public function getDatabase(): Database { return $this->database; } @@ -285,7 +281,7 @@ public function getDatabase() /** * @return ObjectHandler */ - public function getObjectHandler() + public function getObjectHandler(): ObjectHandler { return $this->objectHandler; } @@ -293,7 +289,7 @@ public function getObjectHandler() /** * @return UserHandler */ - public function getUserHandler() + public function getUserHandler(): UserHandler { return $this->userHandler; } @@ -301,7 +297,7 @@ public function getUserHandler() /** * @return UserGroupHandler */ - public function getUserGroupHandler() + public function getUserGroupHandler(): UserGroupHandler { return $this->userGroupHandler; } @@ -309,7 +305,7 @@ public function getUserGroupHandler() /** * @return AccessHandler */ - public function getAccessHandler() + public function getAccessHandler(): AccessHandler { return $this->accessHandler; } @@ -317,7 +313,7 @@ public function getAccessHandler() /** * @return FileHandler */ - public function getFileHandler() + public function getFileHandler(): FileHandler { return $this->fileHandler; } @@ -325,7 +321,7 @@ public function getFileHandler() /** * @return SetupHandler */ - public function getSetupHandler() + public function getSetupHandler(): SetupHandler { return $this->setupHandler; } @@ -333,7 +329,7 @@ public function getSetupHandler() /** * @return UserGroupFactory */ - public function getUserGroupFactory() + public function getUserGroupFactory(): UserGroupFactory { return $this->userGroupFactory; } @@ -341,7 +337,7 @@ public function getUserGroupFactory() /** * @return ObjectMembershipHandlerFactory */ - public function getObjectMembershipHandlerFactory() + public function getObjectMembershipHandlerFactory(): ObjectMembershipHandlerFactory { return $this->membershipHandlerFactory; } @@ -349,7 +345,7 @@ public function getObjectMembershipHandlerFactory() /** * @return ControllerFactory */ - public function getControllerFactory() + public function getControllerFactory(): ControllerFactory { return $this->controllerFactory; } @@ -357,7 +353,7 @@ public function getControllerFactory() /** * @return WidgetFactory */ - public function getWidgetFactory() + public function getWidgetFactory(): WidgetFactory { return $this->widgetFactory; } @@ -365,7 +361,7 @@ public function getWidgetFactory() /** * @return CacheProviderFactory */ - public function getCacheProviderFactory() + public function getCacheProviderFactory(): CacheProviderFactory { return $this->cacheProviderFactory; } @@ -373,7 +369,7 @@ public function getCacheProviderFactory() /** * @return ConfigFactory */ - public function getConfigFactory() + public function getConfigFactory(): ConfigFactory { return $this->configFactory; } @@ -381,7 +377,7 @@ public function getConfigFactory() /** * @return ConfigParameterFactory */ - public function getConfigParameterFactory() + public function getConfigParameterFactory(): ConfigParameterFactory { return $this->configParameterFactory; } @@ -389,7 +385,7 @@ public function getConfigParameterFactory() /** * @return FileProtectionFactory */ - public function getFileProtectionFactory() + public function getFileProtectionFactory(): FileProtectionFactory { return $this->fileProtectionFactory; } @@ -397,7 +393,7 @@ public function getFileProtectionFactory() /** * @return FileObjectFactory */ - public function getFileObjectFactory() + public function getFileObjectFactory(): FileObjectFactory { return $this->fileObjectFactory; } @@ -475,8 +471,7 @@ public function registerAdminMenu() /** * Adds the backend filters. - * - * @param DynamicGroupsController $dynamicGroupController + * @param DynamicGroupsController $dynamicGroupController * @param PostObjectController $postObjectController * @param TermObjectController $termObjectController * @param UserObjectController $userObjectController @@ -560,8 +555,7 @@ private function addAdminActions( /** * Adds the admin filters. - * - * @param PostObjectController $postObjectController + * @param PostObjectController $postObjectController * @param TermObjectController $termObjectController * @param UserObjectController $userObjectController * @param array $taxonomies @@ -578,7 +572,7 @@ private function addAdminFilters( $this->wordpress->addFilter('manage_posts_columns', [$postObjectController, 'addPostColumnsHeader']); $this->wordpress->addFilter('manage_pages_columns', [$postObjectController, 'addPostColumnsHeader']); - $this->wordpress->addFilter('manage_users_columns', [$userObjectController, 'addUserColumnsHeader'], 10); + $this->wordpress->addFilter('manage_users_columns', [$userObjectController, 'addUserColumnsHeader']); $this->wordpress->addFilter( 'manage_users_custom_column', [$userObjectController, 'addUserColumn'], @@ -600,8 +594,7 @@ private function addAdminFilters( /** * Adds the admin meta boxes. - * - * @param PostObjectController $postObjectController + * @param PostObjectController $postObjectController */ private function addAdminMetaBoxes(PostObjectController $postObjectController) { @@ -625,6 +618,7 @@ private function addAdminMetaBoxes(PostObjectController $postObjectController) /** * Register the admin actions and filters + * @throws UserGroup\UserGroupTypeException */ public function registerAdminActionsAndFilters() { diff --git a/src/UserGroup/AbstractUserGroup.php b/src/UserGroup/AbstractUserGroup.php index 998e33f9..48d8a7d2 100644 --- a/src/UserGroup/AbstractUserGroup.php +++ b/src/UserGroup/AbstractUserGroup.php @@ -12,13 +12,16 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\UserGroup; +use Exception; use UserAccessManager\Config\MainConfig; use UserAccessManager\Database\Database; use UserAccessManager\Object\ObjectHandler; use UserAccessManager\ObjectMembership\MissingObjectMembershipHandlerException; -use UserAccessManager\ObjectMembership\ObjectMembershipHandlerFactory; use UserAccessManager\Util\Util; use UserAccessManager\Wrapper\Php; use UserAccessManager\Wrapper\Wordpress; @@ -62,11 +65,6 @@ abstract class AbstractUserGroup */ protected $objectHandler; - /** - * @var ObjectMembershipHandlerFactory - */ - protected $membershipHandlerFactory; - /** * @var AssignmentInformationFactory */ @@ -129,16 +127,14 @@ abstract class AbstractUserGroup /** * AbstractUserGroup constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param Database $database - * @param MainConfig $config - * @param Util $util - * @param ObjectHandler $objectHandler + * @param Php $php + * @param Wordpress $wordpress + * @param Database $database + * @param MainConfig $config + * @param Util $util + * @param ObjectHandler $objectHandler * @param AssignmentInformationFactory $assignmentInformationFactory - * @param null|string $id - * + * @param null|int|string $id * @throws UserGroupTypeException */ public function __construct( @@ -170,9 +166,8 @@ public function __construct( */ /** - * Returns the group _iId. - * - * @return string + * Returns the group id. + * @return int|string|null */ public function getId() { @@ -181,100 +176,90 @@ public function getId() /** * Returns the user group type. - * * @return string */ - public function getType() + public function getType(): ?string { return $this->type; } /** * Returns the group name. - * * @return string */ - public function getName() + public function getName(): ?string { return $this->name; } /** * Sets the group name. - * * @param string $name The new group name. */ - public function setName($name) + public function setName(string $name) { $this->name = $name; } /** * Returns the group description. - * * @return string */ - public function getDescription() + public function getDescription(): ?string { return $this->description; } /** * Sets the group description. - * * @param string $description The new group description. */ - public function setDescription($description) + public function setDescription(string $description) { $this->description = $description; } /** * Returns the read access. - * * @return string */ - public function getReadAccess() + public function getReadAccess(): string { return $this->readAccess; } /** * Sets the read access. - * * @param string $readAccess The read access. */ - public function setReadAccess($readAccess) + public function setReadAccess(string $readAccess) { $this->readAccess = $readAccess; } /** * Returns the write access. - * * @return string */ - public function getWriteAccess() + public function getWriteAccess(): string { return $this->writeAccess; } /** * Sets the write access. - * * @param string $writeAccess The write access. */ - public function setWriteAccess($writeAccess) + public function setWriteAccess(string $writeAccess) { $this->writeAccess = $writeAccess; } /** * Sets the ignore dates flag. - * * @param bool $ignoreDates */ - public function setIgnoreDates($ignoreDates) + public function setIgnoreDates(bool $ignoreDates) { if ($this->ignoreDates !== $ignoreDates) { $this->resetObjects(); @@ -283,6 +268,15 @@ public function setIgnoreDates($ignoreDates) $this->ignoreDates = $ignoreDates; } + /** + * Return the ignore dates flag. + * @return bool + */ + public function getIgnoreDates(): bool + { + return $this->ignoreDates; + } + /** * Resets the objects */ @@ -295,10 +289,10 @@ protected function resetObjects() /** * Deletes the user group. - * * @return bool + * @throws Exception */ - public function delete() + public function delete(): bool { $allObjectTypes = $this->objectHandler->getAllObjectTypes(); @@ -311,15 +305,14 @@ public function delete() /** * Adds a object of the given type. - * * @param string $objectType The object type. - * @param string $objectId The object id. - * @param string $fromDate From date. - * @param string $toDate To date. - * + * @param int|string $objectId The object id. + * @param null $fromDate From date. + * @param null $toDate To date. * @return bool + * @throws Exception */ - public function addObject($objectType, $objectId, $fromDate = null, $toDate = null) + public function addObject(string $objectType, $objectId, $fromDate = null, $toDate = null): bool { $generalObjectType = $this->objectHandler->getGeneralObjectType($objectType); @@ -361,14 +354,13 @@ public function addObject($objectType, $objectId, $fromDate = null, $toDate = nu /** * Removes a object of the given type. - * - * @param string $objectType The object type. - * @param string $objectId The object id. - * @param bool $ignoreGeneralType - * + * @param string $objectType The object type. + * @param null $objectId The object id. + * @param bool $ignoreGeneralType * @return bool + * @throws Exception */ - public function removeObject($objectType, $objectId = null, $ignoreGeneralType = false) + public function removeObject(string $objectType, $objectId = null, $ignoreGeneralType = false): bool { $generalObjectType = $this->objectHandler->getGeneralObjectType($objectType); @@ -412,12 +404,10 @@ public function removeObject($objectType, $objectId = null, $ignoreGeneralType = /** * Returns the assigned objects. - * * @param string $objectType The object type. - * * @return AssignmentInformation[] */ - public function getAssignedObjects($objectType) + public function getAssignedObjects(string $objectType): array { if (isset($this->assignedObjects[$objectType]) === false) { $query = "SELECT object_id AS id, object_type AS objectType, from_date AS fromDate, to_date AS toDate @@ -441,7 +431,7 @@ public function getAssignedObjects($objectType) } $query = $this->database->prepare($query, $parameters); - $results = (array)$this->database->getResults($query); + $results = (array) $this->database->getResults($query); $this->assignedObjects[$objectType] = []; foreach ($results as $result) { @@ -455,14 +445,13 @@ public function getAssignedObjects($objectType) /** * Marks the group as default for the object type. - * - * @param string $objectType + * @param string $objectType * @param null|int $fromTime * @param null|int $toTime - * * @return bool + * @throws Exception */ - public function addDefaultType($objectType, $fromTime = null, $toTime = null) + public function addDefaultType(string $objectType, $fromTime = null, $toTime = null): bool { $fromDate = ($fromTime !== null) ? gmdate('Y-m-d H:i:s', $fromTime) : null; $toTime = ($toTime !== null && $toTime <= $fromTime) ? $fromTime + 1 : $toTime; @@ -473,22 +462,20 @@ public function addDefaultType($objectType, $fromTime = null, $toTime = null) /** * Removes the group as default for object type. - * * @param string $objectType - * * @return bool + * @throws Exception */ - public function removeDefaultType($objectType) + public function removeDefaultType(string $objectType): bool { return $this->removeObject($objectType, '', true); } /** * Returns the object type for which the user group is the default group. - * * @return array */ - public function getDefaultGroupForObjectTypes() + public function getDefaultGroupForObjectTypes(): ?array { if ($this->defaultTypes === null) { $this->defaultTypes = []; @@ -505,7 +492,7 @@ public function getDefaultGroupForObjectTypes() ]; $query = $this->database->prepare($query, $parameters); - $results = (array)$this->database->getResults($query); + $results = (array) $this->database->getResults($query); foreach ($results as $result) { $this->defaultTypes[$result->objectType] = [ @@ -520,14 +507,12 @@ public function getDefaultGroupForObjectTypes() /** * Checks if the group is the default one for the given object type. - * - * @param string $objectType + * @param string $objectType * @param null|int $fromTime * @param null|int $toTime - * * @return bool */ - public function isDefaultGroupForObjectType($objectType, &$fromTime = null, &$toTime = null) + public function isDefaultGroupForObjectType(string $objectType, &$fromTime = null, &$toTime = null): bool { $defaultGroupForObjectTypes = $this->getDefaultGroupForObjectTypes(); @@ -537,9 +522,9 @@ public function isDefaultGroupForObjectType($objectType, &$fromTime = null, &$to if (isset($defaultGroupForObjectTypes[$objectType])) { $fromTime = $defaultGroupForObjectTypes[$objectType][0] !== null ? - (int)$defaultGroupForObjectTypes[$objectType][0] : null; + (int) $defaultGroupForObjectTypes[$objectType][0] : null; $toTime = $defaultGroupForObjectTypes[$objectType][1] !== null ? - (int)$defaultGroupForObjectTypes[$objectType][1] : null; + (int) $defaultGroupForObjectTypes[$objectType][1] : null; return true; } @@ -549,18 +534,16 @@ public function isDefaultGroupForObjectType($objectType, &$fromTime = null, &$to /** * Checks if the object is assigned to the group. - * - * @param string $objectType The object type. - * @param string $objectId The object id. + * @param string $objectType The object type. + * @param int|string $objectId The object id. * @param AssignmentInformation|null $assignmentInformation The assignment information object. - * * @return bool */ public function isObjectAssignedToGroup( - $objectType, + string $objectType, $objectId, &$assignmentInformation = null - ) { + ): bool { $assignmentInformation = null; $assignedObjects = $this->getAssignedObjects($objectType); @@ -574,18 +557,17 @@ public function isObjectAssignedToGroup( /** * Returns a single object. - * - * @param string $objectType The object type. - * @param string $objectId The id of the object which should be checked. - * @param AssignmentInformation $assignmentInformation The assignment information - * + * @param string $objectType The object type. + * @param int|string $objectId The id of the object which should be checked. + * @param null $assignmentInformation The assignment information * @return bool + * @throws Exception */ public function isObjectMember( - $objectType, + string $objectType, $objectId, &$assignmentInformation = null - ) { + ): bool { if (isset($this->objectMembership[$objectType][$objectId]) === false) { try { $isMember = $this->objectHandler->getObjectMembershipHandler($objectType)->isMember( @@ -610,65 +592,60 @@ public function isObjectMember( /** * Checks if the role is a group member. - * - * @param string $roleId - * @param AssignmentInformation $assignmentInformation - * + * @param string $roleId + * @param null $assignmentInformation * @return bool + * @throws Exception */ - public function isRoleMember($roleId, &$assignmentInformation = null) + public function isRoleMember(string $roleId, &$assignmentInformation = null): bool { return $this->isObjectMember(ObjectHandler::GENERAL_ROLE_OBJECT_TYPE, $roleId, $assignmentInformation); } /** * Checks if the user is a group member. - * - * @param int $userId The user id. - * @param AssignmentInformation $assignmentInformation The assignment information. - * + * @param int $userId The user id. + * @param null $assignmentInformation The assignment information. * @return bool + * @throws Exception */ - public function isUserMember($userId, &$assignmentInformation = null) + public function isUserMember(int $userId, &$assignmentInformation = null): bool { return $this->isObjectMember(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $userId, $assignmentInformation); } /** * Checks if the term is a group member. - * - * @param int $termId - * @param AssignmentInformation $assignmentInformation - * + * @param int $termId + * @param null $assignmentInformation * @return bool + * @throws Exception */ - public function isTermMember($termId, &$assignmentInformation = null) + public function isTermMember(int $termId, &$assignmentInformation = null): bool { return $this->isObjectMember(ObjectHandler::GENERAL_TERM_OBJECT_TYPE, $termId, $assignmentInformation); } /** * Checks if the post is a group member - * - * @param int $postId - * @param AssignmentInformation $assignmentInformation - * + * @param int $postId + * @param null $assignmentInformation * @return bool + * @throws Exception */ - public function isPostMember($postId, &$assignmentInformation = null) + public function isPostMember(int $postId, &$assignmentInformation = null): bool { return $this->isObjectMember(ObjectHandler::GENERAL_POST_OBJECT_TYPE, $postId, $assignmentInformation); } /** * Returns the recursive membership. - * - * @param string $objectType The object type. - * @param string $objectId The object id. - * + * @param string $objectType The object type. + * @param int|string $objectId The object id. * @return array + * @throws Exception */ - public function getRecursiveMembershipForObject($objectType, $objectId) + public function getRecursiveMembershipForObject(string $objectType, $objectId): array { /** * @var AssignmentInformation $assignmentInformation @@ -682,13 +659,12 @@ public function getRecursiveMembershipForObject($objectType, $objectId) /** * Returns true if the requested object is locked recursive. - * * @param string $objectType The object type. - * @param string $objectId The object id. - * + * @param int|string $objectId The object id. * @return bool + * @throws Exception */ - public function isLockedRecursive($objectType, $objectId) + public function isLockedRecursive(string $objectType, $objectId): bool { /** * @var AssignmentInformation $assignmentInformation @@ -702,12 +678,11 @@ public function isLockedRecursive($objectType, $objectId) /** * Returns all objects of the given type. - * * @param string $objectType The object type. - * * @return array + * @throws Exception */ - public function getAssignedObjectsByType($objectType) + public function getAssignedObjectsByType(string $objectType): array { if (isset($this->fullObjectMembership[$objectType]) === false) { try { @@ -727,10 +702,10 @@ public function getAssignedObjectsByType($objectType) /** * Returns the roles assigned to the group. - * * @return array + * @throws Exception */ - public function getFullRoles() + public function getFullRoles(): array { return $this->getAssignedObjectsByType(ObjectHandler::GENERAL_ROLE_OBJECT_TYPE); } @@ -738,30 +713,30 @@ public function getFullRoles() /** * Returns the users assigned to the group. - * * @return array + * @throws Exception */ - public function getFullUsers() + public function getFullUsers(): array { return $this->getAssignedObjectsByType(ObjectHandler::GENERAL_USER_OBJECT_TYPE); } /** * Returns the terms assigned to the group. - * * @return array + * @throws Exception */ - public function getFullTerms() + public function getFullTerms(): array { return $this->getAssignedObjectsByType(ObjectHandler::GENERAL_TERM_OBJECT_TYPE); } /** * Returns the posts assigned to the group. - * * @return array + * @throws Exception */ - public function getFullPosts() + public function getFullPosts(): array { return $this->getAssignedObjectsByType(ObjectHandler::GENERAL_POST_OBJECT_TYPE); } diff --git a/src/UserGroup/AssignmentInformation.php b/src/UserGroup/AssignmentInformation.php index 6272e401..af637530 100644 --- a/src/UserGroup/AssignmentInformation.php +++ b/src/UserGroup/AssignmentInformation.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\UserGroup; /** @@ -43,11 +46,10 @@ class AssignmentInformation /** * AssignmentInformation constructor. - * * @param string $type * @param string $fromDate * @param string $toDate - * @param array $recursiveMembership + * @param array $recursiveMembership */ public function __construct($type = null, $fromDate = null, $toDate = null, array $recursiveMembership = []) { @@ -60,7 +62,7 @@ public function __construct($type = null, $fromDate = null, $toDate = null, arra /** * @return string */ - public function getType() + public function getType(): ?string { return $this->type; } @@ -68,7 +70,7 @@ public function getType() /** * @return null|string */ - public function getFromDate() + public function getFromDate(): ?string { return $this->fromDate; } @@ -76,27 +78,23 @@ public function getFromDate() /** * @return null|string */ - public function getToDate() + public function getToDate(): ?string { return $this->toDate; } /** * @param array $recursiveMembership - * - * @return $this */ public function setRecursiveMembership(array $recursiveMembership) { $this->recursiveMembership = $recursiveMembership; - - return $this; } /** * @return array */ - public function getRecursiveMembership() + public function getRecursiveMembership(): array { return $this->recursiveMembership; } diff --git a/src/UserGroup/AssignmentInformationFactory.php b/src/UserGroup/AssignmentInformationFactory.php index 0f510ce2..fc4fa3b4 100644 --- a/src/UserGroup/AssignmentInformationFactory.php +++ b/src/UserGroup/AssignmentInformationFactory.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\UserGroup; /** @@ -23,12 +26,10 @@ class AssignmentInformationFactory { /** * Creates an AssignmentInformation object. - * * @param null|string $type * @param null|string $fromDate * @param null|string $toDate - * @param array $recursiveMembership - * + * @param array $recursiveMembership * @return AssignmentInformation */ public function createAssignmentInformation( @@ -36,7 +37,7 @@ public function createAssignmentInformation( $fromDate = null, $toDate = null, array $recursiveMembership = [] - ) { + ): AssignmentInformation { return new AssignmentInformation($type, $fromDate, $toDate, $recursiveMembership); } } diff --git a/src/UserGroup/DynamicUserGroup.php b/src/UserGroup/DynamicUserGroup.php index 3e5d2016..3fb79b32 100644 --- a/src/UserGroup/DynamicUserGroup.php +++ b/src/UserGroup/DynamicUserGroup.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\UserGroup; +use Exception; use UserAccessManager\Config\MainConfig; use UserAccessManager\Database\Database; use UserAccessManager\Object\ObjectHandler; @@ -39,17 +43,15 @@ class DynamicUserGroup extends AbstractUserGroup /** * DynamicUserGroup constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param Database $database - * @param MainConfig $config - * @param Util $util - * @param ObjectHandler $objectHandler - * @param AssignmentInformationFactory $assignmentInformationFactory - * @param string $type - * @param string $id - * + * @param Php $php + * @param Wordpress $wordpress + * @param Database $database + * @param MainConfig $config + * @param Util $util + * @param ObjectHandler $objectHandler + * @param AssignmentInformationFactory $assignmentInformationFactory + * @param string $type + * @param int|string $id * @throws UserGroupTypeException */ public function __construct( @@ -60,7 +62,7 @@ public function __construct( Util $util, ObjectHandler $objectHandler, AssignmentInformationFactory $assignmentInformationFactory, - $type, + string $type, $id ) { $this->type = $type; @@ -83,32 +85,30 @@ public function __construct( /** * Returns the dynamic user group id. - * * @return string */ - public function getId() + public function getId(): string { - return $this->type.'|'.$this->id; + return $this->type . '|' . $this->id; } /** * Returns the dynamic group name. - * * @return string */ - public function getName() + public function getName(): string { if ($this->name === null) { $this->name = ''; - if ($this->type === self::USER_TYPE && (int)$this->id === self::NOT_LOGGED_IN_USER_ID) { + if ($this->type === self::USER_TYPE && (int) $this->id === self::NOT_LOGGED_IN_USER_ID) { $this->name = TXT_UAM_ADD_DYNAMIC_NOT_LOGGED_IN_USERS; } elseif ($this->type === self::USER_TYPE) { $userData = $this->wordpress->getUserData($this->id); - $this->name = TXT_UAM_USER.": {$userData->display_name} ($userData->user_login)"; + $this->name = TXT_UAM_USER . ": {$userData->display_name} ($userData->user_login)"; } elseif ($this->type === self::ROLE_TYPE) { $roles = $this->wordpress->getRoles()->roles; - $this->name = TXT_UAM_ROLE.': '; + $this->name = TXT_UAM_ROLE . ': '; $this->name .= (isset($roles[$this->id]['name']) === true) ? $roles[$this->id]['name'] : $this->id; } } @@ -118,17 +118,15 @@ public function getName() /** * Checks if the user group is assigned to a user. - * * @param string $objectType - * @param string $objectId - * @param string $fromDate - * @param string $toDate - * + * @param int|string $objectId + * @param null $fromDate + * @param null $toDate * @return bool - * * @throws UserGroupAssignmentException + * @throws Exception */ - public function addObject($objectType, $objectId, $fromDate = null, $toDate = null) + public function addObject(string $objectType, $objectId, $fromDate = null, $toDate = null): bool { if ($this->objectHandler->getGeneralObjectType($objectType) === ObjectHandler::GENERAL_USER_OBJECT_TYPE) { throw new UserGroupAssignmentException('Dynamic user groups can\'t be assigned to user.'); diff --git a/src/UserGroup/UserGroup.php b/src/UserGroup/UserGroup.php index 06a232b7..b2fc0f48 100644 --- a/src/UserGroup/UserGroup.php +++ b/src/UserGroup/UserGroup.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\UserGroup; +use Exception; use UserAccessManager\Config\MainConfig; use UserAccessManager\Database\Database; use UserAccessManager\Object\ObjectHandler; @@ -42,16 +46,14 @@ class UserGroup extends AbstractUserGroup /** * UserGroup constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param Database $database - * @param MainConfig $config - * @param Util $util - * @param ObjectHandler $objectHandler + * @param Php $php + * @param Wordpress $wordpress + * @param Database $database + * @param MainConfig $config + * @param Util $util + * @param ObjectHandler $objectHandler * @param AssignmentInformationFactory $assignmentInformationFactory - * @param null|string $id - * + * @param null|string $id * @throws UserGroupTypeException */ public function __construct( @@ -75,13 +77,12 @@ public function __construct( ); if ($id !== null) { - $this->load((int)$id); + $this->load($id); } } /** * Returns the ip range. - * * @return array|string */ public function getIpRange() @@ -91,17 +92,15 @@ public function getIpRange() /** * Returns the ip range as array - * * @return array */ - public function getIpRangeArray() + public function getIpRangeArray(): array { return explode(';', $this->ipRange); } /** * Sets the ip range. - * * @param string|array $ipRange The new ip range. */ public function setIpRange($ipRange) @@ -111,12 +110,10 @@ public function setIpRange($ipRange) /** * Loads the user group. - * - * @param string $id - * + * @param int|string $id * @return bool */ - public function load($id) + public function load($id): bool { $query = $this->database->prepare( "SELECT * @@ -144,10 +141,9 @@ public function load($id) /** * Saves the user group. - * * @return bool */ - public function save() + public function save(): bool { if ($this->id === null) { $return = $this->database->insert( @@ -162,7 +158,7 @@ public function save() ); if ($return !== false) { - $this->id = (string)$this->database->getLastInsertId(); + $this->id = (string) $this->database->getLastInsertId(); } } else { $return = $this->database->update( @@ -183,10 +179,10 @@ public function save() /** * Deletes the user group. - * * @return bool + * @throws Exception */ - public function delete() + public function delete(): bool { if ($this->id === null) { return false; diff --git a/src/UserGroup/UserGroupAssignmentException.php b/src/UserGroup/UserGroupAssignmentException.php index 0507d389..515fdb7d 100644 --- a/src/UserGroup/UserGroupAssignmentException.php +++ b/src/UserGroup/UserGroupAssignmentException.php @@ -12,14 +12,19 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\UserGroup; +use Exception; + /** * Class UserGroupAssignmentException * * @package UserAccessManager\UserGroup */ -class UserGroupAssignmentException extends \Exception +class UserGroupAssignmentException extends Exception { } diff --git a/src/UserGroup/UserGroupAssignmentHandler.php b/src/UserGroup/UserGroupAssignmentHandler.php index ab590b8e..89be4f7a 100644 --- a/src/UserGroup/UserGroupAssignmentHandler.php +++ b/src/UserGroup/UserGroupAssignmentHandler.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\UserGroup; +use Exception; use UserAccessManager\User\UserHandler; use UserAccessManager\Util\DateUtil; @@ -44,16 +48,10 @@ class UserGroupAssignmentHandler */ protected $userGroupFactory; - /** - * @var null|string - */ - protected $groupsFromName = null; - /** * UserGroupAssignmentHandler constructor. - * - * @param DateUtil $dateUtil - * @param UserHandler $userHandler + * @param DateUtil $dateUtil + * @param UserHandler $userHandler * @param UserGroupHandler $userGroupHandler * @param UserGroupFactory $userGroupFactory */ @@ -71,32 +69,30 @@ public function __construct( /** * Processes the date parameter. - * - * @param array $data + * @param array $data * @param string $name - * * @return null|string */ - private function getDateParameter(array $data, $name) + private function getDateParameter(array $data, string $name): ?string { $isValid = isset($data[$name]['date']) === true && isset($data[$name]['time']) === true - && (string)$data[$name]['date'] !== '' && (string)$data[$name]['time'] !== ''; + && (string) $data[$name]['date'] !== '' && (string) $data[$name]['time'] !== ''; - return ($isValid === true) ? (string)$data[$name]['date'].'T'.$data[$name]['time'] : null; + return ($isValid === true) ? (string) $data[$name]['date'] . 'T' . $data[$name]['time'] : null; } /** * Updates the user groups for the given object. - * * @param AbstractUserGroup[] $filteredUserGroups - * @param string $objectType - * @param string $objectId - * @param array $addUserGroups - * @param array $removeUserGroups + * @param string $objectType + * @param int|string $objectId + * @param array $addUserGroups + * @param array $removeUserGroups + * @throws Exception */ private function setUserGroups( array $filteredUserGroups, - $objectType, + string $objectType, $objectId, array $addUserGroups, array $removeUserGroups @@ -107,7 +103,7 @@ private function setUserGroups( } if (isset($addUserGroups[$groupId]['id']) === true - && (int)$addUserGroups[$groupId]['id'] === (int)$groupId + && (int) $addUserGroups[$groupId]['id'] === (int) $groupId ) { $userGroup->addObject( $objectType, @@ -121,14 +117,13 @@ private function setUserGroups( /** * Sets the dynamic user groups for the given object. - * * @param string $objectType - * @param string $objectId - * @param array $addDynamicUserGroups - * + * @param int|string $objectId + * @param array $addDynamicUserGroups * @throws UserGroupAssignmentException + * @throws UserGroupTypeException */ - private function setDynamicGroups($objectType, $objectId, array $addDynamicUserGroups) + private function setDynamicGroups(string $objectType, $objectId, array $addDynamicUserGroups) { foreach ($addDynamicUserGroups as $dynamicUserGroupKey => $addDynamicUserGroup) { $dynamicUserGroupData = explode('|', $dynamicUserGroupKey); @@ -153,12 +148,13 @@ private function setDynamicGroups($objectType, $objectId, array $addDynamicUserG /** * Sets the default user groups for the given object. - * - * @param AbstractUserGroup[] $filteredUserGroups - * @param string $objectType - * @param string $objectId + * @param AbstractUserGroup[] $filteredUserGroups + * @param string $objectType + * @param int|string $objectId + * @throws UserGroupTypeException + * @throws Exception */ - private function setDefaultGroups(array $filteredUserGroups, $objectType, $objectId) + private function setDefaultGroups(array $filteredUserGroups, string $objectType, $objectId) { /** * @var UserGroup[] $userGroupsToCheck @@ -179,17 +175,17 @@ private function setDefaultGroups(array $filteredUserGroups, $objectType, $objec /** * Saves the object data to the database. - * - * @param string $objectType + * @param string $objectType * @param int|string $objectId - * @param array $addUserGroups - * @param array $removeUserGroups - * @param array $addDynamicUserGroups - * + * @param array $addUserGroups + * @param array $removeUserGroups + * @param array $addDynamicUserGroups * @throws UserGroupAssignmentException + * @throws UserGroupTypeException + * @throws Exception */ public function assignObjectToUserGroups( - $objectType, + string $objectType, $objectId, array $addUserGroups, array $removeUserGroups, diff --git a/src/UserGroup/UserGroupFactory.php b/src/UserGroup/UserGroupFactory.php index 34e55fbe..8dffa801 100644 --- a/src/UserGroup/UserGroupFactory.php +++ b/src/UserGroup/UserGroupFactory.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\UserGroup; use UserAccessManager\Config\MainConfig; @@ -65,14 +68,13 @@ class UserGroupFactory /** * UserGroupFactory constructor. - * - * @param Php $php - * @param Wordpress $wordpress - * @param Database $database - * @param MainConfig $config - * @param Util $util - * @param ObjectHandler $objectHandler - * @param AssignmentInformationFactory $assignmentInformationFactory + * @param Php $php + * @param Wordpress $wordpress + * @param Database $database + * @param MainConfig $config + * @param Util $util + * @param ObjectHandler $objectHandler + * @param AssignmentInformationFactory $assignmentInformationFactory */ public function __construct( Php $php, @@ -94,12 +96,11 @@ public function __construct( /** * Creates a new user group object. - * * @param null|string $id - * * @return UserGroup + * @throws UserGroupTypeException */ - public function createUserGroup($id = null) + public function createUserGroup($id = null): UserGroup { return new UserGroup( $this->php, @@ -115,13 +116,12 @@ public function createUserGroup($id = null) /** * Creates a new dynamic user group object. - * * @param string $type - * @param string $id - * + * @param int|string $id * @return DynamicUserGroup + * @throws UserGroupTypeException */ - public function createDynamicUserGroup($type, $id) + public function createDynamicUserGroup(string $type, $id): DynamicUserGroup { return new DynamicUserGroup( $this->php, diff --git a/src/UserGroup/UserGroupHandler.php b/src/UserGroup/UserGroupHandler.php index 129e7fad..f41959a5 100644 --- a/src/UserGroup/UserGroupHandler.php +++ b/src/UserGroup/UserGroupHandler.php @@ -12,13 +12,18 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\UserGroup; +use Exception; use UserAccessManager\Config\WordpressConfig; use UserAccessManager\Database\Database; use UserAccessManager\Object\ObjectHandler; use UserAccessManager\User\UserHandler; use UserAccessManager\Wrapper\Wordpress; +use WP_User; /** * Class UserGroupHandler @@ -100,16 +105,16 @@ public function __construct( /** * Returns all user groups. - * * @return UserGroup[] + * @throws UserGroupTypeException */ - public function getUserGroups() + public function getUserGroups(): ?array { if ($this->userGroups === null) { $this->userGroups = []; $query = "SELECT ID FROM {$this->database->getUserGroupTable()}"; - $userGroups = (array)$this->database->getResults($query); + $userGroups = (array) $this->database->getResults($query); foreach ($userGroups as $userGroup) { $group = $this->userGroupFactory->createUserGroup($userGroup->ID); @@ -122,10 +127,10 @@ public function getUserGroups() /** * Returns all dynamic user groups. - * * @return null|DynamicUserGroup[] + * @throws UserGroupTypeException */ - public function getDynamicUserGroups() + public function getDynamicUserGroups(): ?array { if ($this->dynamicUserGroups === null) { $this->dynamicUserGroups = []; @@ -143,7 +148,7 @@ public function getDynamicUserGroups() WHERE group_type IN ('{$userGroupTypes}') GROUP BY group_type, group_id"; - $dynamicUserGroups = (array)$this->database->getResults($query); + $dynamicUserGroups = (array) $this->database->getResults($query); foreach ($dynamicUserGroups as $dynamicUserGroup) { $group = $this->userGroupFactory->createDynamicUserGroup( @@ -160,20 +165,20 @@ public function getDynamicUserGroups() /** * Returns the full user groups - * * @return AbstractUserGroup[] + * @throws UserGroupTypeException */ - public function getFullUserGroups() + public function getFullUserGroups(): ?array { return $this->getUserGroups() + $this->getDynamicUserGroups(); } /** * Returns the user groups filtered by the user user groups. - * * @return AbstractUserGroup[] + * @throws UserGroupTypeException */ - public function getFilteredUserGroups() + public function getFilteredUserGroups(): array { $userGroups = $this->getFullUserGroups(); $userUserGroups = $this->getUserGroupsForUser() + $this->getDynamicUserGroups(); @@ -182,24 +187,23 @@ public function getFilteredUserGroups() /** * Adds a user group. - * * @param UserGroup $userGroup + * @throws UserGroupTypeException */ public function addUserGroup(UserGroup $userGroup) { $this->getUserGroups(); $this->userGroups[$userGroup->getId()] = $userGroup; - $this->filteredUserGroups = null; } /** * Deletes a user group. - * * @param int $userGroupId - * * @return bool + * @throws UserGroupTypeException + * @throws Exception */ - public function deleteUserGroup($userGroupId) + public function deleteUserGroup(int $userGroupId): bool { $userGroups = $this->getUserGroups(); @@ -207,7 +211,6 @@ public function deleteUserGroup($userGroupId) && $userGroups[$userGroupId]->delete() === true ) { unset($this->userGroups[$userGroupId]); - $this->filteredUserGroups = null; return true; } @@ -217,20 +220,20 @@ public function deleteUserGroup($userGroupId) /** * Returns the user groups for the given object. - * - * @param string $objectType The object type. - * @param integer $objectId The id of the object. - * @param bool $ignoreDates If true we ignore the dates for the object assignment. - * + * @param string $objectType The object type. + * @param int|string $objectId The id of the object. + * @param bool $ignoreDates If true we ignore the dates for the object assignment. * @return AbstractUserGroup[] + * @throws UserGroupTypeException + * @throws Exception */ - public function getUserGroupsForObject($objectType, $objectId, $ignoreDates = false) + public function getUserGroupsForObject(string $objectType, $objectId, bool $ignoreDates = false): array { if ($this->objectHandler->isValidObjectType($objectType) === false) { return []; } - if (isset($this->objectUserGroups[(int)$ignoreDates][$objectType][$objectId]) === false) { + if (isset($this->objectUserGroups[$ignoreDates][$objectType][$objectId]) === false) { $objectUserGroups = []; $userGroups = $this->getFullUserGroups(); @@ -242,10 +245,10 @@ public function getUserGroupsForObject($objectType, $objectId, $ignoreDates = fa } } - $this->objectUserGroups[(int)$ignoreDates][$objectType][$objectId] = $objectUserGroups; + $this->objectUserGroups[$ignoreDates][$objectType][$objectId] = $objectUserGroups; } - return $this->objectUserGroups[(int)$ignoreDates][$objectType][$objectId]; + return $this->objectUserGroups[$ignoreDates][$objectType][$objectId]; } /** @@ -258,12 +261,10 @@ public function unsetUserGroupsForObject() /** * Checks if the current user is in the ip range or if the user group is public. - * * @param UserGroup $userGroup - * * @return bool */ - private function checkUserGroupAccess(UserGroup $userGroup) + private function checkUserGroupAccess(UserGroup $userGroup): bool { $userIp = isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR']; @@ -274,11 +275,11 @@ private function checkUserGroupAccess(UserGroup $userGroup) /** * Assigns the dynamic user groups to the user user groups. - * - * @param \WP_User $currentUser - * @param array $userGroupsForUser + * @param WP_User $currentUser + * @param array $userGroupsForUser + * @throws UserGroupTypeException */ - private function assignDynamicUserGroupsForUser(\WP_User $currentUser, array &$userGroupsForUser) + private function assignDynamicUserGroupsForUser(WP_User $currentUser, array &$userGroupsForUser) { $userUserGroup = $this->userGroupFactory->createDynamicUserGroup( DynamicUserGroup::USER_TYPE, @@ -299,10 +300,10 @@ private function assignDynamicUserGroupsForUser(\WP_User $currentUser, array &$u /** * Returns the user groups for the user. - * * @return AbstractUserGroup[] + * @throws UserGroupTypeException */ - public function getUserGroupsForUser() + public function getUserGroupsForUser(): ?array { if ($this->userHandler->checkUserAccess(UserHandler::MANAGE_USER_GROUPS_CAPABILITY) === true) { return $this->getUserGroups(); @@ -334,14 +335,13 @@ public function getUserGroupsForUser() /** * Returns the user groups for the object filtered by the user user groups. - * * @param string $objectType - * @param int $objectId - * @param bool $ignoreDates - * + * @param string|int $objectId + * @param bool $ignoreDates * @return AbstractUserGroup[] + * @throws UserGroupTypeException */ - public function getFilteredUserGroupsForObject($objectType, $objectId, $ignoreDates = false) + public function getFilteredUserGroupsForObject(string $objectType, $objectId, bool $ignoreDates = false): array { $userGroups = $this->getUserGroupsForObject($objectType, $objectId, $ignoreDates); $userUserGroups = $this->getUserGroupsForUser() + $this->getDynamicUserGroups(); diff --git a/src/UserGroup/UserGroupTypeException.php b/src/UserGroup/UserGroupTypeException.php index d8a06a72..f8b66dd8 100644 --- a/src/UserGroup/UserGroupTypeException.php +++ b/src/UserGroup/UserGroupTypeException.php @@ -12,14 +12,19 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\UserGroup; +use Exception; + /** * Class UserGroupTypeException * * @package UserAccessManager\UserGroup */ -class UserGroupTypeException extends \Exception +class UserGroupTypeException extends Exception { } diff --git a/src/Util/DateUtil.php b/src/Util/DateUtil.php index 7172e106..a4831a85 100644 --- a/src/Util/DateUtil.php +++ b/src/Util/DateUtil.php @@ -12,6 +12,9 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Util; use UserAccessManager\Wrapper\Wordpress; @@ -30,7 +33,6 @@ class DateUtil /** * DateUtil constructor. - * * @param Wordpress $wordpress */ public function __construct(Wordpress $wordpress) @@ -40,60 +42,51 @@ public function __construct(Wordpress $wordpress) /** * Formats the date to the wordpress default format. - * * @param string $date - * * @return string */ - public function formatDate($date) + public function formatDate(string $date): string { return $this->wordpress->formatDate($date); } /** * Formats the date for the datetime input field. - * - * @param string $date - * + * @param string|null $date * @return string */ - public function formatDateForDatetimeInput($date) + public function formatDateForDatetimeInput(?string $date): ?string { - return ($date !== null) ? strftime('%Y-%m-%dT%H:%M:%S', strtotime($date)) : $date; + return ($date !== null) ? strftime('%Y-%m-%dT%H:%M:%S', (int) strtotime($date)) : $date; } /** * Formats the date for the datetime input field. - * - * @param string $date - * + * @param null|string $date * @return string */ - public function formatDateForDateInput($date) + public function formatDateForDateInput(?string $date): ?string { - return ($date !== null) ? strftime('%Y-%m-%d', strtotime($date)) : $date; + return ($date !== null) ? strftime('%Y-%m-%d', (int) strtotime($date)) : $date; } /** * Formats the date for the datetime input field. - * - * @param string $date - * + * @param null|string $date * @return string */ - public function formatDateForTimeInput($date) + public function formatDateForTimeInput(?string $date): ?string { - return ($date !== null) ? strftime('%H:%M:%S', strtotime($date)) : $date; + return ($date !== null) ? strftime('%H:%M:%S', (int) strtotime($date)) : $date; } /** - * @param int $time - * + * @param int|null $time * @return null|string */ - public function getDateFromTime($time) + public function getDateFromTime(?int $time): ?string { - if ($time !== null && (int)$time !== 0) { + if ($time !== null && $time !== 0) { $currentTime = $this->wordpress->currentTime('timestamp'); return gmdate('Y-m-d H:i:s', $time + $currentTime); } diff --git a/src/Util/Util.php b/src/Util/Util.php index 9eaf6231..e14c3dbb 100644 --- a/src/Util/Util.php +++ b/src/Util/Util.php @@ -12,8 +12,12 @@ * @version SVN: $id$ * @link http://wordpress.org/extend/plugins/user-access-manager/ */ + +declare(strict_types=1); + namespace UserAccessManager\Util; +use Exception; use UserAccessManager\Wrapper\Php; /** @@ -30,7 +34,6 @@ class Util /** * Util constructor. - * * @param Php $php */ public function __construct(Php $php) @@ -40,56 +43,48 @@ public function __construct(Php $php) /** * Checks if a string starts with the given needle. - * * @param string $haystack The haystack. - * @param string $needle The needle. - * + * @param string $needle The needle. * @return bool */ - public function startsWith($haystack, $needle) + public function startsWith(string $haystack, string $needle): bool { return $needle === '' || strpos($haystack, $needle) === 0; } /** * Checks if a string ends with the given needle. - * * @param string $haystack * @param string $needle - * * @return bool */ - public function endsWith($haystack, $needle) + public function endsWith(string $haystack, string $needle): bool { return $needle === '' || substr($haystack, -strlen($needle)) === $needle; } /** * Generates and returns a random password. - * * @param int $length - * * @return string - * - * @throws \Exception + * @throws Exception */ - public function getRandomPassword($length = 32) + public function getRandomPassword($length = 32): string { $bytes = $this->php->opensslRandomPseudoBytes($length + 1, $strong); if ($bytes !== false && $strong === true) { return substr(preg_replace('/[^a-zA-Z0-9]/', '', base64_encode($bytes)), 0, $length); } else { - throw new \Exception('Unable to generate secure token from OpenSSL.'); + throw new Exception('Unable to generate secure token from OpenSSL.'); } } /** * Returns the current url. - * * @return string */ - public function getCurrentUrl() + public function getCurrentUrl(): string { if (isset($_SERVER['REQUEST_URI']) === false) { $serverRequestUri = $_SERVER['PHP_SELF']; @@ -100,9 +95,9 @@ public function getCurrentUrl() $https = $_SERVER['HTTPS'] ?? ''; $secure = $https === 'on' ? 's' : ''; $protocols = explode('/', strtolower($_SERVER['SERVER_PROTOCOL'])); - $protocol = $protocols[0].$secure; - $port = ((int)$_SERVER['SERVER_PORT'] === 80) ? '' : (':'.$_SERVER['SERVER_PORT']); + $protocol = $protocols[0] . $secure; + $port = ((int) $_SERVER['SERVER_PORT'] === 80) ? '' : (':' . $_SERVER['SERVER_PORT']); - return $protocol.'://'.$_SERVER['SERVER_NAME'].$port.$serverRequestUri; + return $protocol . '://' . $_SERVER['SERVER_NAME'] . $port . $serverRequestUri; } } diff --git a/src/View/AdminAbout.php b/src/View/AdminAbout.php index f1e84b3c..6f2f9a88 100644 --- a/src/View/AdminAbout.php +++ b/src/View/AdminAbout.php @@ -14,8 +14,11 @@ */ /** - * @var \UserAccessManager\Controller\Backend\AboutController $controller + * @var AboutController $controller */ + +use UserAccessManager\Controller\Backend\AboutController; + ?>

diff --git a/src/View/AdminForm/Input.php b/src/View/AdminForm/Input.php index 2b317236..73dafad8 100644 --- a/src/View/AdminForm/Input.php +++ b/src/View/AdminForm/Input.php @@ -14,8 +14,11 @@ */ /** - * @var \UserAccessManager\Form\Input $input + * @var Input $input */ + +use UserAccessManager\Form\Input; + ?>