diff --git a/.laminas-ci.json b/.laminas-ci.json index 7c4c9b8..cc08634 100644 --- a/.laminas-ci.json +++ b/.laminas-ci.json @@ -5,6 +5,6 @@ {"name": "PHPUnit on PHP 7.1 with locked dependencies"} ], "ignore_php_platform_requirements": { - "8.2": true + "8.4": true } } diff --git a/README.md b/README.md index 9ce6133..eb46c9f 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,21 @@ # laminas-oauth > ## πŸ‡·πŸ‡Ί Русским Π³Ρ€Π°ΠΆΠ΄Π°Π½Π°ΠΌ -> +> > ΠœΡ‹, участники Laminas, Ρ€ΠΎΠ΄ΠΈΠ»ΠΈΡΡŒ ΠΈ ΠΆΠΈΠ²Π΅ΠΌ Π² Ρ€Π°Π·Π½Ρ‹Ρ… странах. Π£ ΠΌΠ½ΠΎΠ³ΠΈΡ… ΠΈΠ· нас Π΅ΡΡ‚ΡŒ Π΄Ρ€ΡƒΠ·ΡŒΡ, родствСнники ΠΈ ΠΊΠΎΠ»Π»Π΅Π³ΠΈ ΠΊΠ°ΠΊ Π² России, Ρ‚Π°ΠΊ ΠΈ Π² Π£ΠΊΡ€Π°ΠΈΠ½Π΅. НСкоторыС ΠΈΠ· нас Ρ€ΠΎΠ΄ΠΈΠ»ΠΈΡΡŒ Π² России. НСкоторыС ΠΈΠ· нас ΠΆΠΈΠ²ΡƒΡ‚ Π² России. Π£ Π½Π΅ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Ρ… Π±Π°Π±ΡƒΡˆΠΊΠΈ ΠΈ Π΄Π΅Π΄ΡƒΡˆΠΊΠΈ ΡΡ€Π°ΠΆΠ°Π»ΠΈΡΡŒ с Ρ„Π°ΡˆΠΈΡΡ‚Π°ΠΌΠΈ Π²ΠΎ Π’Ρ‚ΠΎΡ€ΠΎΠΉ ΠΌΠΈΡ€ΠΎΠ²ΠΎΠΉ Π²ΠΎΠΉΠ½Π΅. Π—Π΄Π΅ΡΡŒ Π½ΠΈΠΊΡ‚ΠΎ Π½Π΅ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΈΠ²Π°Π΅Ρ‚ Ρ„Π°ΡˆΠΈΠ·ΠΌ. -> +> > Π£ ΠΎΠ΄Π½ΠΎΠ³ΠΎ ΠΈΠ· нас Π΅ΡΡ‚ΡŒ украинская родствСнница, которая спаслась ΠΈΠ· Π΄ΠΎΠΌΠ° вмСстС с сыном. ПоСзд задСрТался ΠΈΠ·-Π·Π° Π±ΠΎΠΌΠ±Π΅ΠΆΠΊΠΈ Π½Π° Π΄ΠΎΡ€ΠΎΠ³Π΅ Π²ΠΏΠ΅Ρ€Π΅Π΄ΠΈ. Π£ нас Π΅ΡΡ‚ΡŒ Π΄Ρ€ΡƒΠ·ΡŒΡ, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ прячутся Π² Π±ΠΎΠΌΠ±ΠΎΡƒΠ±Π΅ΠΆΠΈΡ‰Π°Ρ…. ΠœΡ‹ с Ρ‚Ρ€Π΅Π²ΠΎΠ³ΠΎΠΉ ΠΆΠ΄Π΅ΠΌ вСсточки ΠΎΡ‚ Π½ΠΈΡ… послС Π²ΠΎΠ·Π΄ΡƒΡˆΠ½Ρ‹Ρ… Π½Π°Π»Π΅Ρ‚ΠΎΠ², ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ бСспорядочно наносят ΡƒΠ΄Π°Ρ€Ρ‹ ΠΈ ΠΏΠΎΠΏΠ°Π΄Π°ΡŽΡ‚ ΠΏΠΎ Π±ΠΎΠ»ΡŒΠ½ΠΈΡ†Π°ΠΌ, школам, дСтским садам ΠΈ Π΄ΠΎΠΌΠ°ΠΌ. ΠœΡ‹ Π½Π΅ Π±Π΅Ρ€Π΅ΠΌ это ΠΈΠ· ΠΊΠ°ΠΊΠΈΡ…-Π»ΠΈΠ±ΠΎ БМИ. ΠœΡ‹ наблюдаСм это Π½Π°ΠΏΡ€ΡΠΌΡƒΡŽ. -> +> > Π’Ρ‹ довСряСтС Π½Π°ΠΌ достаточно, Ρ‡Ρ‚ΠΎΠ± ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ наши ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹, ΠΈ ΠΌΡ‹ просим вас Π΄ΠΎΠ²Π΅Ρ€ΠΈΡ‚ΡŒΡΡ Π½Π°ΠΌ вновь. ΠœΡ‹ нуТдаСмся Π² ΠΏΠΎΠΌΠΎΡ‰ΠΈ. Π’Ρ‹Ρ…ΠΎΠ΄ΠΈΡ‚Π΅ ΠΈ протСстуйтС ΠΏΡ€ΠΎΡ‚ΠΈΠ² этой бСсполСзной Π²ΠΎΠΉΠ½Ρ‹. ΠžΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚Π΅ ΠΊΡ€ΠΎΠ²ΠΎΠΏΡ€ΠΎΠ»ΠΈΡ‚ΠΈΠ΅. Π‘ΠΊΠ°ΠΆΠΈΡ‚Π΅ "НСт Π²ΠΎΠΉΠ½Π΅!" -> +> > ## πŸ‡ΊπŸ‡Έ To Citizens of Russia -> +> > We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism. -> +> > One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences. -> +> > You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!" - > This package is considered feature-complete, and is now in **security-only** maintenance mode, following a [decision by the Technical Steering Committee](https://github.com/laminas/technical-steering-committee/blob/2b55453e172a1b8c9c4c212be7cf7e7a58b9352c/meetings/minutes/2020-08-03-TSC-Minutes.md#vote-on-components-to-mark-as-security-only). > If you have a security issue, please [follow our security reporting guidelines](https://getlaminas.org/security/). > If you wish to take on the role of maintainer, please [nominate yourself](https://github.com/laminas/technical-steering-committee/issues/new?assignees=&labels=Nomination&template=Maintainer_Nomination.md&title=%5BNOMINATION%5D%5BMAINTAINER%5D%3A+%7Bname+of+person+being+nominated%7D) diff --git a/composer.json b/composer.json index 6f0dcd5..46286ba 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ } }, "require": { - "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", "laminas/laminas-config": "^3.7", "laminas/laminas-crypt": "^3.6.0", "laminas/laminas-http": "^2.15", @@ -35,8 +35,8 @@ "laminas/laminas-uri": "^2.9" }, "require-dev": { - "laminas/laminas-coding-standard": "~1.0.0", - "phpunit/phpunit": "^9.5.5" + "laminas/laminas-coding-standard": "~2.5.0", + "phpunit/phpunit": "^9.6.20" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 9b4e08d..cd0b854 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": "a9f93855548b096a915df8efc4ff2c2b", + "content-hash": "fbd13fd7ec34e3700b8f316897cd86df", "packages": [ { "name": "laminas/laminas-config", @@ -867,6 +867,81 @@ } ], "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.7.2", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", + "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + }, + "time": "2022-02-04T12:51:07+00:00" + }, { "name": "doctrine/instantiator", "version": "2.0.0", @@ -939,31 +1014,39 @@ }, { "name": "laminas/laminas-coding-standard", - "version": "1.0.0", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-coding-standard.git", - "reference": "08880ce2fbfe62d471cd3cb766a91da630b32539" + "reference": "c1aaa18a7c860c6932677a3e4ec13161f9fc7d61" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-coding-standard/zipball/08880ce2fbfe62d471cd3cb766a91da630b32539", - "reference": "08880ce2fbfe62d471cd3cb766a91da630b32539", + "url": "https://api.github.com/repos/laminas/laminas-coding-standard/zipball/c1aaa18a7c860c6932677a3e4ec13161f9fc7d61", + "reference": "c1aaa18a7c860c6932677a3e4ec13161f9fc7d61", "shasum": "" }, "require": { - "laminas/laminas-zendframework-bridge": "^1.0", - "squizlabs/php_codesniffer": "^2.7" + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || ^1.0", + "php": "^7.4 || ^8.0", + "slevomat/coding-standard": "^7.0", + "squizlabs/php_codesniffer": "^3.6", + "webimpress/coding-standard": "^1.2" }, - "replace": { - "zendframework/zend-coding-standard": "self.version" + "conflict": { + "phpstan/phpdoc-parser": ">=1.6.0" + }, + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "LaminasCodingStandard\\": "src/LaminasCodingStandard/" + } }, - "type": "library", "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], - "description": "Laminas coding standard", + "description": "Laminas Coding Standard", "homepage": "https://laminas.dev", "keywords": [ "Coding Standard", @@ -977,82 +1060,26 @@ "rss": "https://github.com/laminas/laminas-coding-standard/releases.atom", "source": "https://github.com/laminas/laminas-coding-standard" }, - "time": "2019-12-31T16:28:26+00:00" - }, - { - "name": "laminas/laminas-zendframework-bridge", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-zendframework-bridge.git", - "reference": "5ef52e26392777a26dbb8f20fe24f91b406459f6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/5ef52e26392777a26dbb8f20fe24f91b406459f6", - "reference": "5ef52e26392777a26dbb8f20fe24f91b406459f6", - "shasum": "" - }, - "require": { - "php": "~8.0.0 || ~8.1.0 || ~8.2.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.0", - "squizlabs/php_codesniffer": "^3.7.1", - "vimeo/psalm": "^4.29.0" - }, - "type": "library", - "extra": { - "laminas": { - "module": "Laminas\\ZendFrameworkBridge" - } - }, - "autoload": { - "files": [ - "src/autoload.php" - ], - "psr-4": { - "Laminas\\ZendFrameworkBridge\\": "src//" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Alias legacy ZF class names to Laminas Project equivalents.", - "keywords": [ - "ZendFramework", - "autoloading", - "laminas", - "zf" - ], - "support": { - "forum": "https://discourse.laminas.dev/", - "issues": "https://github.com/laminas/laminas-zendframework-bridge/issues", - "rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom", - "source": "https://github.com/laminas/laminas-zendframework-bridge" - }, "funding": [ { "url": "https://funding.communitybridge.org/projects/laminas-project", "type": "community_bridge" } ], - "time": "2022-12-12T11:44:10+00:00" + "time": "2023-01-05T15:53:40+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -1060,11 +1087,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -1090,7 +1118,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -1098,29 +1126,31 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "nikic/php-parser", - "version": "v4.17.1", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -1128,7 +1158,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1152,26 +1182,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2024-10-08T18:51:32+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -1212,9 +1243,15 @@ "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/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -1267,37 +1304,81 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "981cc368a216c988e862a75e526b6076987d1b50" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/981cc368a216c988e862a75e526b6076987d1b50", + "reference": "981cc368a216c988e862a75e526b6076987d1b50", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.5.1" + }, + "time": "2022-05-05T11:32:40+00:00" + }, { "name": "phpunit/php-code-coverage", - "version": "9.2.29", + "version": "9.2.32", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "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" + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -1306,7 +1387,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "9.2.x-dev" } }, "autoload": { @@ -1335,7 +1416,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" }, "funding": [ { @@ -1343,7 +1424,7 @@ "type": "github" } ], - "time": "2023-09-19T04:57:46+00:00" + "time": "2024-08-22T04:23:01+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1588,45 +1669,45 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.13", + "version": "9.6.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" + "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", + "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", + "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-code-coverage": "^9.2.32", + "phpunit/php-file-iterator": "^3.0.6", "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", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", "sebastian/version": "^3.0.2" }, "suggest": { @@ -1671,7 +1752,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21" }, "funding": [ { @@ -1687,20 +1768,20 @@ "type": "tidelift" } ], - "time": "2023-09-19T05:39:22+00:00" + "time": "2024-09-19T10:50:18+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -1735,7 +1816,7 @@ "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" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -1743,7 +1824,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -1932,20 +2013,20 @@ }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -1977,7 +2058,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" }, "funding": [ { @@ -1985,20 +2066,20 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -2043,7 +2124,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -2051,7 +2132,7 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -2118,16 +2199,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -2183,7 +2264,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -2191,20 +2272,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -2247,7 +2328,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -2255,24 +2336,24 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -2304,7 +2385,7 @@ "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" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" }, "funding": [ { @@ -2312,7 +2393,7 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", @@ -2491,16 +2572,16 @@ }, { "name": "sebastian/resource-operations", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", "shasum": "" }, "require": { @@ -2512,7 +2593,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2533,8 +2614,7 @@ "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" }, "funding": [ { @@ -2542,7 +2622,7 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2024-03-14T16:00:52+00:00" }, { "name": "sebastian/type", @@ -2653,66 +2733,100 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "slevomat/coding-standard", + "version": "7.2.1", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/aff06ae7a84e4534bf6f821dc982a93a5d477c90", + "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", + "php": "^7.2 || ^8.0", + "phpstan/phpdoc-parser": "^1.5.1", + "squizlabs/php_codesniffer": "^3.6.2" + }, + "require-dev": { + "phing/phing": "2.17.3", + "php-parallel-lint/php-parallel-lint": "1.3.2", + "phpstan/phpstan": "1.4.10|1.7.1", + "phpstan/phpstan-deprecation-rules": "1.0.0", + "phpstan/phpstan-phpunit": "1.0.0|1.1.1", + "phpstan/phpstan-strict-rules": "1.2.3", + "phpunit/phpunit": "7.5.20|8.5.21|9.5.20" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/7.2.1" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2022-05-25T10:58:12+00:00" + }, { "name": "squizlabs/php_codesniffer", - "version": "2.9.2", + "version": "3.10.3", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745", - "reference": "2acf168de78487db620ab4bc524135a13cfe6745", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.1.2" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "scripts/phpcs", - "scripts/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "3.x-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/" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -2720,34 +2834,58 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2018-11-07T22:31:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-09-18T10:38:58+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -2776,7 +2914,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.2" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -2784,7 +2922,62 @@ "type": "github" } ], - "time": "2023-11-20T00:12:19+00:00" + "time": "2024-03-03T12:36:25+00:00" + }, + { + "name": "webimpress/coding-standard", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/webimpress/coding-standard.git", + "reference": "6f6a1a90bd9e18fc8bee0660dd1d1ce68cf9fc53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webimpress/coding-standard/zipball/6f6a1a90bd9e18fc8bee0660dd1d1ce68cf9fc53", + "reference": "6f6a1a90bd9e18fc8bee0660dd1d1ce68cf9fc53", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "squizlabs/php_codesniffer": "^3.10.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.6.15" + }, + "type": "phpcodesniffer-standard", + "extra": { + "dev-master": "1.2.x-dev", + "dev-develop": "1.3.x-dev" + }, + "autoload": { + "psr-4": { + "WebimpressCodingStandard\\": "src/WebimpressCodingStandard/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "description": "Webimpress Coding Standard", + "keywords": [ + "Coding Standard", + "PSR-2", + "phpcs", + "psr-12", + "webimpress" + ], + "support": { + "issues": "https://github.com/webimpress/coding-standard/issues", + "source": "https://github.com/webimpress/coding-standard/tree/1.4.0" + }, + "funding": [ + { + "url": "https://github.com/michalbundyra", + "type": "github" + } + ], + "time": "2024-10-16T06:55:17+00:00" } ], "aliases": [], @@ -2793,7 +2986,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0" }, "platform-dev": [], "platform-overrides": { diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 1a80a86..ea5802d 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,8 +1,24 @@ - - + + + + + + + + + + src test + + + + + src/ + test/ + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index dd69f42..c519bfd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,15 +1,14 @@ - + ./src - ./test diff --git a/src/Client.php b/src/Client.php index 9541bad..d8cd230 100644 --- a/src/Client.php +++ b/src/Client.php @@ -3,20 +3,23 @@ namespace Laminas\OAuth; use Laminas\Http\Client as HttpClient; +use Laminas\Http\Client\Exception\RuntimeException; use Laminas\Http\Request as HttpRequest; use Laminas\Http\Response as HttpResponse; use Laminas\Stdlib\ArrayUtils; use Traversable; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function array_merge; +use function call_user_func_array; +use function method_exists; + class Client extends HttpClient { /** * Flag to indicate that the client has detected the server as supporting * OAuth 1.0a + * + * @var bool */ public static $supportsRevisionA = false; @@ -28,7 +31,7 @@ class Client extends HttpClient * * @var Config\StandardConfig */ - protected $oauthConfig = null; + protected $oauthConfig; /** * True if this request is being made with data supplied by @@ -36,7 +39,7 @@ class Client extends HttpClient * * @var bool */ - protected $streamingRequest = null; + protected $streamingRequest; /** * Constructor; creates a new HTTP Client instance which itself is @@ -46,7 +49,7 @@ class Client extends HttpClient * * @param array|Traversable $oauthOptions * @param string $uri - * @param array|Traversable $options + * @param array|Traversable $config */ public function __construct($oauthOptions, $uri = null, $config = null) { @@ -89,21 +92,24 @@ public function getStreamingRequest() * Prepare the request body (for POST and PUT requests) * * @return string - * @throws \Laminas\Http\Client\Exception\RuntimeException + * @throws RuntimeException */ protected function prepareBody() { if ($this->streamingRequest) { - $this->setHeaders(['Content-Length' => - $this->raw_post_data->getTotalSize()]); + $this->setHeaders([ + 'Content-Length' + => $this->raw_post_data->getTotalSize(), + ]); return $this->raw_post_data; } return parent::prepareBody(); } /** - * Clear all custom parameters we set. + * Clear all custom parameters we set * + * @param bool $clearAll * @return HttpClient */ public function resetParameters($clearAll = false) @@ -140,15 +146,15 @@ public function setRawDataStream($data, $enctype = null) */ public function setMethod($method = HttpRequest::METHOD_GET) { - if ($method == HttpRequest::METHOD_GET) { + if ($method === HttpRequest::METHOD_GET) { $this->setRequestMethod(HttpRequest::METHOD_GET); - } elseif ($method == HttpRequest::METHOD_POST) { + } elseif ($method === HttpRequest::METHOD_POST) { $this->setRequestMethod(HttpRequest::METHOD_POST); - } elseif ($method == HttpRequest::METHOD_PUT) { + } elseif ($method === HttpRequest::METHOD_PUT) { $this->setRequestMethod(HttpRequest::METHOD_PUT); - } elseif ($method == HttpRequest::METHOD_DELETE) { + } elseif ($method === HttpRequest::METHOD_DELETE) { $this->setRequestMethod(HttpRequest::METHOD_DELETE); - } elseif ($method == HttpRequest::METHOD_HEAD) { + } elseif ($method === HttpRequest::METHOD_HEAD) { $this->setRequestMethod(HttpRequest::METHOD_HEAD); } return parent::setMethod($method); @@ -162,7 +168,7 @@ public function setMethod($method = HttpRequest::METHOD_GET) * @param null|Laminas\Http\Request $method * @return HttpResponse */ - public function send(HttpRequest $request = null) + public function send(?HttpRequest $request = null) { $this->prepareOAuth(); return parent::send($request); @@ -178,7 +184,7 @@ public function send(HttpRequest $request = null) * @return void * @throws \Laminas\OAuth\Exception\RuntimeException If POSTBODY scheme * requested, but GET request method used; or if invalid request scheme - * provided + * provided. */ public function prepareOAuth() { @@ -190,18 +196,18 @@ public function prepareOAuth() $this->oauthConfig, $this->getSignableParameters() ); - $requestHeaders = $this->getRequest()->getHeaders(); + $requestHeaders = $this->getRequest()->getHeaders(); $requestHeaders->addHeaders(['Authorization' => $oauthHeaderValue]); break; case OAuth::REQUEST_SCHEME_POSTBODY: - if ($this->getRequestMethod() == HttpRequest::METHOD_GET) { + if ($this->oauthConfig->getRequestMethod() === HttpRequest::METHOD_GET) { throw new Exception\RuntimeException( 'The client is configured to' . ' pass OAuth parameters through a POST body but request method' . ' is set to GET' ); } - $query = $this->getToken()->toQueryString( + $query = $this->getToken()->toQueryString( $this->getRequest()->getUriString(), $this->oauthConfig, $this->getSignableParameters() @@ -210,7 +216,7 @@ public function prepareOAuth() $this->setRawBody($query); break; case OAuth::REQUEST_SCHEME_QUERYSTRING: - $query = $this->getToken()->toQueryString( + $query = $this->getToken()->toQueryString( $this->getRequest()->getUriString(), $this->oauthConfig, $this->getSignableParameters() @@ -251,7 +257,7 @@ protected function getSignableParameters() * @param string $method * @param array $args * @return mixed - * @throws Exception\BadMethodCallException if method does not exist in config object + * @throws Exception\BadMethodCallException If method does not exist in config object. */ public function __call($method, array $args) { diff --git a/src/Config/ConfigInterface.php b/src/Config/ConfigInterface.php index 92c565d..ed0f9f3 100644 --- a/src/Config/ConfigInterface.php +++ b/src/Config/ConfigInterface.php @@ -4,50 +4,76 @@ use Laminas\OAuth\Token\TokenInterface; -/** - * @category Laminas - * @package Laminas_OAuth - */ interface ConfigInterface { public function setOptions(array $options); + /** + * @param string $key + */ public function setConsumerKey($key); public function getConsumerKey(); + /** + * @param string $secret + */ public function setConsumerSecret($secret); public function getConsumerSecret(); + /** + * @param string $method + */ public function setSignatureMethod($method); public function getSignatureMethod(); + /** + * @param string $scheme + */ public function setRequestScheme($scheme); public function getRequestScheme(); + /** + * @param string $version + */ public function setVersion($version); public function getVersion(); + /** + * @param string $url + */ public function setCallbackUrl($url); public function getCallbackUrl(); + /** + * @param string $url + */ public function setRequestTokenUrl($url); public function getRequestTokenUrl(); + /** + * @param string $method + */ public function setRequestMethod($method); public function getRequestMethod(); + /** + * @param string $url + */ public function setAccessTokenUrl($url); public function getAccessTokenUrl(); + /** + * @param string $url + */ public function setUserAuthorizationUrl($url); public function getUserAuthorizationUrl(); diff --git a/src/Config/StandardConfig.php b/src/Config/StandardConfig.php index 2acb99c..6dae9b4 100644 --- a/src/Config/StandardConfig.php +++ b/src/Config/StandardConfig.php @@ -2,6 +2,8 @@ namespace Laminas\OAuth\Config; +use Laminas\Crypt\PublicKey\Rsa\PrivateKey; +use Laminas\Crypt\PublicKey\Rsa\PublicKey; use Laminas\OAuth\Exception; use Laminas\OAuth\OAuth; use Laminas\OAuth\Token\TokenInterface; @@ -9,10 +11,13 @@ use Laminas\Uri; use Traversable; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function in_array; +use function is_array; +use function rtrim; +use function sprintf; +use function strtolower; +use function strtoupper; + class StandardConfig implements ConfigInterface { /** @@ -55,14 +60,14 @@ class StandardConfig implements ConfigInterface * * @var string */ - protected $callbackUrl = null; + protected $callbackUrl; /** * The URL root to append default OAuth endpoint paths. * * @var string */ - protected $siteUrl = null; + protected $siteUrl; /** * The URL to which requests for a Request Token should be directed. @@ -70,7 +75,7 @@ class StandardConfig implements ConfigInterface * * @var string */ - protected $requestTokenUrl = null; + protected $requestTokenUrl; /** * The URL to which requests for an Access Token should be directed. @@ -78,7 +83,7 @@ class StandardConfig implements ConfigInterface * * @var string */ - protected $accessTokenUrl = null; + protected $accessTokenUrl; /** * The URL to which users should be redirected to authorize a Request Token. @@ -86,45 +91,45 @@ class StandardConfig implements ConfigInterface * * @var string */ - protected $authorizeUrl = null; + protected $authorizeUrl; /** * An OAuth application's Consumer Key. * * @var string */ - protected $consumerKey = null; + protected $consumerKey; /** * Every Consumer Key has a Consumer Secret unless you're in RSA-land. * * @var string */ - protected $consumerSecret = null; + protected $consumerSecret; /** * If relevant, a PEM encoded RSA private key encapsulated as a * Laminas_Crypt_Rsa Key * - * @var \Laminas\Crypt\PublicKey\Rsa\PrivateKey + * @var PrivateKey */ - protected $rsaPrivateKey = null; + protected $rsaPrivateKey; /** * If relevant, a PEM encoded RSA public key encapsulated as a * Laminas_Crypt_Rsa Key * - * @var \Laminas\Crypt\PublicKey\Rsa\PublicKey + * @var PublicKey */ - protected $rsaPublicKey = null; + protected $rsaPublicKey; /** * Generally this will nearly always be an Access Token represented as a * Laminas_OAuth_Token_Access object. * - * @var \Laminas\OAuth\Token\TokenInterface + * @var TokenInterface */ - protected $token = null; + protected $token; /** * Constructor; create a new object with an optional array|Traversable @@ -262,13 +267,17 @@ public function getConsumerSecret() * * @param string $method * @return StandardConfig - * @throws Exception\InvalidArgumentException if unsupported signature method specified + * @throws Exception\InvalidArgumentException If unsupported signature method specified. */ public function setSignatureMethod($method) { $method = strtoupper($method); - if (! in_array($method, [ - 'HMAC-SHA1', 'HMAC-SHA256', 'RSA-SHA1', 'PLAINTEXT' + if ( + ! in_array($method, [ + 'HMAC-SHA1', + 'HMAC-SHA256', + 'RSA-SHA1', + 'PLAINTEXT', ]) ) { throw new Exception\InvalidArgumentException('Unsupported signature method: ' @@ -294,13 +303,14 @@ public function getSignatureMethod() * * @param string $scheme * @return StandardConfig - * @throws Exception\InvalidArgumentException if invalid scheme specified, - * or if POSTBODY set when request method of GET is specified + * @throws Exception\InvalidArgumentException If invalid scheme specified + * or if POSTBODY set when request method of GET is specified. */ public function setRequestScheme($scheme) { $scheme = strtolower($scheme); - if (! in_array($scheme, [ + if ( + ! in_array($scheme, [ OAuth::REQUEST_SCHEME_HEADER, OAuth::REQUEST_SCHEME_POSTBODY, OAuth::REQUEST_SCHEME_QUERYSTRING, @@ -310,8 +320,9 @@ public function setRequestScheme($scheme) '\'' . $scheme . '\' is an unsupported request scheme' ); } - if ($scheme == OAuth::REQUEST_SCHEME_POSTBODY - && $this->getRequestMethod() == OAuth::GET + if ( + $scheme === OAuth::REQUEST_SCHEME_POSTBODY + && $this->getRequestMethod() === OAuth::GET ) { throw new Exception\InvalidArgumentException( 'Cannot set POSTBODY request method if HTTP method set to GET' @@ -358,7 +369,7 @@ public function getVersion() * * @param string $url Valid URI or Out-Of-Band constant 'oob' * @return StandardConfig - * @throws Exception\InvalidArgumentException for invalid URLs + * @throws Exception\InvalidArgumentException For invalid URLs. */ public function setCallbackUrl($url) { @@ -384,7 +395,7 @@ public function getCallbackUrl() * * @param string $url * @return StandardConfig - * @throws Exception\InvalidArgumentException for invalid URLs + * @throws Exception\InvalidArgumentException For invalid URLs. */ public function setSiteUrl($url) { @@ -408,7 +419,7 @@ public function getSiteUrl() * * @param string $url * @return StandardConfig - * @throws Exception\InvalidArgumentException for invalid URLs + * @throws Exception\InvalidArgumentException For invalid URLs. */ public function setRequestTokenUrl($url) { @@ -438,7 +449,7 @@ public function getRequestTokenUrl() * * @param string $url * @return StandardConfig - * @throws Exception\InvalidArgumentException for invalid URLs + * @throws Exception\InvalidArgumentException For invalid URLs. */ public function setAccessTokenUrl($url) { @@ -468,7 +479,7 @@ public function getAccessTokenUrl() * * @param string $url * @return StandardConfig - * @throws Exception\InvalidArgumentException for invalid URLs + * @throws Exception\InvalidArgumentException For invalid URLs. */ public function setUserAuthorizationUrl($url) { @@ -480,7 +491,7 @@ public function setUserAuthorizationUrl($url) * * @param string $url * @return StandardConfig - * @throws Exception\InvalidArgumentException for invalid URLs + * @throws Exception\InvalidArgumentException For invalid URLs. */ public function setAuthorizeUrl($url) { @@ -520,12 +531,13 @@ public function getAuthorizeUrl() * * @param string $method * @return StandardConfig - * @throws Exception\InvalidArgumentException for invalid request methods + * @throws Exception\InvalidArgumentException For invalid request methods. */ public function setRequestMethod($method) { $method = strtoupper($method); - if (! in_array($method, [ + if ( + ! in_array($method, [ OAuth::GET, OAuth::POST, OAuth::PUT, @@ -551,10 +563,9 @@ public function getRequestMethod() /** * Set RSA public key * - * @param \Laminas\Crypt\PublicKey\Rsa\PublicKey $key * @return StandardConfig */ - public function setRsaPublicKey(\Laminas\Crypt\PublicKey\Rsa\PublicKey $key) + public function setRsaPublicKey(PublicKey $key) { $this->rsaPublicKey = $key; return $this; @@ -563,7 +574,7 @@ public function setRsaPublicKey(\Laminas\Crypt\PublicKey\Rsa\PublicKey $key) /** * Get RSA public key * - * @return \Laminas\Crypt\PublicKey\Rsa\PublicKey + * @return PublicKey */ public function getRsaPublicKey() { @@ -573,10 +584,9 @@ public function getRsaPublicKey() /** * Set RSA private key * - * @param \Laminas\Crypt\PublicKey\Rsa\PrivateKey $key * @return StandardConfig */ - public function setRsaPrivateKey(\Laminas\Crypt\PublicKey\Rsa\PrivateKey $key) + public function setRsaPrivateKey(PrivateKey $key) { $this->rsaPrivateKey = $key; return $this; @@ -585,7 +595,7 @@ public function setRsaPrivateKey(\Laminas\Crypt\PublicKey\Rsa\PrivateKey $key) /** * Get RSA private key * - * @return \Laminas\Crypt\PublicKey\Rsa\PrivateKey + * @return PrivateKey */ public function getRsaPrivateKey() { @@ -595,7 +605,6 @@ public function getRsaPrivateKey() /** * Set OAuth token * - * @param TokenInterface $token * @return StandardConfig */ public function setToken(TokenInterface $token) diff --git a/src/Consumer.php b/src/Consumer.php index d7b1309..d61981b 100644 --- a/src/Consumer.php +++ b/src/Consumer.php @@ -2,35 +2,43 @@ namespace Laminas\OAuth; +use Laminas\OAuth\Config; +use Laminas\OAuth\Http\AccessToken; +use Laminas\OAuth\Token\Access; +use Laminas\OAuth\Token\Request; use Laminas\Stdlib\ArrayUtils; use Traversable; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function array_merge; +use function call_user_func_array; +use function header; +use function method_exists; + class Consumer extends OAuth { + /** + * replace later when this works + * + * @var bool + */ public $switcheroo = false; // replace later when this works /** * Request Token retrieved from OAuth Provider * - * @var \Laminas\OAuth\Token\Request + * @var Request */ - protected $requestToken = null; + protected $requestToken; /** * Access token retrieved from OAuth Provider * - * @var \Laminas\OAuth\Token\Access + * @var Access */ - protected $accessToken = null; + protected $accessToken; - /** - * @var \Laminas\OAuth\Config - */ - protected $config = null; + /** @var Config */ + protected $config; /** * Constructor; create a new object with an optional array|Laminas_Config @@ -40,7 +48,7 @@ class Consumer extends OAuth */ public function __construct($options = null) { - $this->config = new Config\StandardConfig; + $this->config = new Config\StandardConfig(); if ($options !== null) { if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); @@ -60,9 +68,9 @@ public function __construct($options = null) * @return Laminas\OAuth\Token\Request */ public function getRequestToken( - array $customServiceParameters = null, + ?array $customServiceParameters = null, $httpMethod = null, - Http\RequestToken $request = null + ?Http\RequestToken $request = null ) { if ($request === null) { $request = new Http\RequestToken($this, $customServiceParameters); @@ -93,9 +101,9 @@ public function getRequestToken( * @return string */ public function getRedirectUrl( - array $customServiceParameters = null, - Token\Request $token = null, - Http\UserAuthorization $redirect = null + ?array $customServiceParameters = null, + ?Token\Request $token = null, + ?Http\UserAuthorization $redirect = null ) { if ($redirect === null) { $redirect = new Http\UserAuthorization($this, $customServiceParameters); @@ -119,8 +127,8 @@ public function getRedirectUrl( * @return void */ public function redirect( - array $customServiceParameters = null, - Http\UserAuthorization $request = null + ?array $customServiceParameters = null, + ?Http\UserAuthorization $request = null ) { $redirectUrl = $this->getRedirectUrl($customServiceParameters, $request); header('Location: ' . $redirectUrl); @@ -131,20 +139,19 @@ public function redirect( * Retrieve an Access Token in exchange for a previously received/authorized * Request Token. * - * @param array $queryData GET data returned in user's redirect from Provider - * @param \Laminas\OAuth\Token\Request Request Token information - * @param string $httpMethod - * @param \Laminas\OAuth\Http\AccessToken $request - * @return \Laminas\OAuth\Token\Access - * @throws Exception\InvalidArgumentException on invalid authorization + * @param array $queryData GET data returned in user's redirect from Provider + * @param Request $token Request Token information + * @param string $httpMethod + * @return Access + * @throws Exception\InvalidArgumentException On invalid authorization * token, non-matching response authorization token, or unprovided - * authorization token + * authorization token. */ public function getAccessToken( $queryData, - Token\Request $token, + Request $token, $httpMethod = null, - Http\AccessToken $request = null + ?Http\AccessToken $request = null ) { $authorizedToken = new Token\AuthorizedRequest($queryData); if (! $authorizedToken->isValid()) { @@ -153,13 +160,13 @@ public function getAccessToken( ); } if ($request === null) { - $request = new Http\AccessToken($this); + $request = new AccessToken($this); } // OAuth 1.0a Verifier if ($authorizedToken->getParam('oauth_verifier') !== null) { $params = array_merge($request->getParameters(), [ - 'oauth_verifier' => $authorizedToken->getParam('oauth_verifier') + 'oauth_verifier' => $authorizedToken->getParam('oauth_verifier'), ]); $request->setParameters($params); } @@ -179,7 +186,7 @@ public function getAccessToken( throw new Exception\InvalidArgumentException('Request token must be passed to method'); } $this->requestToken = $token; - $this->accessToken = $request->execute(); + $this->accessToken = $request->execute(); return $this->accessToken; } @@ -187,7 +194,7 @@ public function getAccessToken( * Return whatever the last Request Token retrieved was while using the * current Consumer instance. * - * @return \Laminas\OAuth\Token\Request + * @return Request */ public function getLastRequestToken() { @@ -198,7 +205,7 @@ public function getLastRequestToken() * Return whatever the last Access Token retrieved was while using the * current Consumer instance. * - * @return \Laminas\OAuth\Token\Access + * @return Access */ public function getLastAccessToken() { @@ -208,7 +215,7 @@ public function getLastAccessToken() /** * Alias to self::getLastAccessToken() * - * @return \Laminas\OAuth\Token\Access + * @return Access */ public function getToken() { @@ -223,12 +230,12 @@ public function getToken() * @param string $method * @param array $args * @return mixed - * @throws Exception\BadMethodCallException if method does not exist in config object + * @throws Exception\BadMethodCallException If method does not exist in config object. */ public function __call($method, array $args) { if (! method_exists($this->config, $method)) { - throw new Exception\BadMethodCallException('Method does not exist: '.$method); + throw new Exception\BadMethodCallException('Method does not exist: ' . $method); } return call_user_func_array([$this->config, $method], $args); } diff --git a/src/Exception/BadMethodCallException.php b/src/Exception/BadMethodCallException.php index 340e19a..1d25927 100644 --- a/src/Exception/BadMethodCallException.php +++ b/src/Exception/BadMethodCallException.php @@ -4,5 +4,4 @@ class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface { - } diff --git a/src/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php index 7a7056a..226c70e 100644 --- a/src/Exception/ExceptionInterface.php +++ b/src/Exception/ExceptionInterface.php @@ -2,11 +2,6 @@ namespace Laminas\OAuth\Exception; -/** - * @category Laminas - * @package Laminas_OAuth - */ interface ExceptionInterface { - } diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index ae8cf74..662a8f8 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -4,5 +4,4 @@ class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface { - } diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index ed0f552..b3837f3 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -4,5 +4,4 @@ class RuntimeException extends \RuntimeException implements ExceptionInterface { - } diff --git a/src/Http.php b/src/Http.php index 0e76823..20fb702 100644 --- a/src/Http.php +++ b/src/Http.php @@ -2,10 +2,19 @@ namespace Laminas\OAuth; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use Laminas\Http\Client; +use Laminas\Http\Client\Exception\ExceptionInterface; +use Laminas\Http\Response; +use Laminas\OAuth\Consumer; +use Laminas\OAuth\Http\Utility; + +use function implode; +use function in_array; +use function preg_match; +use function sprintf; + +use const PHP_EOL; + class Http { /** @@ -21,7 +30,7 @@ class Http * * @var Consumer */ - protected $consumer = null; + protected $consumer; /** * OAuth specifies three request methods, this holds the current preferred @@ -30,7 +39,7 @@ class Http * * @var string */ - protected $preferredRequestScheme = null; + protected $preferredRequestScheme; /** * Request Method for the HTTP Request. @@ -42,24 +51,22 @@ class Http /** * Instance of the general Laminas\OAuth\Http\Utility class. * - * @var \Laminas\OAuth\Http\Utility + * @var Utility */ - protected $httpUtility = null; + protected $httpUtility; /** * Constructor * - * @param \Laminas\OAuth\Consumer $consumer * @param null|array $parameters - * @param null|\Laminas\OAuth\Http\Utility $utility * @return void */ public function __construct( Consumer $consumer, - array $parameters = null, - Http\Utility $utility = null + ?array $parameters = null, + ?Http\Utility $utility = null ) { - $this->consumer = $consumer; + $this->consumer = $consumer; $this->preferredRequestScheme = $this->consumer->getRequestScheme(); if ($parameters !== null) { $this->setParameters($parameters); @@ -67,7 +74,7 @@ public function __construct( if ($utility !== null) { $this->httpUtility = $utility; } else { - $this->httpUtility = new Http\Utility; + $this->httpUtility = new Utility(); } } @@ -138,8 +145,8 @@ public function getConsumer() * * @todo Remove cycling?; Replace with upfront do-or-die configuration * @param array $params - * @return \Laminas\Http\Response - * @throws Exception\InvalidArgumentException on HTTP request errors + * @return Response + * @throws Exception\InvalidArgumentException On HTTP request errors. */ public function startRequestCycle(array $params) { @@ -148,7 +155,7 @@ public function startRequestCycle(array $params) $status = null; try { $response = $this->attemptRequest($params); - } catch (\Laminas\Http\Client\Exception\ExceptionInterface $e) { + } catch (ExceptionInterface $e) { throw new Exception\InvalidArgumentException(sprintf( 'Error in HTTP request: %s', $e->getMessage() @@ -158,10 +165,11 @@ public function startRequestCycle(array $params) $body = $response->getBody(); $status = $response->getStatusCode(); } - if ($response === null // Request failure/exception - || $status == 500 // Internal Server Error - || $status == 400 // Bad Request - || $status == 401 // Unauthorized + if ( + $response === null // Request failure/exception + || $status === 500 // Internal Server Error + || $status === 400 // Bad Request + || $status === 401 // Unauthorized || empty($body) // Missing token ) { $this->assessRequestAttempt($response); @@ -176,7 +184,7 @@ public function startRequestCycle(array $params) * * @param array $params * @param string $url - * @return \Laminas\Http\Client + * @return Client */ public function getRequestSchemeQueryStringClient(array $params, $url) { @@ -193,11 +201,11 @@ public function getRequestSchemeQueryStringClient(array $params, $url) * Manages the switch from OAuth request scheme to another lower preference * scheme during a request cycle. * - * @param Laminas\Http\Response + * @param Laminas\Http\Response $response * @return void - * @throws Exception\RuntimeException if unable to retrieve valid token response + * @throws Exception\RuntimeException If unable to retrieve valid token response. */ - protected function assessRequestAttempt(\Laminas\Http\Response $response = null) + protected function assessRequestAttempt(?Response $response = null) { switch ($this->preferredRequestScheme) { case OAuth::REQUEST_SCHEME_HEADER: @@ -226,15 +234,15 @@ protected function assessRequestAttempt(\Laminas\Http\Response $response = null) */ protected function toAuthorizationHeader(array $params, $realm = null) { - $headerValue = []; + $headerValue = []; $headerValue[] = 'OAuth realm="' . $realm . '"'; foreach ($params as $key => $value) { if (! preg_match("/^oauth_/", $key)) { continue; } - $headerValue[] = Http\Utility::urlEncode($key) + $headerValue[] = Utility::urlEncode($key) . '="' - . Http\Utility::urlEncode($value) + . Utility::urlEncode($value) . '"'; } return implode(",", $headerValue); @@ -245,7 +253,7 @@ protected function toAuthorizationHeader(array $params, $realm = null) * return the resulting HTTP Response. * * @param array $params - * @return \Laminas\Http\Response + * @return Response */ protected function attemptRequest(array $params) { diff --git a/src/Http/AccessToken.php b/src/Http/AccessToken.php index a861b3f..3a81789 100644 --- a/src/Http/AccessToken.php +++ b/src/Http/AccessToken.php @@ -3,34 +3,34 @@ namespace Laminas\OAuth\Http; use Laminas\Http; +use Laminas\Http\Client; use Laminas\OAuth\Http as HTTPClient; use Laminas\OAuth\OAuth; use Laminas\OAuth\Token; +use Laminas\OAuth\Token\Access; + +use function array_merge; +use function preg_match; -/** - * @category Laminas - * @package Laminas_OAuth - */ class AccessToken extends HTTPClient { /** * Singleton instance if required of the HTTP client * - * @var \Laminas\Http\Client + * @var Client */ - protected $httpClient = null; + protected $httpClient; /** * Initiate a HTTP request to retrieve an Access Token. * - * @return \Laminas\OAuth\Token\Access + * @return Access */ public function execute() { $params = $this->assembleParams(); $response = $this->startRequestCycle($params); - $return = new Token\Access($response); - return $return; + return new Token\Access($response); } /** diff --git a/src/Http/RequestToken.php b/src/Http/RequestToken.php index f1a16f8..29cf9be 100644 --- a/src/Http/RequestToken.php +++ b/src/Http/RequestToken.php @@ -7,10 +7,8 @@ use Laminas\OAuth\OAuth; use Laminas\OAuth\Token; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function array_merge; + class RequestToken extends HTTPClient { /** @@ -18,7 +16,7 @@ class RequestToken extends HTTPClient * * @var Http\Client */ - protected $httpClient = null; + protected $httpClient; /** * Initiate a HTTP request to retrieve a Request Token. @@ -29,8 +27,7 @@ public function execute() { $params = $this->assembleParams(); $response = $this->startRequestCycle($params); - $return = new Token\Request($response); - return $return; + return new Token\Request($response); } /** diff --git a/src/Http/UserAuthorization.php b/src/Http/UserAuthorization.php index 89a1e1a..35e887d 100644 --- a/src/Http/UserAuthorization.php +++ b/src/Http/UserAuthorization.php @@ -2,13 +2,12 @@ namespace Laminas\OAuth\Http; +use Laminas\OAuth\Client; use Laminas\OAuth\Http as HTTPClient; use Laminas\Uri; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function array_merge; + class UserAuthorization extends HTTPClient { /** @@ -40,7 +39,7 @@ public function assembleParams() 'oauth_token' => $this->consumer->getLastRequestToken()->getToken(), ]; - if (! \Laminas\OAuth\Client::$supportsRevisionA) { + if (! Client::$supportsRevisionA) { $callback = $this->consumer->getCallbackUrl(); if (! empty($callback)) { $params['oauth_callback'] = $callback; diff --git a/src/Http/Utility.php b/src/Http/Utility.php index 5831038..e9fd8b4 100644 --- a/src/Http/Utility.php +++ b/src/Http/Utility.php @@ -4,10 +4,21 @@ use Laminas\OAuth\Config\ConfigInterface; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function array_merge; +use function count; +use function explode; +use function implode; +use function md5; +use function preg_match; +use function rand; +use function rawurldecode; +use function rawurlencode; +use function str_replace; +use function strtolower; +use function time; +use function ucfirst; +use function uniqid; + class Utility { /** @@ -15,14 +26,13 @@ class Utility * params other than the defaults expected for any OAuth query. * * @param string $url - * @param ConfigInterface $config * @param null|array $serviceProviderParams * @return array */ public function assembleParams( $url, ConfigInterface $config, - array $serviceProviderParams = null + ?array $serviceProviderParams = null ) { $params = [ 'oauth_consumer_key' => $config->getConsumerKey(), @@ -32,11 +42,10 @@ public function assembleParams( 'oauth_version' => $config->getVersion(), ]; - if ($config->getToken()->getToken() != null) { + if ($config->getToken()->getToken() !== null) { $params['oauth_token'] = $config->getToken()->getToken(); } - if ($serviceProviderParams !== null) { $params = array_merge($params, $serviceProviderParams); } @@ -86,7 +95,7 @@ public function toEncodedQueryString(array $params, $customParamsOnly = false) * @param array $params * @param null|string $realm * @param bool $excludeCustomParams - * @return void + * @return string */ public function toAuthorizationHeader(array $params, $realm = null, $excludeCustomParams = true) { @@ -157,7 +166,7 @@ public function parseQueryString($query) // periods and uses urldecode, not rawurldecode. $parts = explode('&', $query); foreach ($parts as $pair) { - $kv = explode('=', $pair); + $kv = explode('=', $pair); $params[rawurldecode($kv[0])] = rawurldecode($kv[1]); } return $params; diff --git a/src/OAuth.php b/src/OAuth.php index c75f5ff..4dd9739 100644 --- a/src/OAuth.php +++ b/src/OAuth.php @@ -4,27 +4,23 @@ use Laminas\Http\Client as HTTPClient; -/** - * @category Laminas - * @package Laminas_OAuth - */ class OAuth { - const REQUEST_SCHEME_HEADER = 'header'; - const REQUEST_SCHEME_POSTBODY = 'postbody'; - const REQUEST_SCHEME_QUERYSTRING = 'querystring'; - const GET = 'GET'; - const POST = 'POST'; - const PUT = 'PUT'; - const DELETE = 'DELETE'; - const HEAD = 'HEAD'; + public const REQUEST_SCHEME_HEADER = 'header'; + public const REQUEST_SCHEME_POSTBODY = 'postbody'; + public const REQUEST_SCHEME_QUERYSTRING = 'querystring'; + public const GET = 'GET'; + public const POST = 'POST'; + public const PUT = 'PUT'; + public const DELETE = 'DELETE'; + public const HEAD = 'HEAD'; /** * Singleton instance if required of the HTTP client * * @var Laminas\Http\Client */ - protected static $httpClient = null; + protected static $httpClient; /** * Allows the external environment to make Laminas_OAuth use a specific @@ -48,7 +44,7 @@ public static function setHttpClient(HTTPClient $httpClient) public static function getHttpClient() { if (! isset(self::$httpClient)) { - self::$httpClient = new HTTPClient; + self::$httpClient = new HTTPClient(); } else { $request = self::$httpClient->getRequest(); $headers = $request->getHeaders(); diff --git a/src/Signature/AbstractSignature.php b/src/Signature/AbstractSignature.php index 94fb24f..a6df57c 100644 --- a/src/Signature/AbstractSignature.php +++ b/src/Signature/AbstractSignature.php @@ -6,32 +6,39 @@ use Laminas\OAuth\Http\Utility as HTTPUtility; use Laminas\Uri; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function implode; +use function in_array; +use function is_array; +use function natsort; +use function strtoupper; +use function uksort; + abstract class AbstractSignature implements SignatureInterface { /** * Hash algorithm to use when generating signature + * * @var string */ - protected $hashAlgorithm = null; + protected $hashAlgorithm; /** * Key to use when signing + * * @var string */ - protected $key = null; + protected $key; /** * Consumer secret + * * @var string */ - protected $consumerSecret = null; + protected $consumerSecret; /** * Token secret + * * @var string */ protected $tokenSecret = ''; @@ -67,9 +74,9 @@ public function normaliseBaseSignatureUrl($url) { $uri = Uri\UriFactory::factory($url); $uri->normalize(); - if ($uri->getScheme() == 'http' && $uri->getPort() == '80') { + if ($uri->getScheme() === 'http' && (int) $uri->getPort() === 80) { $uri->setPort(''); - } elseif ($uri->getScheme() == 'https' && $uri->getPort() == '443') { + } elseif ($uri->getScheme() === 'https' && (int) $uri->getPort() === 443) { $uri->setPort(''); } elseif (! in_array($uri->getScheme(), ['http', 'https'])) { throw new Exception\InvalidArgumentException('Invalid URL provided; must be an HTTP or HTTPS scheme'); diff --git a/src/Signature/Hmac.php b/src/Signature/Hmac.php index 9324c74..547094a 100644 --- a/src/Signature/Hmac.php +++ b/src/Signature/Hmac.php @@ -4,10 +4,8 @@ use Laminas\Crypt\Hmac as HMACEncryption; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function base64_encode; + class Hmac extends AbstractSignature { /** diff --git a/src/Signature/Plaintext.php b/src/Signature/Plaintext.php index 4625ed6..86d7185 100644 --- a/src/Signature/Plaintext.php +++ b/src/Signature/Plaintext.php @@ -2,10 +2,8 @@ namespace Laminas\OAuth\Signature; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function implode; + class Plaintext extends AbstractSignature { /** @@ -21,7 +19,6 @@ public function sign(array $params, $method = null, $url = null) if ($this->tokenSecret === null) { return $this->consumerSecret . '&'; } - $return = implode('&', [$this->consumerSecret, $this->tokenSecret]); - return $return; + return implode('&', [$this->consumerSecret, $this->tokenSecret]); } } diff --git a/src/Signature/Rsa.php b/src/Signature/Rsa.php index 270fdec..d86c1af 100644 --- a/src/Signature/Rsa.php +++ b/src/Signature/Rsa.php @@ -5,10 +5,6 @@ use Laminas\Crypt\PublicKey\Rsa as RsaEnc; use Laminas\Crypt\PublicKey\RsaOptions as RsaEncOptions; -/** - * @category Laminas - * @package Laminas_OAuth - */ class Rsa extends AbstractSignature { /** @@ -23,7 +19,7 @@ public function sign(array $params, $method = null, $url = null) { $rsa = new RsaEnc(new RsaEncOptions([ 'hash_algorithm' => $this->hashAlgorithm, - 'binary_output' => true + 'binary_output' => true, ])); return $rsa->sign($this->getBaseSignatureString($params, $method, $url), $this->key); diff --git a/src/Token/AbstractToken.php b/src/Token/AbstractToken.php index b2de55a..c227e8b 100644 --- a/src/Token/AbstractToken.php +++ b/src/Token/AbstractToken.php @@ -5,18 +5,19 @@ use Laminas\Http\Response as HTTPResponse; use Laminas\OAuth\Http\Utility as HTTPUtility; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function count; +use function explode; +use function rawurldecode; +use function trim; + abstract class AbstractToken implements TokenInterface { /**@+ * Token constants */ - const TOKEN_PARAM_KEY = 'oauth_token'; - const TOKEN_SECRET_PARAM_KEY = 'oauth_token_secret'; - const TOKEN_PARAM_CALLBACK_CONFIRMED = 'oauth_callback_confirmed'; + public const TOKEN_PARAM_KEY = 'oauth_token'; + public const TOKEN_SECRET_PARAM_KEY = 'oauth_token_secret'; + public const TOKEN_PARAM_CALLBACK_CONFIRMED = 'oauth_callback_confirmed'; /**@-*/ /** @@ -29,29 +30,25 @@ abstract class AbstractToken implements TokenInterface /** * OAuth response object * - * @var \Laminas\Http\Response + * @var HTTPResponse */ - protected $response = null; + protected $response; - /** - * @var \Laminas\OAuth\Http\Utility - */ - protected $httpUtility = null; + /** @var HTTPUtility */ + protected $httpUtility; /** * Constructor; basic setup for any Token subclass. * - * @param null|\Laminas\Http\Response $response - * @param null|\Laminas\OAuth\Http\Utility $utility * @return void */ public function __construct( - HTTPResponse $response = null, - HTTPUtility $utility = null + ?HTTPResponse $response = null, + ?HTTPUtility $utility = null ) { if ($response !== null) { $this->response = $response; - $params = $this->parseParameters($response); + $params = $this->parseParameters($response); if (count($params) > 0) { $this->setParams($params); } @@ -59,7 +56,7 @@ public function __construct( if ($utility !== null) { $this->httpUtility = $utility; } else { - $this->httpUtility = new HTTPUtility; + $this->httpUtility = new HTTPUtility(); } } @@ -71,7 +68,8 @@ public function __construct( */ public function isValid() { - if (isset($this->params[self::TOKEN_PARAM_KEY]) + if ( + isset($this->params[self::TOKEN_PARAM_KEY]) && ! empty($this->params[self::TOKEN_PARAM_KEY]) && isset($this->params[self::TOKEN_SECRET_PARAM_KEY]) ) { @@ -83,7 +81,7 @@ public function isValid() /** * Return the HTTP response object used to initialise this instance. * - * @return \Laminas\Http\Response + * @return HTTPResponse */ public function getResponse() { @@ -95,7 +93,7 @@ public function getResponse() * requests with this Token. * * @param string $secret - * @return \Laminas\OAuth\Token\AbstractToken + * @return AbstractToken */ public function setTokenSecret($secret) { @@ -120,7 +118,7 @@ public function getTokenSecret() * * @param string $key * @param string $value - * @return \Laminas\OAuth\Token\AbstractToken + * @return AbstractToken */ public function setParam($key, $value) { @@ -133,7 +131,7 @@ public function setParam($key, $value) * a simple filter to remove any trailing newlines. * * @param array $params - * @return \Laminas\OAuth\Token\AbstractToken + * @return AbstractToken */ public function setParams(array $params) { @@ -161,7 +159,7 @@ public function getParam($key) * Sets the value for a Token. * * @param string $token - * @return \Laminas\OAuth\Token\AbstractToken + * @return AbstractToken */ public function setToken($token) { @@ -182,7 +180,8 @@ public function getToken() /** * Generic accessor to enable access as public properties. * - * @return string + * @param string $key + * @return mixed|null */ public function __get($key) { @@ -226,7 +225,6 @@ public function __toString() * Parse a HTTP response body and collect returned parameters * as raw url decoded key-value pairs in an associative array. * - * @param \Laminas\Http\Response $response * @return array */ protected function parseParameters(HTTPResponse $response) @@ -240,7 +238,7 @@ protected function parseParameters(HTTPResponse $response) // validate body based on acceptable characters...todo $parts = explode('&', $body); foreach ($parts as $kvpair) { - $pair = explode('=', $kvpair); + $pair = explode('=', $kvpair); $params[rawurldecode($pair[0])] = rawurldecode($pair[1]); } return $params; @@ -248,6 +246,8 @@ protected function parseParameters(HTTPResponse $response) /** * Limit serialisation stored data to the parameters + * + * @return array */ public function __sleep() { @@ -260,7 +260,7 @@ public function __sleep() public function __wakeup() { if ($this->httpUtility === null) { - $this->httpUtility = new HTTPUtility; + $this->httpUtility = new HTTPUtility(); } } } diff --git a/src/Token/Access.php b/src/Token/Access.php index ed1c8f5..36ba0d2 100644 --- a/src/Token/Access.php +++ b/src/Token/Access.php @@ -6,18 +6,16 @@ use Laminas\OAuth\Config\ConfigInterface as Config; use Laminas\OAuth\Exception; use Laminas\Uri; +use Traversable; + +use function in_array; -/** - * @category Laminas - * @package Laminas_OAuth - */ class Access extends AbstractToken { /** * Cast to HTTP header * * @param string $url - * @param Config $config * @param null|array $customParams * @param null|string $realm * @return string @@ -26,11 +24,12 @@ class Access extends AbstractToken public function toHeader( $url, Config $config, - array $customParams = null, + ?array $customParams = null, $realm = null ) { $uri = Uri\UriFactory::factory($url); - if (! $uri->isValid() + if ( + ! $uri->isValid() || ! in_array($uri->getScheme(), ['http', 'https']) ) { throw new Exception\InvalidArgumentException( @@ -50,10 +49,11 @@ public function toHeader( * @return string * @throws Exception\InvalidArgumentException */ - public function toQueryString($url, Config $config, array $params = null) + public function toQueryString($url, Config $config, ?array $params = null) { $uri = Uri\UriFactory::factory($url); - if (! $uri->isValid() + if ( + ! $uri->isValid() || ! in_array($uri->getScheme(), ['http', 'https']) ) { throw new Exception\InvalidArgumentException( @@ -69,7 +69,7 @@ public function toQueryString($url, Config $config, array $params = null) * * @param array $oauthOptions * @param null|string $uri - * @param null|array|\Traversable $config + * @param null|array|Traversable $config * @param bool $excludeCustomParamsFromHeader * @return Client */ diff --git a/src/Token/AuthorizedRequest.php b/src/Token/AuthorizedRequest.php index df6d8c6..1e63b09 100644 --- a/src/Token/AuthorizedRequest.php +++ b/src/Token/AuthorizedRequest.php @@ -4,29 +4,25 @@ use Laminas\OAuth\Http; -/** - * @category Laminas - * @package Laminas_OAuth - */ +use function count; +use function rawurldecode; + class AuthorizedRequest extends AbstractToken { - /** - * @var array - */ + /** @var array */ protected $data = []; /** * Constructor * * @param null|array $data - * @param null|\Laminas\OAuth\Http\Utility $utility * @return void */ - public function __construct(array $data = null, Http\Utility $utility = null) + public function __construct(?array $data = null, ?Http\Utility $utility = null) { if ($data !== null) { $this->data = $data; - $params = $this->parseData(); + $params = $this->parseData(); if (count($params) > 0) { $this->setParams($params); } @@ -34,7 +30,7 @@ public function __construct(array $data = null, Http\Utility $utility = null) if ($utility !== null) { $this->httpUtility = $utility; } else { - $this->httpUtility = new Http\Utility; + $this->httpUtility = new Http\Utility(); } } @@ -55,7 +51,8 @@ public function getData() */ public function isValid() { - if (isset($this->params[self::TOKEN_PARAM_KEY]) + if ( + isset($this->params[self::TOKEN_PARAM_KEY]) && ! empty($this->params[self::TOKEN_PARAM_KEY]) ) { return true; diff --git a/src/Token/Request.php b/src/Token/Request.php index 50dc408..33c971b 100644 --- a/src/Token/Request.php +++ b/src/Token/Request.php @@ -6,10 +6,6 @@ use Laminas\OAuth\Client; use Laminas\OAuth\Http\Utility as HTTPUtility; -/** - * @category Laminas - * @package Laminas_OAuth - */ class Request extends AbstractToken { /** @@ -19,8 +15,8 @@ class Request extends AbstractToken * @param null|Laminas\OAuth\Http\Utility $utility */ public function __construct( - HTTPResponse $response = null, - HTTPUtility $utility = null + ?HTTPResponse $response = null, + ?HTTPUtility $utility = null ) { parent::__construct($response, $utility); diff --git a/src/Token/TokenInterface.php b/src/Token/TokenInterface.php index d5242f8..c0bb359 100644 --- a/src/Token/TokenInterface.php +++ b/src/Token/TokenInterface.php @@ -3,11 +3,9 @@ namespace Laminas\OAuth\Token; use Laminas\Http\Response as HTTPResponse; -use Laminas\OAuth\Http\Utility as HTTPUtility; interface TokenInterface { - /** * Retrieve an arbitrary named parameter from the token * diff --git a/test/Config/StandardConfigurationTest.php b/test/Config/StandardConfigurationTest.php index a726143..05ce403 100644 --- a/test/Config/StandardConfigurationTest.php +++ b/test/Config/StandardConfigurationTest.php @@ -11,7 +11,7 @@ public function testSiteUrlArePropertlyBuiltFromDefaultPaths() { $config = new StandardConfig( [ - 'siteUrl' => 'https://example.com/oauth/' + 'siteUrl' => 'https://example.com/oauth/', ] ); $this->assertEquals('https://example.com/oauth/authorize', $config->getAuthorizeUrl()); diff --git a/test/ConsumerTest.php b/test/ConsumerTest.php index d1cfe2c..ba84bb7 100644 --- a/test/ConsumerTest.php +++ b/test/ConsumerTest.php @@ -3,9 +3,12 @@ namespace LaminasTest\OAuth; use Laminas\OAuth\Consumer; +use Laminas\OAuth\Exception\ExceptionInterface; use Laminas\OAuth\Http; use Laminas\OAuth\OAuth; use Laminas\OAuth\Token; +use Laminas\OAuth\Token\Access; +use Laminas\OAuth\Token\Request; use LaminasTest\OAuth\TestAsset\AccessToken48231; use LaminasTest\OAuth\TestAsset\Consumer48231; use LaminasTest\OAuth\TestAsset\RequestToken48231; @@ -20,22 +23,22 @@ public function teardown(): void public function testConstructorSetsConsumerKey() { - $config = ['consumerKey' => '1234567890']; + $config = ['consumerKey' => '1234567890']; $consumer = new Consumer($config); $this->assertEquals('1234567890', $consumer->getConsumerKey()); } public function testConstructorSetsConsumerSecret() { - $config = ['consumerSecret' => '0987654321']; + $config = ['consumerSecret' => '0987654321']; $consumer = new Consumer($config); $this->assertEquals('0987654321', $consumer->getConsumerSecret()); } public function testSetsSignatureMethodFromOptionsArray() { - $options = [ - 'signatureMethod' => 'rsa-sha1' + $options = [ + 'signatureMethod' => 'rsa-sha1', ]; $consumer = new Consumer($options); $this->assertEquals('RSA-SHA1', $consumer->getSignatureMethod()); @@ -43,8 +46,8 @@ public function testSetsSignatureMethodFromOptionsArray() public function testSetsRequestMethodFromOptionsArray() // add back { - $options = [ - 'requestMethod' => OAuth::GET + $options = [ + 'requestMethod' => OAuth::GET, ]; $consumer = new Consumer($options); $this->assertEquals(OAuth::GET, $consumer->getRequestMethod()); @@ -52,8 +55,8 @@ public function testSetsRequestMethodFromOptionsArray() // add back public function testSetsRequestSchemeFromOptionsArray() { - $options = [ - 'requestScheme' => OAuth::REQUEST_SCHEME_POSTBODY + $options = [ + 'requestScheme' => OAuth::REQUEST_SCHEME_POSTBODY, ]; $consumer = new Consumer($options); $this->assertEquals(OAuth::REQUEST_SCHEME_POSTBODY, $consumer->getRequestScheme()); @@ -61,8 +64,8 @@ public function testSetsRequestSchemeFromOptionsArray() public function testSetsVersionFromOptionsArray() { - $options = [ - 'version' => '1.1' + $options = [ + 'version' => '1.1', ]; $consumer = new Consumer($options); $this->assertEquals('1.1', $consumer->getVersion()); @@ -70,8 +73,8 @@ public function testSetsVersionFromOptionsArray() public function testSetsCallbackUrlFromOptionsArray() { - $options = [ - 'callbackUrl' => 'http://www.example.com/local' + $options = [ + 'callbackUrl' => 'http://www.example.com/local', ]; $consumer = new Consumer($options); $this->assertEquals('http://www.example.com/local', $consumer->getCallbackUrl()); @@ -79,8 +82,8 @@ public function testSetsCallbackUrlFromOptionsArray() public function testSetsRequestTokenUrlFromOptionsArray() { - $options = [ - 'requestTokenUrl' => 'http://www.example.com/request' + $options = [ + 'requestTokenUrl' => 'http://www.example.com/request', ]; $consumer = new Consumer($options); $this->assertEquals('http://www.example.com/request', $consumer->getRequestTokenUrl()); @@ -88,8 +91,8 @@ public function testSetsRequestTokenUrlFromOptionsArray() public function testSetsUserAuthorizationUrlFromOptionsArray() { - $options = [ - 'userAuthorizationUrl' => 'http://www.example.com/authorize' + $options = [ + 'userAuthorizationUrl' => 'http://www.example.com/authorize', ]; $consumer = new Consumer($options); $this->assertEquals('http://www.example.com/authorize', $consumer->getUserAuthorizationUrl()); @@ -97,8 +100,8 @@ public function testSetsUserAuthorizationUrlFromOptionsArray() public function testSetsAccessTokenUrlFromOptionsArray() { - $options = [ - 'accessTokenUrl' => 'http://www.example.com/access' + $options = [ + 'accessTokenUrl' => 'http://www.example.com/access', ]; $consumer = new Consumer($options); $this->assertEquals('http://www.example.com/access', $consumer->getAccessTokenUrl()); @@ -106,83 +109,86 @@ public function testSetsAccessTokenUrlFromOptionsArray() public function testSetSignatureMethodThrowsExceptionForInvalidMethod() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer($config); - $this->expectException('Laminas\OAuth\Exception\ExceptionInterface'); + $this->expectException(ExceptionInterface::class); $consumer->setSignatureMethod('buckyball'); } public function testSetRequestMethodThrowsExceptionForInvalidMethod() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer($config); - $this->expectException('Laminas\OAuth\Exception\ExceptionInterface'); + $this->expectException(ExceptionInterface::class); $consumer->setRequestMethod('buckyball'); } public function testSetRequestSchemeThrowsExceptionForInvalidMethod() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer($config); - $this->expectException('Laminas\OAuth\Exception\ExceptionInterface'); + $this->expectException(ExceptionInterface::class); $consumer->setRequestScheme('buckyball'); } public function testSetLocalUrlThrowsExceptionForInvalidUrl() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer($config); - $this->expectException('Laminas\OAuth\Exception\ExceptionInterface'); + $this->expectException(ExceptionInterface::class); $consumer->setLocalUrl('buckyball'); } public function testSetRequestTokenUrlThrowsExceptionForInvalidUrl() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer($config); - $this->expectException('Laminas\OAuth\Exception\ExceptionInterface'); + $this->expectException(ExceptionInterface::class); $consumer->setRequestTokenUrl('buckyball'); } public function testSetUserAuthorizationUrlThrowsExceptionForInvalidUrl() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer($config); - $this->expectException('Laminas\OAuth\Exception\ExceptionInterface'); + $this->expectException(ExceptionInterface::class); $consumer->setUserAuthorizationUrl('buckyball'); } public function testSetAccessTokenUrlThrowsExceptionForInvalidUrl() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer($config); - $this->expectException('Laminas\OAuth\Exception\ExceptionInterface'); + $this->expectException(ExceptionInterface::class); $consumer->setAccessTokenUrl('buckyball'); } public function testGetRequestTokenReturnsInstanceOfOauthTokenRequest() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer($config); - $token = $consumer->getRequestToken(null, null, new RequestToken48231()); - $this->assertInstanceOf('Laminas\OAuth\Token\Request', $token); + $token = $consumer->getRequestToken(null, null, new RequestToken48231()); + $this->assertInstanceOf(Request::class, $token); } public function testGetRedirectUrlReturnsUserAuthorizationUrlWithParameters() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321', - 'userAuthorizationUrl' => 'http://www.example.com/authorize']; + $config = [ + 'consumerKey' => '12345', + 'consumerSecret' => '54321', + 'userAuthorizationUrl' => 'http://www.example.com/authorize', + ]; $consumer = new Consumer48231($config); - $params = ['foo' => 'bar']; - $uauth = new Http\UserAuthorization($consumer, $params); - $token = new Token\Request; + $params = ['foo' => 'bar']; + $uauth = new Http\UserAuthorization($consumer, $params); + $token = new Token\Request(); $token->setParams(['oauth_token' => '123456', 'oauth_token_secret' => '654321']); $redirectUrl = $consumer->getRedirectUrl($params, $token, $uauth); $this->assertEquals( @@ -194,25 +200,25 @@ public function testGetRedirectUrlReturnsUserAuthorizationUrlWithParameters() public function testGetAccessTokenReturnsInstanceOfOauthTokenAccess() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer($config); - $rtoken = new Token\Request; + $rtoken = new Token\Request(); $rtoken->setToken('token'); $token = $consumer->getAccessToken(['oauth_token' => 'token'], $rtoken, null, new AccessToken48231()); - $this->assertInstanceOf('Laminas\OAuth\Token\Access', $token); + $this->assertInstanceOf(Access::class, $token); } public function testGetLastRequestTokenReturnsInstanceWhenExists() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer48231($config); - $this->assertInstanceOf('Laminas\OAuth\Token\Request', $consumer->getLastRequestToken()); + $this->assertInstanceOf(Request::class, $consumer->getLastRequestToken()); } public function testGetLastAccessTokenReturnsInstanceWhenExists() { - $config = ['consumerKey' => '12345','consumerSecret' => '54321']; + $config = ['consumerKey' => '12345', 'consumerSecret' => '54321']; $consumer = new Consumer48231($config); - $this->assertInstanceOf('Laminas\OAuth\Token\Access', $consumer->getLastAccessToken()); + $this->assertInstanceOf(Access::class, $consumer->getLastAccessToken()); } } diff --git a/test/Http/AccessTokenTest.php b/test/Http/AccessTokenTest.php index 3267ba6..41e8bbd 100644 --- a/test/Http/AccessTokenTest.php +++ b/test/Http/AccessTokenTest.php @@ -11,12 +11,15 @@ class AccessTokenTest extends TestCase { - protected $stubConsumer = null; - protected $stubHttpUtility = null; + /** @var Consumer39745 */ + protected $stubConsumer; + + /** @var HTTPUtility39745 */ + protected $stubHttpUtility; public function setup(): void { - $this->stubConsumer = new Consumer39745(); + $this->stubConsumer = new Consumer39745(); $this->stubHttpUtility = new HTTPUtility39745(); OAuth::setHttpClient(new HTTPClient39745()); } @@ -34,40 +37,41 @@ public function testConstructorSetsConsumerInstance() public function testConstructorSetsCustomServiceParameters() { - $request = new Http\AccessToken($this->stubConsumer, [1,2,3], $this->stubHttpUtility); - $this->assertEquals([1,2,3], $request->getParameters()); + $request = new Http\AccessToken($this->stubConsumer, [1, 2, 3], $this->stubHttpUtility); + $this->assertEquals([1, 2, 3], $request->getParameters()); } public function testAssembleParametersCorrectlyAggregatesOauthParameters() { - $request = new Http\AccessToken($this->stubConsumer, null, $this->stubHttpUtility); + $request = new Http\AccessToken($this->stubConsumer, null, $this->stubHttpUtility); $expectedParams = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_timestamp' => '12345678901', - 'oauth_token' => '0987654321', - 'oauth_version' => '1.0', - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c' + 'oauth_timestamp' => '12345678901', + 'oauth_token' => '0987654321', + 'oauth_version' => '1.0', + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c', ]; $this->assertEquals($expectedParams, $request->assembleParams()); } + public function testAssembleParametersCorrectlyIgnoresCustomParameters() { - $request = new Http\AccessToken($this->stubConsumer, [ + $request = new Http\AccessToken($this->stubConsumer, [ 'custom_param1' => 'foo', - 'custom_param2' => 'bar' + 'custom_param2' => 'bar', ], $this->stubHttpUtility); $expectedParams = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_timestamp' => '12345678901', - 'oauth_token' => '0987654321', - 'oauth_version' => '1.0', - 'custom_param1' => 'foo', - 'custom_param2' => 'bar', - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c' + 'oauth_timestamp' => '12345678901', + 'oauth_token' => '0987654321', + 'oauth_version' => '1.0', + 'custom_param1' => 'foo', + 'custom_param2' => 'bar', + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c', ]; $this->assertEquals($expectedParams, $request->assembleParams()); } @@ -75,23 +79,23 @@ public function testAssembleParametersCorrectlyIgnoresCustomParameters() public function testGetRequestSchemeHeaderClientSetsCorrectlyEncodedAuthorizationHeader() { $request = new Http\AccessToken($this->stubConsumer, null, $this->stubHttpUtility); - $params = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + $params = [ + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_timestamp' => '12345678901', - 'oauth_token' => '0987654321', - 'oauth_version' => '1.0', - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c~', - 'custom_param1' => 'foo', - 'custom_param2' => 'bar' + 'oauth_timestamp' => '12345678901', + 'oauth_token' => '0987654321', + 'oauth_version' => '1.0', + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c~', + 'custom_param1' => 'foo', + 'custom_param2' => 'bar', ]; - $client = $request->getRequestSchemeHeaderClient($params); + $client = $request->getRequestSchemeHeaderClient($params); $this->assertEquals( 'OAuth realm="",oauth_consumer_key="1234567890",oauth_nonce="e807f1fcf82d132f9b' - .'b018ca6738a19f",oauth_signature_method="HMAC-SHA1",oauth_timestamp="' - .'12345678901",oauth_token="0987654321",oauth_version="1.0",oauth_sign' - .'ature="6fb42da0e32e07b61c9f0251fe627a9c~"', + . 'b018ca6738a19f",oauth_signature_method="HMAC-SHA1",oauth_timestamp="' + . '12345678901",oauth_token="0987654321",oauth_version="1.0",oauth_sign' + . 'ature="6fb42da0e32e07b61c9f0251fe627a9c~"', $client->getHeader('Authorization') ); } @@ -99,23 +103,23 @@ public function testGetRequestSchemeHeaderClientSetsCorrectlyEncodedAuthorizatio public function testGetRequestSchemePostBodyClientSetsCorrectlyEncodedRawData() { $request = new Http\AccessToken($this->stubConsumer, null, $this->stubHttpUtility); - $params = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + $params = [ + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_timestamp' => '12345678901', - 'oauth_token' => '0987654321', - 'oauth_version' => '1.0', - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c~', - 'custom_param1' => 'foo', - 'custom_param2' => 'bar' + 'oauth_timestamp' => '12345678901', + 'oauth_token' => '0987654321', + 'oauth_version' => '1.0', + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c~', + 'custom_param1' => 'foo', + 'custom_param2' => 'bar', ]; - $client = $request->getRequestSchemePostBodyClient($params); + $client = $request->getRequestSchemePostBodyClient($params); $this->assertEquals( 'oauth_consumer_key=1234567890&oauth_nonce=e807f1fcf82d132f9bb018c' - .'a6738a19f&oauth_signature_method=HMAC-SHA1&oauth_timestamp=12345' - .'678901&oauth_token=0987654321&oauth_version=1.0&oauth_signature=' - .'6fb42da0e32e07b61c9f0251fe627a9c~', + . 'a6738a19f&oauth_signature_method=HMAC-SHA1&oauth_timestamp=12345' + . '678901&oauth_token=0987654321&oauth_version=1.0&oauth_signature=' + . '6fb42da0e32e07b61c9f0251fe627a9c~', //$client->getRawData() $client->getRequest()->getContent() ); @@ -124,23 +128,23 @@ public function testGetRequestSchemePostBodyClientSetsCorrectlyEncodedRawData() public function testGetRequestSchemeQueryStringClientSetsCorrectlyEncodedQueryString() { $request = new Http\AccessToken($this->stubConsumer, null, $this->stubHttpUtility); - $params = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + $params = [ + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_timestamp' => '12345678901', - 'oauth_token' => '0987654321', - 'oauth_version' => '1.0', - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c', - 'custom_param1' => 'foo', - 'custom_param2' => 'bar' + 'oauth_timestamp' => '12345678901', + 'oauth_token' => '0987654321', + 'oauth_version' => '1.0', + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c', + 'custom_param1' => 'foo', + 'custom_param2' => 'bar', ]; - $client = $request->getRequestSchemeQueryStringClient($params, 'http://www.example.com'); + $client = $request->getRequestSchemeQueryStringClient($params, 'http://www.example.com'); $this->assertEquals( 'oauth_consumer_key=1234567890&oauth_nonce=e807f1fcf82d132f9bb018c' - .'a6738a19f&oauth_signature_method=HMAC-SHA1&oauth_timestamp=12345' - .'678901&oauth_token=0987654321&oauth_version=1.0&oauth_signature=' - .'6fb42da0e32e07b61c9f0251fe627a9c', + . 'a6738a19f&oauth_signature_method=HMAC-SHA1&oauth_timestamp=12345' + . '678901&oauth_token=0987654321&oauth_version=1.0&oauth_signature=' + . '6fb42da0e32e07b61c9f0251fe627a9c', $client->getUri()->getQuery() ); } diff --git a/test/Http/RequestTokenTest.php b/test/Http/RequestTokenTest.php index ff0b253..fcf9c2f 100644 --- a/test/Http/RequestTokenTest.php +++ b/test/Http/RequestTokenTest.php @@ -12,14 +12,19 @@ class RequestTokenTest extends TestCase { - protected $stubConsumer = null; - protected $stubConsumer2 = null; - protected $stubHttpUtility = null; + /** @var Consumer32874 */ + protected $stubConsumer; + + /** @var Consumer32874b */ + protected $stubConsumer2; + + /** @var HTTPUtility32874 */ + protected $stubHttpUtility; public function setup(): void { - $this->stubConsumer = new Consumer32874(); - $this->stubConsumer2 = new Consumer32874b(); + $this->stubConsumer = new Consumer32874(); + $this->stubConsumer2 = new Consumer32874b(); $this->stubHttpUtility = new HTTPUtility32874(); OAuth::setHttpClient(new HTTPClient32874()); } @@ -37,57 +42,56 @@ public function testConstructorSetsConsumerInstance() public function testConstructorSetsCustomServiceParameters() { - $request = new Http\RequestToken($this->stubConsumer, [1,2,3], $this->stubHttpUtility); - $this->assertEquals([1,2,3], $request->getParameters()); + $request = new Http\RequestToken($this->stubConsumer, [1, 2, 3], $this->stubHttpUtility); + $this->assertEquals([1, 2, 3], $request->getParameters()); } public function testAssembleParametersCorrectlyAggregatesOauthParameters() { - $request = new Http\RequestToken($this->stubConsumer, null, $this->stubHttpUtility); + $request = new Http\RequestToken($this->stubConsumer, null, $this->stubHttpUtility); $expectedParams = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', - 'oauth_timestamp' => '12345678901', + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + 'oauth_timestamp' => '12345678901', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_version' => '1.0', - 'oauth_callback' => 'http://www.example.com/local', - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c' + 'oauth_version' => '1.0', + 'oauth_callback' => 'http://www.example.com/local', + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c', ]; $this->assertEquals($expectedParams, $request->assembleParams()); } public function testAssembleParametersCorrectlyAggregatesOauthParametersIfCallbackUrlMissing() { - $request = new Http\RequestToken($this->stubConsumer2, null, $this->stubHttpUtility); + $request = new Http\RequestToken($this->stubConsumer2, null, $this->stubHttpUtility); $expectedParams = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', - 'oauth_timestamp' => '12345678901', + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + 'oauth_timestamp' => '12345678901', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_version' => '1.0', - 'oauth_callback' => 'oob', // out-of-band when missing callback - 1.0a - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c' - + 'oauth_version' => '1.0', + 'oauth_callback' => 'oob', // out-of-band when missing callback - 1.0a + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c', ]; $this->assertEquals($expectedParams, $request->assembleParams()); } public function testAssembleParametersCorrectlyAggregatesCustomParameters() { - $request = new Http\RequestToken($this->stubConsumer, [ + $request = new Http\RequestToken($this->stubConsumer, [ 'custom_param1' => 'foo', - 'custom_param2' => 'bar' + 'custom_param2' => 'bar', ], $this->stubHttpUtility); $expectedParams = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', - 'oauth_timestamp' => '12345678901', + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + 'oauth_timestamp' => '12345678901', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_version' => '1.0', - 'oauth_callback' => 'http://www.example.com/local', - 'custom_param1' => 'foo', - 'custom_param2' => 'bar', - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c' + 'oauth_version' => '1.0', + 'oauth_callback' => 'http://www.example.com/local', + 'custom_param1' => 'foo', + 'custom_param2' => 'bar', + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c', ]; $this->assertEquals($expectedParams, $request->assembleParams()); } @@ -95,23 +99,23 @@ public function testAssembleParametersCorrectlyAggregatesCustomParameters() public function testGetRequestSchemeHeaderClientSetsCorrectlyEncodedAuthorizationHeader() { $request = new Http\RequestToken($this->stubConsumer, null, $this->stubHttpUtility); - $params = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + $params = [ + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_timestamp' => '12345678901', - 'oauth_version' => '1.0', - 'oauth_callback_url' => 'http://www.example.com/local', - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c~', - 'custom_param1' => 'foo', - 'custom_param2' => 'bar' + 'oauth_timestamp' => '12345678901', + 'oauth_version' => '1.0', + 'oauth_callback_url' => 'http://www.example.com/local', + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c~', + 'custom_param1' => 'foo', + 'custom_param2' => 'bar', ]; - $client = $request->getRequestSchemeHeaderClient($params); + $client = $request->getRequestSchemeHeaderClient($params); $this->assertEquals( 'OAuth realm="",oauth_consumer_key="1234567890",oauth_nonce="e807f1fcf82d132f9b' - .'b018ca6738a19f",oauth_signature_method="HMAC-SHA1",oauth_timestamp="' - .'12345678901",oauth_version="1.0",oauth_callback_url=' - .'"http%3A%2F%2Fwww.example.com%2Flocal",oauth_signature="6fb42da0e32e07b61c9f0251fe627a9c~"', + . 'b018ca6738a19f",oauth_signature_method="HMAC-SHA1",oauth_timestamp="' + . '12345678901",oauth_version="1.0",oauth_callback_url=' + . '"http%3A%2F%2Fwww.example.com%2Flocal",oauth_signature="6fb42da0e32e07b61c9f0251fe627a9c~"', $client->getHeader('Authorization') ); } @@ -119,24 +123,24 @@ public function testGetRequestSchemeHeaderClientSetsCorrectlyEncodedAuthorizatio public function testGetRequestSchemePostBodyClientSetsCorrectlyEncodedRawData() { $request = new Http\RequestToken($this->stubConsumer, null, $this->stubHttpUtility); - $params = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + $params = [ + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_timestamp' => '12345678901', - 'oauth_version' => '1.0', - 'oauth_callback_url' => 'http://www.example.com/local', - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c~', - 'custom_param1' => 'foo', - 'custom_param2' => 'bar' + 'oauth_timestamp' => '12345678901', + 'oauth_version' => '1.0', + 'oauth_callback_url' => 'http://www.example.com/local', + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c~', + 'custom_param1' => 'foo', + 'custom_param2' => 'bar', ]; - $client = $request->getRequestSchemePostBodyClient($params); + $client = $request->getRequestSchemePostBodyClient($params); $this->assertEquals( 'oauth_consumer_key=1234567890&oauth_nonce=e807f1fcf82d132f9bb018c' - .'a6738a19f&oauth_signature_method=HMAC-SHA1&oauth_timestamp=12345' - .'678901&oauth_version=1.0&oauth_callback_url=http%3A%2F%2Fwww.example.com%2Flocal' - .'&oauth_signature=6fb42da0e32e07b61c9f0251fe627a9c~' - .'&custom_param1=foo&custom_param2=bar', + . 'a6738a19f&oauth_signature_method=HMAC-SHA1&oauth_timestamp=12345' + . '678901&oauth_version=1.0&oauth_callback_url=http%3A%2F%2Fwww.example.com%2Flocal' + . '&oauth_signature=6fb42da0e32e07b61c9f0251fe627a9c~' + . '&custom_param1=foo&custom_param2=bar', $client->getRawData() ); } @@ -144,24 +148,24 @@ public function testGetRequestSchemePostBodyClientSetsCorrectlyEncodedRawData() public function testGetRequestSchemeQueryStringClientSetsCorrectlyEncodedQueryString() { $request = new Http\RequestToken($this->stubConsumer, null, $this->stubHttpUtility); - $params = [ - 'oauth_consumer_key' => '1234567890', - 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', + $params = [ + 'oauth_consumer_key' => '1234567890', + 'oauth_nonce' => 'e807f1fcf82d132f9bb018ca6738a19f', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_timestamp' => '12345678901', - 'oauth_version' => '1.0', - 'oauth_callback_url' => 'http://www.example.com/local', - 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c', - 'custom_param1' => 'foo', - 'custom_param2' => 'bar' + 'oauth_timestamp' => '12345678901', + 'oauth_version' => '1.0', + 'oauth_callback_url' => 'http://www.example.com/local', + 'oauth_signature' => '6fb42da0e32e07b61c9f0251fe627a9c', + 'custom_param1' => 'foo', + 'custom_param2' => 'bar', ]; - $client = $request->getRequestSchemeQueryStringClient($params, 'http://www.example.com'); + $client = $request->getRequestSchemeQueryStringClient($params, 'http://www.example.com'); $this->assertEquals( 'oauth_consumer_key=1234567890&oauth_nonce=e807f1fcf82d132f9bb018c' - .'a6738a19f&oauth_signature_method=HMAC-SHA1&oauth_timestamp=12345' - .'678901&oauth_version=1.0&oauth_callback_url=http%3A%2F%2Fwww.example.com%2Flocal' - .'&oauth_signature=6fb42da0e32e07b61c9f0251fe627a9c' - .'&custom_param1=foo&custom_param2=bar', + . 'a6738a19f&oauth_signature_method=HMAC-SHA1&oauth_timestamp=12345' + . '678901&oauth_version=1.0&oauth_callback_url=http%3A%2F%2Fwww.example.com%2Flocal' + . '&oauth_signature=6fb42da0e32e07b61c9f0251fe627a9c' + . '&custom_param1=foo&custom_param2=bar', $client->getUri()->getQuery() ); } diff --git a/test/Http/UserAuthorizationTest.php b/test/Http/UserAuthorizationTest.php index 8b57173..5b4c304 100644 --- a/test/Http/UserAuthorizationTest.php +++ b/test/Http/UserAuthorizationTest.php @@ -8,7 +8,8 @@ class UserAuthorizationTest extends TestCase { - protected $stubConsumer = null; + /** @var Consumer34879 */ + protected $stubConsumer; public function setup(): void { @@ -23,17 +24,17 @@ public function testConstructorSetsConsumerInstance() public function testConstructorSetsCustomServiceParameters() { - $redirect = new Http\UserAuthorization($this->stubConsumer, [1,2,3]); - $this->assertEquals([1,2,3], $redirect->getParameters()); + $redirect = new Http\UserAuthorization($this->stubConsumer, [1, 2, 3]); + $this->assertEquals([1, 2, 3], $redirect->getParameters()); } public function testAssembleParametersReturnsUserAuthorizationParamArray() { $redirect = new Http\UserAuthorization($this->stubConsumer, ['foo ' => 'bar~']); $expected = [ - 'oauth_token' => '1234567890', + 'oauth_token' => '1234567890', 'oauth_callback' => 'http://www.example.com/local', - 'foo ' => 'bar~' + 'foo ' => 'bar~', ]; $this->assertEquals($expected, $redirect->assembleParams()); } diff --git a/test/Http/UtilityTest.php b/test/Http/UtilityTest.php index 038da2a..ef3cebf 100644 --- a/test/Http/UtilityTest.php +++ b/test/Http/UtilityTest.php @@ -5,10 +5,11 @@ use Laminas\OAuth\Http; use PHPUnit\Framework\TestCase; +use function chr; + class UtilityTest extends TestCase { - // see: http://wiki.oauth.net/TestCases (Parameter Encoding Tests) - + /** see: http://wiki.oauth.net/TestCases (Parameter Encoding Tests) */ public function testUrlEncodeCorrectlyEncodesAlnum() { $string = 'abcABC123'; diff --git a/test/OAuthTest.php b/test/OAuthTest.php index 4b3f5d2..398d980 100644 --- a/test/OAuthTest.php +++ b/test/OAuthTest.php @@ -50,7 +50,7 @@ public function testOauthClientPassingObjectConfigInConstructor() { $options = [ 'requestMethod' => 'GET', - 'siteUrl' => 'http://www.example.com' + 'siteUrl' => 'http://www.example.com', ]; $config = new Config($options); @@ -66,7 +66,7 @@ public function testOauthClientPassingArrayInConstructor() { $options = [ 'requestMethod' => 'GET', - 'siteUrl' => 'http://www.example.com' + 'siteUrl' => 'http://www.example.com', ]; $client = new OAuthClient($options); @@ -94,7 +94,7 @@ public function testOauthClientUsingGetRequestParametersForSignature() ->setTokenSecret('456'); $client = new OAuthClient([ - 'token' => $token + 'token' => $token, ], 'http://www.example.com'); $client->getRequest()->getQuery()->set('foo', 'bar'); $client->prepareOAuth(); @@ -124,7 +124,7 @@ public function testOauthClientUsingPostRequestParametersForSignature() ->setTokenSecret('456'); $client = new OAuthClient([ - 'token' => $token + 'token' => $token, ], 'http://www.example.com'); $client->getRequest()->getPost()->set('foo', 'bar'); $client->prepareOAuth(); @@ -154,7 +154,7 @@ public function testOauthClientUsingPostAndGetRequestParametersForSignature() ->setTokenSecret('456'); $client = new OAuthClient([ - 'token' => $token + 'token' => $token, ], 'http://www.example.com'); $client->getRequest()->getPost()->set('foo', 'bar'); $client->getRequest()->getQuery()->set('baz', 'bat'); @@ -165,7 +165,6 @@ public function testOauthClientUsingPostAndGetRequestParametersForSignature() $this->assertEquals($header, $client->getHeader('Authorization')); } - public function testOAuthClientDoesntOverrideExistingHeaders() { $mock = $this->getMockBuilder(Utility::class) @@ -186,11 +185,11 @@ public function testOAuthClientDoesntOverrideExistingHeaders() ->setTokenSecret('456'); $client = new OAuthClient([ - 'token' => $token + 'token' => $token, ], 'http://www.example.com'); $dummyHeader = Header\ContentType::fromString('Content-Type: application/octet-stream'); - $headers = $client->getRequest()->getHeaders(); + $headers = $client->getRequest()->getHeaders(); $headers->addHeaders([$dummyHeader]); $client->prepareOAuth(); diff --git a/test/Signature/AbstractTest.php b/test/Signature/AbstractTest.php index 4c7f326..a112b66 100644 --- a/test/Signature/AbstractTest.php +++ b/test/Signature/AbstractTest.php @@ -10,42 +10,42 @@ class AbstractTest extends TestCase public function testNormaliseHttpBaseSignatureUrl() { $sign = new Signature\Plaintext('foo'); - $url = 'HTTP://WWW.EXAMPLE.COM:80/REQUEST'; + $url = 'HTTP://WWW.EXAMPLE.COM:80/REQUEST'; $this->assertEquals('http://www.example.com/REQUEST', $sign->normaliseBaseSignatureUrl($url)); } public function testNormaliseHttpsBaseSignatureUrl() { $sign = new Signature\Plaintext('foo'); - $url = 'HTTPS://WWW.EXAMPLE.COM:443/REQUEST'; + $url = 'HTTPS://WWW.EXAMPLE.COM:443/REQUEST'; $this->assertEquals('https://www.example.com/REQUEST', $sign->normaliseBaseSignatureUrl($url)); } public function testNormaliseHttpPortBaseSignatureUrl() { $sign = new Signature\Plaintext('foo'); - $url = 'HTTP://WWW.EXAMPLE.COM:443/REQUEST'; + $url = 'HTTP://WWW.EXAMPLE.COM:443/REQUEST'; $this->assertEquals('http://www.example.com:443/REQUEST', $sign->normaliseBaseSignatureUrl($url)); } public function testNormaliseHttpsPortBaseSignatureUrl() { $sign = new Signature\Plaintext('foo'); - $url = 'HTTPS://WWW.EXAMPLE.COM:80/REQUEST'; + $url = 'HTTPS://WWW.EXAMPLE.COM:80/REQUEST'; $this->assertEquals('https://www.example.com:80/REQUEST', $sign->normaliseBaseSignatureUrl($url)); } public function testNormaliseHttpsRemovesFragmentFromBaseSignatureUrl() { $sign = new Signature\Plaintext('foo'); - $url = 'https://www.example.com/request#foo'; + $url = 'https://www.example.com/request#foo'; $this->assertEquals('https://www.example.com/request', $sign->normaliseBaseSignatureUrl($url)); } public function testNormaliseHttpsRemovesQueryFromBaseSignatureUrl() { $sign = new Signature\Plaintext('foo'); - $url = 'https://www.example.com/request?foo=bar'; + $url = 'https://www.example.com/request?foo=bar'; $this->assertEquals('https://www.example.com/request', $sign->normaliseBaseSignatureUrl($url)); } } diff --git a/test/Signature/HMACTest.php b/test/Signature/HMACTest.php index d08bf92..8ea0178 100644 --- a/test/Signature/HMACTest.php +++ b/test/Signature/HMACTest.php @@ -9,13 +9,13 @@ class HMACTest extends TestCase { public function testSignatureWithoutAccessSecretIsHashedWithConsumerSecret() { - $params = [ - 'oauth_version' => '1.0', - 'oauth_consumer_key' => 'dpf43f3p2l4k3l03', + $params = [ + 'oauth_version' => '1.0', + 'oauth_consumer_key' => 'dpf43f3p2l4k3l03', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_timestamp' => '1191242090', - 'oauth_nonce' => 'hsu94j3884jdopsl', - 'oauth_version' => '1.0' + 'oauth_timestamp' => '1191242090', + 'oauth_nonce' => 'hsu94j3884jdopsl', + 'oauth_version' => '1.0', ]; $signature = new Signature\Hmac('1234567890', null, 'SHA1'); $this->assertEquals('XYkaERjLVjp2yP/klDCGQ+hZ2So=', $signature->sign($params)); @@ -23,13 +23,13 @@ public function testSignatureWithoutAccessSecretIsHashedWithConsumerSecret() public function testSignatureWithAccessSecretIsHashedWithConsumerAndAccessSecret() { - $params = [ - 'oauth_version' => '1.0', - 'oauth_consumer_key' => 'dpf43f3p2l4k3l03', + $params = [ + 'oauth_version' => '1.0', + 'oauth_consumer_key' => 'dpf43f3p2l4k3l03', 'oauth_signature_method' => 'HMAC-SHA1', - 'oauth_timestamp' => '1191242090', - 'oauth_nonce' => 'hsu94j3884jdopsl', - 'oauth_version' => '1.0' + 'oauth_timestamp' => '1191242090', + 'oauth_nonce' => 'hsu94j3884jdopsl', + 'oauth_version' => '1.0', ]; $signature = new Signature\Hmac('1234567890', '0987654321', 'SHA1'); $this->assertEquals('b0J6H0jCEo+tvzVJy2G615sM6/M=', $signature->sign($params)); diff --git a/test/Signature/PlaintextTest.php b/test/Signature/PlaintextTest.php index 19cff23..078e9e9 100644 --- a/test/Signature/PlaintextTest.php +++ b/test/Signature/PlaintextTest.php @@ -9,13 +9,13 @@ class PlaintextTest extends TestCase { public function testSignatureWithoutAccessSecretIsOnlyConsumerSecretString() { - $params = [ - 'oauth_version' => '1.0', - 'oauth_consumer_key' => 'dpf43f3p2l4k3l03', + $params = [ + 'oauth_version' => '1.0', + 'oauth_consumer_key' => 'dpf43f3p2l4k3l03', 'oauth_signature_method' => 'PLAINTEXT', - 'oauth_timestamp' => '1191242090', - 'oauth_nonce' => 'hsu94j3884jdopsl', - 'oauth_version' => '1.0' + 'oauth_timestamp' => '1191242090', + 'oauth_nonce' => 'hsu94j3884jdopsl', + 'oauth_version' => '1.0', ]; $signature = new Signature\Plaintext('1234567890'); $this->assertEquals('1234567890&', $signature->sign($params)); @@ -23,13 +23,13 @@ public function testSignatureWithoutAccessSecretIsOnlyConsumerSecretString() public function testSignatureWithAccessSecretIsConsumerAndAccessSecretStringsConcatWithAmp() { - $params = [ - 'oauth_version' => '1.0', - 'oauth_consumer_key' => 'dpf43f3p2l4k3l03', + $params = [ + 'oauth_version' => '1.0', + 'oauth_consumer_key' => 'dpf43f3p2l4k3l03', 'oauth_signature_method' => 'PLAINTEXT', - 'oauth_timestamp' => '1191242090', - 'oauth_nonce' => 'hsu94j3884jdopsl', - 'oauth_version' => '1.0' + 'oauth_timestamp' => '1191242090', + 'oauth_nonce' => 'hsu94j3884jdopsl', + 'oauth_version' => '1.0', ]; $signature = new Signature\Plaintext('1234567890', '0987654321'); $this->assertEquals('1234567890&0987654321', $signature->sign($params)); diff --git a/test/TestAsset/AccessToken48231.php b/test/TestAsset/AccessToken48231.php index a4315ad..2a24ee8 100644 --- a/test/TestAsset/AccessToken48231.php +++ b/test/TestAsset/AccessToken48231.php @@ -11,10 +11,13 @@ public function __construct() { } - public function execute(array $params = null) + /** + * @param array|null $params + * @return Access + */ + public function execute(?array $params = null) { - $return = new Access(); - return $return; + return new Access(); } public function setParams(array $customServiceParameters) diff --git a/test/TestAsset/Config90244.php b/test/TestAsset/Config90244.php index da0f468..cd15437 100644 --- a/test/TestAsset/Config90244.php +++ b/test/TestAsset/Config90244.php @@ -7,34 +7,34 @@ class Config90244 extends StandardConfig { - public function getConsumerKey() + public function getConsumerKey(): string { return '1234567890'; } - public function getSignatureMethod() + public function getSignatureMethod(): string { return 'HMAC-SHA1'; } - public function getVersion() + public function getVersion(): string { return '1.0'; } - public function getRequestTokenUrl() + public function getRequestTokenUrl(): string { return 'http://www.example.com/request'; } - public function getToken() + public function getToken(): Access { $token = new Access(); $token->setToken('abcde'); return $token; } - public function getRequestMethod() + public function getRequestMethod(): string { return 'POST'; } diff --git a/test/TestAsset/Consumer32874.php b/test/TestAsset/Consumer32874.php index 91ffe2b..e811e5a 100644 --- a/test/TestAsset/Consumer32874.php +++ b/test/TestAsset/Consumer32874.php @@ -6,27 +6,27 @@ class Consumer32874 extends Consumer { - public function getConsumerKey() + public function getConsumerKey(): string { return '1234567890'; } - public function getSignatureMethod() + public function getSignatureMethod(): string { return 'HMAC-SHA1'; } - public function getVersion() + public function getVersion(): string { return '1.0'; } - public function getRequestTokenUrl() + public function getRequestTokenUrl(): string { return 'http://www.example.com/request'; } - public function getCallbackUrl() + public function getCallbackUrl(): string { return 'http://www.example.com/local'; } diff --git a/test/TestAsset/Consumer32874b.php b/test/TestAsset/Consumer32874b.php index 18919ba..1a45dfb 100644 --- a/test/TestAsset/Consumer32874b.php +++ b/test/TestAsset/Consumer32874b.php @@ -6,26 +6,29 @@ class Consumer32874b extends Consumer { - public function getConsumerKey() + public function getConsumerKey(): string { return '1234567890'; } - public function getSignatureMethod() + public function getSignatureMethod(): string { return 'HMAC-SHA1'; } - public function getVersion() + public function getVersion(): string { return '1.0'; } - public function getRequestTokenUrl() + public function getRequestTokenUrl(): string { return 'http://www.example.com/request'; } + /** + * @return null + */ public function getCallbackUrl() { return null; diff --git a/test/TestAsset/Consumer34879.php b/test/TestAsset/Consumer34879.php index 2447d1c..56d89f4 100644 --- a/test/TestAsset/Consumer34879.php +++ b/test/TestAsset/Consumer34879.php @@ -6,19 +6,18 @@ class Consumer34879 extends Consumer { - public function getUserAuthorizationUrl() + public function getUserAuthorizationUrl(): string { return 'http://www.example.com/authorize'; } - public function getCallbackUrl() + public function getCallbackUrl(): string { return 'http://www.example.com/local'; } - public function getLastRequestToken() + public function getLastRequestToken(): Token34879 { - $r = new Token34879; - return $r; + return new Token34879(); } } diff --git a/test/TestAsset/Consumer39745.php b/test/TestAsset/Consumer39745.php index f1b8839..cad2f61 100644 --- a/test/TestAsset/Consumer39745.php +++ b/test/TestAsset/Consumer39745.php @@ -6,29 +6,28 @@ class Consumer39745 extends Consumer { - public function getConsumerKey() + public function getConsumerKey(): string { return '1234567890'; } - public function getSignatureMethod() + public function getSignatureMethod(): string { return 'HMAC-SHA1'; } - public function getVersion() + public function getVersion(): string { return '1.0'; } - public function getAccessTokenUrl() + public function getAccessTokenUrl(): string { return 'http://www.example.com/access'; } - public function getLastRequestToken() + public function getLastRequestToken(): RequestToken39745 { - $return = new RequestToken39745(); - return $return; + return new RequestToken39745(); } } diff --git a/test/TestAsset/Consumer48231.php b/test/TestAsset/Consumer48231.php index 3155eba..3b40b60 100644 --- a/test/TestAsset/Consumer48231.php +++ b/test/TestAsset/Consumer48231.php @@ -15,7 +15,7 @@ public function __construct(array $options = []) parent::__construct($options); } - public function getCallbackUrl() + public function getCallbackUrl(): string { return 'http://www.example.com/local'; } diff --git a/test/TestAsset/HTTPClient32874.php b/test/TestAsset/HTTPClient32874.php index fb986cc..096107f 100644 --- a/test/TestAsset/HTTPClient32874.php +++ b/test/TestAsset/HTTPClient32874.php @@ -6,6 +6,9 @@ class HTTPClient32874 extends Client { + /** + * @return mixed|string + */ public function getRawData() { return $this->getRequest()->getContent(); diff --git a/test/TestAsset/HTTPUtility32874.php b/test/TestAsset/HTTPUtility32874.php index 7d8becc..842f2a9 100644 --- a/test/TestAsset/HTTPUtility32874.php +++ b/test/TestAsset/HTTPUtility32874.php @@ -4,22 +4,32 @@ use Laminas\OAuth\Http\Utility; +use function md5; + class HTTPUtility32874 extends Utility { public function __construct() { } - public function generateNonce() + public function generateNonce(): string { return md5('1234567890'); } - public function generateTimestamp() + public function generateTimestamp(): string { return '12345678901'; } + /** + * @param string $signatureMethod + * @param string $consumerSecret + * @param string $accessTokenSecret + * @param string $method + * @param string $url + * @return string + */ public function sign( array $params, $signatureMethod, diff --git a/test/TestAsset/HTTPUtility39745.php b/test/TestAsset/HTTPUtility39745.php index 020bb3e..c47a4d9 100644 --- a/test/TestAsset/HTTPUtility39745.php +++ b/test/TestAsset/HTTPUtility39745.php @@ -4,22 +4,32 @@ use Laminas\OAuth\Http\Utility; +use function md5; + class HTTPUtility39745 extends Utility { public function __construct() { } - public function generateNonce() + public function generateNonce(): string { return md5('1234567890'); } - public function generateTimestamp() + public function generateTimestamp(): string { return '12345678901'; } + /** + * @param string $signatureMethod + * @param string $consumerSecret + * @param string $accessTokenSecret + * @param string $method + * @param string $url + * @return string + */ public function sign( array $params, $signatureMethod, diff --git a/test/TestAsset/HTTPUtility90244.php b/test/TestAsset/HTTPUtility90244.php index c54af83..0dc3ee9 100644 --- a/test/TestAsset/HTTPUtility90244.php +++ b/test/TestAsset/HTTPUtility90244.php @@ -4,22 +4,32 @@ use Laminas\OAuth\Http\Utility; +use function md5; + class HTTPUtility90244 extends Utility { public function __construct() { } - public function generateNonce() + public function generateNonce(): string { return md5('1234567890'); } - public function generateTimestamp() + public function generateTimestamp(): string { return '12345678901'; } + /** + * @param string $signatureMethod + * @param string $consumerSecret + * @param string $accessTokenSecret + * @param string $method + * @param string $url + * @return string + */ public function sign( array $params, $signatureMethod, diff --git a/test/TestAsset/RequestToken39745.php b/test/TestAsset/RequestToken39745.php index ebc1110..303ce08 100644 --- a/test/TestAsset/RequestToken39745.php +++ b/test/TestAsset/RequestToken39745.php @@ -6,7 +6,7 @@ class RequestToken39745 extends Request { - public function getToken() + public function getToken(): string { return '0987654321'; } diff --git a/test/TestAsset/RequestToken48231.php b/test/TestAsset/RequestToken48231.php index 7201c3f..4c4b1a7 100644 --- a/test/TestAsset/RequestToken48231.php +++ b/test/TestAsset/RequestToken48231.php @@ -11,10 +11,12 @@ public function __construct() { } - public function execute(array $params = null) + /** + * @return Request + */ + public function execute(?array $params = null) { - $return = new Request(); - return $return; + return new Request(); } public function setParams(array $customServiceParameters) diff --git a/test/TestAsset/Token34879.php b/test/TestAsset/Token34879.php index e677e6c..e7e5ef9 100644 --- a/test/TestAsset/Token34879.php +++ b/test/TestAsset/Token34879.php @@ -4,7 +4,7 @@ class Token34879 { - public function getToken() + public function getToken(): string { return '1234567890'; } diff --git a/test/Token/AccessTest.php b/test/Token/AccessTest.php index 2e9ebf6..43e8ddc 100644 --- a/test/Token/AccessTest.php +++ b/test/Token/AccessTest.php @@ -13,14 +13,14 @@ class AccessTest extends TestCase public function testConstructorSetsResponseObject() { $response = new HTTPResponse(200, []); - $token = new AccessToken($response); - $this->assertInstanceOf('Laminas\\Http\\Response', $token->getResponse()); + $token = new AccessToken($response); + $this->assertInstanceOf(HTTPResponse::class, $token->getResponse()); } public function testConstructorParsesRequestTokenFromResponseBody() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; - $response = new HTTPResponse; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $response = new HTTPResponse(); $response->setContent($body) ->setStatusCode(200); @@ -30,8 +30,8 @@ public function testConstructorParsesRequestTokenFromResponseBody() public function testConstructorParsesRequestTokenSecretFromResponseBody() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; - $response = new HTTPResponse; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $response = new HTTPResponse(); $response->setContent($body) ->setStatusCode(200); @@ -41,8 +41,8 @@ public function testConstructorParsesRequestTokenSecretFromResponseBody() public function testPropertyAccessWorks() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri&foo=bar'; - $response = new HTTPResponse; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri&foo=bar'; + $response = new HTTPResponse(); $response->setContent($body) ->setStatusCode(200); @@ -52,7 +52,7 @@ public function testPropertyAccessWorks() public function testTokenCastsToEncodedResponseBody() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; $token = new AccessToken(); $token->setToken('jZaee4GF52O3lUb9'); $token->setTokenSecret('J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'); @@ -61,7 +61,7 @@ public function testTokenCastsToEncodedResponseBody() public function testToStringReturnsEncodedResponseBody() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; $token = new AccessToken(); $token->setToken('jZaee4GF52O3lUb9'); $token->setTokenSecret('J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'); @@ -70,8 +70,8 @@ public function testToStringReturnsEncodedResponseBody() public function testIsValidDetectsBadResponse() { - $body = 'oauthtoken=jZaee4GF52O3lUb9&oauthtokensecret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; - $response = new HTTPResponse; + $body = 'oauthtoken=jZaee4GF52O3lUb9&oauthtokensecret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $response = new HTTPResponse(); $response->setContent($body) ->setStatusCode(200); @@ -81,8 +81,8 @@ public function testIsValidDetectsBadResponse() public function testIsValidDetectsGoodResponse() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; - $response = new HTTPResponse; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $response = new HTTPResponse(); $response->setContent($body) ->setStatusCode(200); diff --git a/test/Token/AuthorizedRequestTest.php b/test/Token/AuthorizedRequestTest.php index d14a4a6..11b6efe 100644 --- a/test/Token/AuthorizedRequestTest.php +++ b/test/Token/AuthorizedRequestTest.php @@ -9,15 +9,15 @@ class AuthorizedRequestTest extends TestCase { public function testConstructorSetsInputData() { - $data = ['foo' => 'bar']; + $data = ['foo' => 'bar']; $token = new AuthorizedRequestToken($data); $this->assertEquals($data, $token->getData()); } public function testConstructorParsesAccessTokenFromInputData() { - $data = [ - 'oauth_token' => 'jZaee4GF52O3lUb9' + $data = [ + 'oauth_token' => 'jZaee4GF52O3lUb9', ]; $token = new AuthorizedRequestToken($data); $this->assertEquals('jZaee4GF52O3lUb9', $token->getToken()); @@ -25,8 +25,8 @@ public function testConstructorParsesAccessTokenFromInputData() public function testPropertyAccessWorks() { - $data = [ - 'oauth_token' => 'jZaee4GF52O3lUb9' + $data = [ + 'oauth_token' => 'jZaee4GF52O3lUb9', ]; $token = new AuthorizedRequestToken($data); $this->assertEquals('jZaee4GF52O3lUb9', $token->oauth_token); @@ -35,7 +35,7 @@ public function testPropertyAccessWorks() public function testTokenCastsToEncodedQueryString() { $queryString = 'oauth_token=jZaee4GF52O3lUb9&foo%20=bar~'; - $token = new AuthorizedRequestToken(); + $token = new AuthorizedRequestToken(); $token->setToken('jZaee4GF52O3lUb9'); $token->setParam('foo ', 'bar~'); $this->assertEquals($queryString, (string) $token); @@ -44,15 +44,15 @@ public function testTokenCastsToEncodedQueryString() public function testToStringReturnsEncodedQueryString() { $queryString = 'oauth_token=jZaee4GF52O3lUb9'; - $token = new AuthorizedRequestToken(); + $token = new AuthorizedRequestToken(); $token->setToken('jZaee4GF52O3lUb9'); $this->assertEquals($queryString, $token->toString()); } public function testIsValidDetectsBadResponse() { - $data = [ - 'missing_oauth_token' => 'jZaee4GF52O3lUb9' + $data = [ + 'missing_oauth_token' => 'jZaee4GF52O3lUb9', ]; $token = new AuthorizedRequestToken($data); $this->assertFalse($token->isValid()); @@ -60,9 +60,9 @@ public function testIsValidDetectsBadResponse() public function testIsValidDetectsGoodResponse() { - $data = [ + $data = [ 'oauth_token' => 'jZaee4GF52O3lUb9', - 'foo' => 'bar' + 'foo' => 'bar', ]; $token = new AuthorizedRequestToken($data); $this->assertTrue($token->isValid()); diff --git a/test/Token/RequestTest.php b/test/Token/RequestTest.php index b08c876..1835a1f 100644 --- a/test/Token/RequestTest.php +++ b/test/Token/RequestTest.php @@ -11,14 +11,14 @@ class RequestTest extends TestCase public function testConstructorSetsResponseObject() { $response = new HTTPResponse(200, []); - $token = new RequestToken($response); + $token = new RequestToken($response); $this->assertInstanceOf(HTTPResponse::class, $token->getResponse()); } public function testConstructorParsesRequestTokenFromResponseBody() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; - $response = new HTTPResponse; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $response = new HTTPResponse(); $response->setContent($body) ->setStatusCode(200); @@ -30,7 +30,7 @@ public function testConstructorParsesRequestTokenSecretFromResponseBody() { $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; - $response = new HTTPResponse; + $response = new HTTPResponse(); $response->setContent($body) ->setStatusCode(200); @@ -40,8 +40,8 @@ public function testConstructorParsesRequestTokenSecretFromResponseBody() public function testPropertyAccessWorks() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri&foo=bar'; - $response = new HTTPResponse; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri&foo=bar'; + $response = new HTTPResponse(); $response->setContent($body) ->setStatusCode(200); @@ -51,7 +51,7 @@ public function testPropertyAccessWorks() public function testTokenCastsToEncodedResponseBody() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; $token = new RequestToken(); $token->setToken('jZaee4GF52O3lUb9'); $token->setTokenSecret('J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'); @@ -60,7 +60,7 @@ public function testTokenCastsToEncodedResponseBody() public function testToStringReturnsEncodedResponseBody() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; $token = new RequestToken(); $token->setToken('jZaee4GF52O3lUb9'); $token->setTokenSecret('J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'); @@ -69,16 +69,16 @@ public function testToStringReturnsEncodedResponseBody() public function testIsValidDetectsBadResponse() { - $body = 'oauthtoken=jZaee4GF52O3lUb9&oauthtokensecret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $body = 'oauthtoken=jZaee4GF52O3lUb9&oauthtokensecret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; $response = new HTTPResponse(200, [], $body); - $token = new RequestToken($response); + $token = new RequestToken($response); $this->assertFalse($token->isValid()); } public function testIsValidDetectsGoodResponse() { - $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; - $response = new HTTPResponse; + $body = 'oauth_token=jZaee4GF52O3lUb9&oauth_token_secret=J4Ms4n8sxjYc0A8K0KOQFCTL0EwUQTri'; + $response = new HTTPResponse(); $response->setContent($body) ->setStatusCode(200);