diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2e2f514 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +/test export-ignore +phpunit.xml export-ignore +README.md export-ignore +.github export-ignore \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..cf73617 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "composer" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e2f7ce6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,40 @@ +name: Tests + +on: + pull_request: + push: + branches: [master, main] + +jobs: + test: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + php: [8.0, 8.1] + stability: [prefer-lowest, prefer-stable] + + name: PHP ${{ matrix.php }} - ${{ matrix.stability }} Test + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pdo + ini-values: error_reporting=E_ALL + tools: composer:v2 + coverage: none + + - name: Install dependencies + uses: nick-invision/retry@v2 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress + + - name: Run tests + run: ./vendor/bin/phpunit --verbose \ No newline at end of file diff --git a/.gitignore b/.gitignore index c8bdbea..afba6a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,12 @@ # CODE EDITORS .idea +.vscode # COMPOSER vendor/ # OS FILES +composer.lock .DS_Store Desktop.ini ._* diff --git a/README.md b/README.md index e7b51e4..9a327ad 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Requirements -PHP 5.4.0 and later +PHP 8.0.0 and later ## Installation & Usage ### Composer @@ -12,14 +12,6 @@ To install the bindings via [Composer](http://getcomposer.org/) run: composer require autodesk/core ``` -### Manual Installation - -Download the files and include `autoload.php`: - -```php -require_once('/path/to/AutodeskCore/autoload.php'); -``` - ## Tests To run the unit tests: diff --git a/composer.json b/composer.json index defc14c..b57e8c7 100644 --- a/composer.json +++ b/composer.json @@ -15,15 +15,15 @@ } ], "require": { - "php": ">=5.4", + "php": ">=8.0", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "guzzlehttp/guzzle": "^6.2" + "guzzlehttp/guzzle": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~5.0", - "symfony/var-dumper": "^3.2" + "phpunit/phpunit": "^9.0", + "symfony/var-dumper": "^6.0" }, "autoload": { "psr-4": { @@ -33,7 +33,7 @@ }, "autoload-dev": { "psr-4": { - "Autodesk\\Core\\": "test/" + "Autodesk\\Core\\Test\\": "test/" } } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 91bb56e..0000000 --- a/composer.lock +++ /dev/null @@ -1,1687 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "217927ca72bce61a9d188510eee61d2b", - "packages": [ - { - "name": "guzzlehttp/guzzle", - "version": "6.2.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", - "shasum": "" - }, - "require": { - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4", - "php": ">=5.5" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.0", - "psr/log": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.2-dev" - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2017-02-28T22:50:30+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "v1.3.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "shasum": "" - }, - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "time": "2016-12-20T10:07:11+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/0d6c7ca039329247e4f0f8f8f6506810e8248855", - "reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "request", - "response", - "stream", - "uri", - "url" - ], - "time": "2017-02-27T10:51:17+00:00" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06T14:39:51+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14T21:17:01+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2017-01-26T22:05:40+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2015-12-27T11:43:31+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.2.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2016-11-25T06:54:22+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.6.2", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0|^2.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.0", - "phpunit/phpunit": "^4.8 || ^5.6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2016-11-21T14:58:47+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "4.0.7", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "09e2277d14ea467e5a984010f501343ef29ffc69" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/09e2277d14ea467e5a984010f501343ef29ffc69", - "reference": "09e2277d14ea467e5a984010f501343ef29ffc69", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" - }, - "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" - }, - "suggest": { - "ext-xdebug": "^2.5.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2017-03-01T09:12:17+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2016-10-03T07:40:28+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.11", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-02-27T10:12:30+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "5.7.14", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "4906b8faf23e42612182fd212eb6f4c0f2954b57" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4906b8faf23e42612182fd212eb6f4c0f2954b57", - "reference": "4906b8faf23e42612182fd212eb6f4c0f2954b57", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "~1.2", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0.3|~2.0", - "symfony/yaml": "~2.1|~3.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.7.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-02-19T07:22:16+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2016-12-08T20:27:08+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "phpunit/phpunit": "~5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13T06:45:14+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2015-12-08T07:14:41+00:00" - }, - { - "name": "sebastian/environment", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-11-26T07:53:53+00:00" - }, - { - "name": "sebastian/exporter", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-11-19T08:54:04+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", - "shasum": "" - }, - "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2016-11-14T01:06:16+00:00" - }, - { - "name": "symfony/var-dumper", - "version": "v3.2.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "cb50260b674ee1c2d4ab49f2395a42e0b4681e20" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/cb50260b674ee1c2d4ab49f2395a42e0b4681e20", - "reference": "cb50260b674ee1c2d4ab49f2395a42e0b4681e20", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "require-dev": { - "twig/twig": "~1.20|~2.0" - }, - "suggest": { - "ext-symfony_debug": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "files": [ - "Resources/functions/dump.php" - ], - "psr-4": { - "Symfony\\Component\\VarDumper\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony mechanism for exploring and dumping PHP variables", - "homepage": "https://symfony.com", - "keywords": [ - "debug", - "dump" - ], - "time": "2017-02-16T22:46:52+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.2.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/9724c684646fcb5387d579b4bfaa63ee0b0c64c8", - "reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-02-16T22:46:52+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2016-11-23T20:04:58+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.4", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*" - }, - "platform-dev": [] -} diff --git a/lib/Auth/Configuration.php b/lib/Auth/Configuration.php index d63c473..a55f90b 100644 --- a/lib/Auth/Configuration.php +++ b/lib/Auth/Configuration.php @@ -7,40 +7,36 @@ class Configuration /** * @var Configuration|null */ - private static $defaultConfiguration = null; + private static Configuration|null $defaultConfiguration = null; /** - * @var string + * @var string|null */ - protected $clientId; + protected string|null $clientId = null; /** - * @var string + * @var string|null */ - protected $clientSecret; + protected string|null $clientSecret = null; /** * @var string */ - protected $redirectUrl; + protected string $redirectUrl; /** * @var string */ - protected $host = 'https://developer.api.autodesk.com'; + protected string $host = 'https://developer.api.autodesk.com'; /** * Gets the default configuration instance * * @return Configuration */ - public static function getDefaultConfiguration() + public static function getDefaultConfiguration(): Configuration { - // @codeCoverageIgnoreStart - if (self::$defaultConfiguration === null) { - self::$defaultConfiguration = new Configuration(); - } - // @codeCoverageIgnoreEnd + self::$defaultConfiguration = self::$defaultConfiguration ?? new self; return self::$defaultConfiguration; } @@ -52,15 +48,15 @@ public static function getDefaultConfiguration() * * @return void */ - public static function setDefaultConfiguration(Configuration $config) + public static function setDefaultConfiguration(Configuration $config): void { self::$defaultConfiguration = $config; } /** - * @return string + * @return string|null */ - public function getClientId() + public function getClientId(): string|null { return $this->clientId; } @@ -69,7 +65,7 @@ public function getClientId() * @param string $clientId * @return Configuration */ - public function setClientId($clientId) + public function setClientId(string $clientId): self { $this->clientId = $clientId; @@ -77,9 +73,9 @@ public function setClientId($clientId) } /** - * @return string + * @return string|null */ - public function getClientSecret() + public function getClientSecret(): string|null { return $this->clientSecret; } @@ -88,7 +84,7 @@ public function getClientSecret() * @param string $clientSecret * @return Configuration */ - public function setClientSecret($clientSecret) + public function setClientSecret(string $clientSecret): self { $this->clientSecret = $clientSecret; @@ -98,7 +94,7 @@ public function setClientSecret($clientSecret) /** * @return string */ - public function getRedirectUrl() + public function getRedirectUrl(): string { return $this->redirectUrl; } @@ -107,7 +103,7 @@ public function getRedirectUrl() * @param string $redirectUrl * @return Configuration */ - public function setRedirectUrl($redirectUrl) + public function setRedirectUrl(string $redirectUrl): self { $this->redirectUrl = $redirectUrl; @@ -117,7 +113,7 @@ public function setRedirectUrl($redirectUrl) /** * @return string */ - public function getHost() + public function getHost(): string { return $this->host; } @@ -125,7 +121,7 @@ public function getHost() /** * @param string $host */ - public function setHost($host) + public function setHost(string $host): void { $this->host = $host; } diff --git a/lib/Auth/OAuth2/AbstractOAuth2.php b/lib/Auth/OAuth2/AbstractOAuth2.php index 853f851..8412006 100644 --- a/lib/Auth/OAuth2/AbstractOAuth2.php +++ b/lib/Auth/OAuth2/AbstractOAuth2.php @@ -13,60 +13,50 @@ abstract class AbstractOAuth2 /** * @var TokenFetcher */ - private $tokenFetcher; + private TokenFetcher $tokenFetcher; /** * @var ScopeValidator */ - private $scopeValidator; + private ScopeValidator $scopeValidator; /** - * @var string + * @var string|null */ - private $token; + private string|null $token = null; /** * @var int */ - private $expiresIn; + private int $expiresIn; /** * @var array */ - private $scopes = []; + private array $scopes = []; /** - * @param TokenFetcher $tokenFetcher - * @param ScopeValidator $scopeValidator + * @param TokenFetcher|null $tokenFetcher + * @param ScopeValidator|null $scopeValidator */ public function __construct(TokenFetcher $tokenFetcher = null, ScopeValidator $scopeValidator = null) { - // @codeCoverageIgnoreStart - if ($tokenFetcher === null) { - $tokenFetcher = new TokenFetcher(); - } - - if ($scopeValidator === null) { - $scopeValidator = new ScopeValidator(); - } - // @codeCoverageIgnoreEnd - - $this->tokenFetcher = $tokenFetcher; - $this->scopeValidator = $scopeValidator; + $this->tokenFetcher = $tokenFetcher ?? new TokenFetcher; + $this->scopeValidator = $scopeValidator ?? new ScopeValidator; } /** * @return string */ - public function getAccessToken() + public function getAccessToken(): string { return $this->token; } /** - * @param $token + * @param string|null $token */ - public function setAccessToken($token) + public function setAccessToken(string|null $token): void { $this->token = $token; } @@ -74,7 +64,7 @@ public function setAccessToken($token) /** * @return int */ - public function getExpiresIn() + public function getExpiresIn(): int { return $this->expiresIn; } @@ -82,7 +72,7 @@ public function getExpiresIn() /** * @return bool */ - public function hasAccessToken() + public function hasAccessToken(): bool { return $this->token !== null; } @@ -91,7 +81,7 @@ public function hasAccessToken() * @param $name * @throws LogicException */ - public function addScope($name) + public function addScope($name): void { if ($this->isScopeAlreadyExists($name)) { return; @@ -107,7 +97,7 @@ public function addScope($name) /** * @param array $scopes */ - public function addScopes(array $scopes) + public function addScopes(array $scopes): void { foreach ($scopes as $scope) { $this->addScope($scope); @@ -117,7 +107,7 @@ public function addScopes(array $scopes) /** * @param array $scopes */ - public function setScopes(array $scopes) + public function setScopes(array $scopes): void { $this->scopes = []; $this->addScopes($scopes); @@ -126,19 +116,19 @@ public function setScopes(array $scopes) /** * @return array */ - public function getScopes() + public function getScopes(): array { return $this->scopes; } /** - * @param $url - * @param $grantType + * @param string $url + * @param string $grantType * @param array $additionalParams * @return array * @throws RuntimeException */ - protected function fetchAccessToken($url, $grantType, array $additionalParams = []) + protected function fetchAccessToken(string $url, string $grantType, array $additionalParams = []): array { $response = $this->tokenFetcher->fetch($url, $grantType, $this->scopes, $additionalParams); @@ -157,11 +147,11 @@ protected function fetchAccessToken($url, $grantType, array $additionalParams = } /** - * @param $name + * @param string $name * @return bool */ - private function isScopeAlreadyExists($name) + private function isScopeAlreadyExists(string $name): bool { - return in_array($name, $this->scopes); + return in_array($name, $this->scopes, true); } } \ No newline at end of file diff --git a/lib/Auth/OAuth2/ThreeLeggedAuth.php b/lib/Auth/OAuth2/ThreeLeggedAuth.php index 62cc584..9dedbe0 100644 --- a/lib/Auth/OAuth2/ThreeLeggedAuth.php +++ b/lib/Auth/OAuth2/ThreeLeggedAuth.php @@ -12,12 +12,12 @@ class ThreeLeggedAuth extends AbstractOAuth2 /** * @var string */ - private $refreshToken; + private string $refreshToken; /** * @var Configuration */ - private $configuration; + private Configuration $configuration; /** * OAuth2ThreeLegged constructor. @@ -30,11 +30,7 @@ public function __construct( TokenFetcher $tokenFetcher = null, ScopeValidator $scopeValidator = null ) { - // @codeCoverageIgnoreStart - if ($configuration === null) { - $configuration = Configuration::getDefaultConfiguration(); - } - // @codeCoverageIgnoreEnd + $configuration = $configuration ?? Configuration::getDefaultConfiguration(); $this->configuration = $configuration; @@ -44,7 +40,7 @@ public function __construct( /** * @return string */ - public function createAuthUrl() + public function createAuthUrl(): string { $host = $this->configuration->getHost(); $parameters = http_build_query([ @@ -59,32 +55,32 @@ public function createAuthUrl() /** * Returns application token - * @param $authorizationCode + * @param string $authorizationCode * @throws RuntimeException */ - public function fetchToken($authorizationCode) + public function fetchToken(string $authorizationCode): void { $additionalParams = [ 'code' => $authorizationCode, 'redirect_uri' => $this->configuration->getRedirectUrl(), ]; - $response = parent::fetchAccessToken('authentication/v1/gettoken', 'authorization_code', $additionalParams); + $response = $this->fetchAccessToken('authentication/v1/gettoken', 'authorization_code', $additionalParams); $this->saveRefreshToken($response); } /** - * @param $refreshToken + * @param string $refreshToken * @throws RuntimeException */ - public function refreshToken($refreshToken) + public function refreshToken(string $refreshToken): void { $additionalParams = [ 'refresh_token' => $refreshToken, ]; - $response = parent::fetchAccessToken('authentication/v1/refreshtoken', 'refresh_token', $additionalParams); + $response = $this->fetchAccessToken('authentication/v1/refreshtoken', 'refresh_token', $additionalParams); $this->saveRefreshToken($response); } @@ -92,16 +88,16 @@ public function refreshToken($refreshToken) /** * @return string */ - public function getRefreshToken() + public function getRefreshToken(): string { return $this->refreshToken; } /** - * @param $response + * @param array $response * @throws RuntimeException */ - private function saveRefreshToken($response) + private function saveRefreshToken(array $response): void { if ( ! array_key_exists('refresh_token', $response)) { throw new RuntimeException('Refresh token was not found in the response'); diff --git a/lib/Auth/OAuth2/TwoLeggedAuth.php b/lib/Auth/OAuth2/TwoLeggedAuth.php index 9c25891..b2f2249 100644 --- a/lib/Auth/OAuth2/TwoLeggedAuth.php +++ b/lib/Auth/OAuth2/TwoLeggedAuth.php @@ -10,8 +10,8 @@ class TwoLeggedAuth extends AbstractOAuth2 * Returns application token * @throws RuntimeException */ - public function fetchToken() + public function fetchToken(): void { - parent::fetchAccessToken('authentication/v1/authenticate', 'client_credentials'); + $this->fetchAccessToken('authentication/v1/authenticate', 'client_credentials'); } } \ No newline at end of file diff --git a/lib/Auth/ScopeValidator.php b/lib/Auth/ScopeValidator.php index 59595c2..3d5d1df 100644 --- a/lib/Auth/ScopeValidator.php +++ b/lib/Auth/ScopeValidator.php @@ -4,7 +4,7 @@ class ScopeValidator { - const SCOPES = [ + private const SCOPES = [ 'data:read', 'data:write', 'data:create', @@ -23,7 +23,7 @@ class ScopeValidator /** * @var array */ - private $scopes; + private array $scopes; /** * ScopeValidator constructor. @@ -31,29 +31,23 @@ class ScopeValidator */ public function __construct(array $scopes = null) { - // @codeCoverageIgnoreStart - if (is_null($scopes)) { - $scopes = self::SCOPES; - } - // @codeCoverageIgnoreEnd - - $this->scopes = $scopes; + $this->scopes = $scopes ?? self::SCOPES; } /** - * @param $name + * @param string $name * @return bool */ - public function isScopeValid($name) + public function isScopeValid(string $name): bool { - return in_array($name, $this->scopes); + return in_array($name, $this->scopes, true); } /** * @param $name * @return bool */ - public function isScopeInvalid($name) + public function isScopeInvalid(string $name): bool { return ! $this->isScopeValid($name); } diff --git a/lib/Auth/TokenFetcher.php b/lib/Auth/TokenFetcher.php index d12b4e4..ab4bb1b 100644 --- a/lib/Auth/TokenFetcher.php +++ b/lib/Auth/TokenFetcher.php @@ -20,17 +20,17 @@ class TokenFetcher /** * @var Configuration */ - private $configuration; + private Configuration $configuration; /** * @var GuzzleClient */ - private $httpClient; + private GuzzleClient $httpClient; /** * @var HeadersProvider */ - private $headersProvider; + private HeadersProvider $headersProvider; /** * TokenFetcher constructor. @@ -43,38 +43,26 @@ public function __construct( GuzzleClient $httpClient = null, HeadersProvider $headersProvider = null ) { - // @codeCoverageIgnoreStart - if ($configuration === null) { - $configuration = Configuration::getDefaultConfiguration(); - } - - if ($httpClient === null) { - $httpClient = new GuzzleClient(); - } - - if ($headersProvider === null) { - // Use the CORE version detector - $versionDetector = new VersionDetector(); - - $headersProvider = new HeadersProvider($versionDetector->detect()); - } - // @codeCoverageIgnoreEnd - - $this->configuration = $configuration; - $this->httpClient = $httpClient; - $this->headersProvider = $headersProvider; + $this->configuration = $configuration ?? Configuration::getDefaultConfiguration(); + $this->httpClient = $httpClient ?? new GuzzleClient(); + $this->headersProvider = $headersProvider ?? new HeadersProvider((new VersionDetector)->detect()); } /** - * @param $url - * @param $grantType + * @param string $url + * @param string $grantType * @param array $scopes * @param array $additionalParams * @return array - * @throws RuntimeException + * @throws RuntimeException|LogicException */ - public function fetch($url, $grantType, array $scopes, array $additionalParams = []) + public function fetch(string $url, string $grantType, array $scopes, array $additionalParams = []): array { + if(count($scopes) === 0) + { + throw new LogicException('Cannot fetch token when no scopes where defined'); + } + $formParams = array_merge([ 'client_id' => $this->configuration->getClientId(), 'client_secret' => $this->configuration->getClientSecret(), @@ -90,12 +78,12 @@ public function fetch($url, $grantType, array $scopes, array $additionalParams = } /** - * @param $url - * @param $body + * @param string $url + * @param array $body * @return string * @throws RuntimeException */ - private function makeRequest($url, $body) + private function makeRequest(string $url, array $body): string { try { $response = $this->httpClient->post($url, [ diff --git a/lib/Core/ComposerJsonFetcher.php b/lib/Core/ComposerJsonFetcher.php index f32b3c4..09608ed 100644 --- a/lib/Core/ComposerJsonFetcher.php +++ b/lib/Core/ComposerJsonFetcher.php @@ -13,9 +13,9 @@ class ComposerJsonFetcher /** * @return array */ - public function fetch() + public function fetch(): array { - $composerJsonFileLocation = dirname(__FILE__) . '/../../composer.json'; + $composerJsonFileLocation = __DIR__ . '/../../composer.json'; return (array) json_decode(file_get_contents($composerJsonFileLocation), true); } diff --git a/lib/Core/Exception/InvalidScopeException.php b/lib/Core/Exception/InvalidScopeException.php index e4824be..168acb5 100644 --- a/lib/Core/Exception/InvalidScopeException.php +++ b/lib/Core/Exception/InvalidScopeException.php @@ -8,7 +8,7 @@ class InvalidScopeException extends LogicException * InvalidScopeException constructor. * @param string $name */ - public function __construct($name) + public function __construct(string $name) { parent::__construct("Cannot add invalid scope '{$name}'"); } diff --git a/lib/Core/HeadersProvider.php b/lib/Core/HeadersProvider.php index 67ea12a..a444a2c 100644 --- a/lib/Core/HeadersProvider.php +++ b/lib/Core/HeadersProvider.php @@ -7,40 +7,34 @@ class HeadersProvider /** * @var string */ - private $version; + private string $version; /** * @var string */ - private $timestamp; + private string $timestamp; /** * @var UserAgentGenerator */ - private $userAgentGenerator; + private UserAgentGenerator $userAgentGenerator; /** * HeaderProvider constructor. - * @param $version - * @param UserAgentGenerator $userAgentGenerator + * @param string $version + * @param UserAgentGenerator|null $userAgentGenerator */ - public function __construct($version, UserAgentGenerator $userAgentGenerator = null) + public function __construct(string $version, UserAgentGenerator $userAgentGenerator = null) { - // @codeCoverageIgnoreStart - if ($userAgentGenerator === null) { - $userAgentGenerator = new UserAgentGenerator($version); - } - // @codeCoverageIgnoreEnd - $this->version = $version; + $this->userAgentGenerator = $userAgentGenerator ?? new UserAgentGenerator($version); $this->timestamp = $this->getCurrentTimestamp(); - $this->userAgentGenerator = $userAgentGenerator; } /** * @return array */ - public function getHeaders() + public function getHeaders(): array { return [ 'x-ads-sdk' => "php-core-sdk-{$this->version}", @@ -50,9 +44,9 @@ public function getHeaders() } /** - * @return false|string + * @return string */ - private function getCurrentTimestamp() + private function getCurrentTimestamp(): string { $currentTime = time(); $formattedTimestamp = gmdate('Y-m-d\TH:i:s', $currentTime); diff --git a/lib/Core/UserAgentGenerator.php b/lib/Core/UserAgentGenerator.php index 64e429f..76588ae 100644 --- a/lib/Core/UserAgentGenerator.php +++ b/lib/Core/UserAgentGenerator.php @@ -4,24 +4,18 @@ class UserAgentGenerator { - /** - * @var string - */ - private $sdkVersion; - /** * UserAgentGenerator constructor. - * @param $sdkVersion + * @param string $sdkVersion */ - public function __construct($sdkVersion) + public function __construct(private string $sdkVersion) { - $this->sdkVersion = $sdkVersion; } - + /** * @return string */ - public function generate() + public function generate(): string { $osName = $this->getOsName(); $osVersion = $this->getOsVersion(); @@ -34,15 +28,15 @@ public function generate() /** * @return string */ - private function getPhpVersion() + private function getPhpVersion(): string { - return phpversion(); + return PHP_VERSION; } /** * @return string */ - private function getOsName() + private function getOsName(): string { return php_uname('a'); } @@ -50,7 +44,7 @@ private function getOsName() /** * @return string */ - private function getOsVersion() + private function getOsVersion(): string { return php_uname('r'); } @@ -58,7 +52,7 @@ private function getOsVersion() /** * @return string */ - private function getEngineNameAndVersion() + private function getEngineNameAndVersion(): string { if (array_key_exists('SERVER_SOFTWARE', $_SERVER) && (preg_match('/(.*)\/(.*)/', $_SERVER['SERVER_SOFTWARE']) === 1) diff --git a/lib/Core/VersionDetector.php b/lib/Core/VersionDetector.php index afc646c..7c0cbf8 100644 --- a/lib/Core/VersionDetector.php +++ b/lib/Core/VersionDetector.php @@ -5,48 +5,38 @@ class VersionDetector { /** - * @var string + * @var string|null */ - private $version; + private string|null $version = null; /** * @var ComposerJsonFetcher */ - private $composerJsonFetcher; + private ComposerJsonFetcher $composerJsonFetcher; /** * VersionDetector constructor. - * @param ComposerJsonFetcher $composerJsonFetcher + * @param ComposerJsonFetcher|null $composerJsonFetcher */ public function __construct(ComposerJsonFetcher $composerJsonFetcher = null) { - // @codeCoverageIgnoreStart - if ($composerJsonFetcher === null) { - $composerJsonFetcher = new ComposerJsonFetcher(); - } - // @codeCoverageIgnoreEnd - - $this->composerJsonFetcher = $composerJsonFetcher; + $this->composerJsonFetcher = $composerJsonFetcher ?? new ComposerJsonFetcher(); } /** * @return mixed */ - public function detect() + public function detect(): string { - if ( ! is_null($this->version)) { - return $this->version; - } - - $this->version = $this->findVersion(); + $this->version = $this->version ?? $this->findVersion(); return $this->version; } /** - * @return mixed + * @return string */ - private function findVersion() + private function findVersion(): string { $data = $this->composerJsonFetcher->fetch(); diff --git a/test/Auth/ConfigurationTest.php b/test/Auth/ConfigurationTest.php index a9c03db..4f0aaf7 100644 --- a/test/Auth/ConfigurationTest.php +++ b/test/Auth/ConfigurationTest.php @@ -1,6 +1,6 @@ configuration = new Configuration(); } - public function test_set_default_configuration() + public function test_set_default_configuration(): void { $newConfig = new Configuration(); $newConfig->setRedirectUrl('someUrl'); @@ -27,7 +27,7 @@ public function test_set_default_configuration() $this->assertEquals($newConfig, Configuration::getDefaultConfiguration()); } - public function test_client_id_storing() + public function test_client_id_storing(): void { $clientId = 'ASDFSDUBFSA ODFS'; @@ -36,7 +36,7 @@ public function test_client_id_storing() $this->assertEquals($clientId, $this->configuration->getClientId()); } - public function test_client_secret_storing() + public function test_client_secret_storing(): void { $clientSecret = 'ASDFSDUBFSA ODFS'; @@ -45,7 +45,7 @@ public function test_client_secret_storing() $this->assertEquals($clientSecret, $this->configuration->getClientSecret()); } - public function test_redirect_url_storing() + public function test_redirect_url_storing(): void { $redirectUrl = 'www.test.com/callback.php'; @@ -54,7 +54,7 @@ public function test_redirect_url_storing() $this->assertEquals($redirectUrl, $this->configuration->getRedirectUrl()); } - public function test_url() + public function test_url(): void { $this->assertEquals('https://developer.api.autodesk.com', $this->configuration->getHost()); diff --git a/test/Auth/OAuth2/AbstractOAuth2Test.php b/test/Auth/OAuth2/AbstractOAuth2Test.php index 1f2e519..0820a28 100644 --- a/test/Auth/OAuth2/AbstractOAuth2Test.php +++ b/test/Auth/OAuth2/AbstractOAuth2Test.php @@ -1,51 +1,50 @@ tokenFetcher = $this->getMockBuilder(TokenFetcher::class) ->disableOriginalConstructor() - ->setMethods([]) + ->addMethods([]) ->getMock(); $this->scopeValidator = $this->getMockBuilder(ScopeValidator::class) ->disableOriginalConstructor() - ->setMethods(['isScopeValid', 'isScopeInvalid']) + ->onlyMethods(['isScopeValid', 'isScopeInvalid']) ->getMock(); $arguments = [$this->tokenFetcher, $this->scopeValidator]; $this->auth = $this->getMockForAbstractClass(AbstractOAuth2::class, $arguments); } - public function test_set_scopes() + public function test_set_scopes(): void { $this->scopeValidator ->method('isScopeInvalid') @@ -58,7 +57,7 @@ public function test_set_scopes() $this->assertEquals(['a'], $this->auth->getScopes()); } - public function test_add_scope() + public function test_add_scope(): void { $this->scopeValidator ->method('isScopeInvalid') @@ -73,7 +72,7 @@ public function test_add_scope() $this->assertEquals(['a', 'b'], $this->auth->getScopes()); } - public function test_add_scopes() + public function test_add_scopes(): void { $this->scopeValidator ->method('isScopeInvalid') @@ -88,7 +87,7 @@ public function test_add_scopes() $this->assertEquals(['a', 'b', 'cc', 'c'], $this->auth->getScopes()); } - public function test_add_scope_ignores_existing_scope() + public function test_add_scope_ignores_existing_scope(): void { $this->scopeValidator ->method('isScopeInvalid') @@ -105,7 +104,7 @@ public function test_add_scope_ignores_existing_scope() $this->assertEquals(['a', 'b'], $this->auth->getScopes()); } - public function test_wrong_scope_throws_exception() + public function test_wrong_scope_throws_exception(): void { $this->scopeValidator ->method('isScopeInvalid') @@ -116,7 +115,7 @@ public function test_wrong_scope_throws_exception() $this->auth->addScope('a'); } - public function test_has_token() + public function test_has_token(): void { $this->assertFalse($this->auth->hasAccessToken()); diff --git a/test/Auth/OAuth2/ThreeLeggedAuthTest.php b/test/Auth/OAuth2/ThreeLeggedAuthTest.php index 941bf71..a2b7cd6 100644 --- a/test/Auth/OAuth2/ThreeLeggedAuthTest.php +++ b/test/Auth/OAuth2/ThreeLeggedAuthTest.php @@ -1,6 +1,6 @@ configuration = $this->getMockBuilder(Configuration::class) ->disableOriginalConstructor() - ->setMethods(['getHost', 'getClientId', 'getRedirectUrl']) + ->onlyMethods(['getHost', 'getClientId', 'getRedirectUrl']) ->getMock(); $this->scopeValidator = $this->getMockBuilder(ScopeValidator::class) ->disableOriginalConstructor() - ->setMethods(['isScopeInvalid']) + ->onlyMethods(['isScopeInvalid']) ->getMock(); $this->tokenFetcher = $this->getMockBuilder(TokenFetcher::class) ->disableOriginalConstructor() - ->setMethods(['fetch']) + ->onlyMethods(['fetch']) ->getMock(); $this->auth = new ThreeLeggedAuth($this->configuration, $this->tokenFetcher, $this->scopeValidator); } - public function test_create_auth_url() + public function test_create_auth_url(): void { $host = 'http://testhost.com'; $clientId = 'XXXXXX'; @@ -88,7 +87,7 @@ public function test_create_auth_url() $this->assertEquals($expectedUrl, $this->auth->createAuthUrl()); } - public function test_fetch_token() + public function test_fetch_token(): void { $authorizationCode = 'someAuthCode'; $redirectUri = 'http://host.com/callback.php'; @@ -119,7 +118,7 @@ public function test_fetch_token() $this->assertEquals($expiry, $this->auth->getExpiresIn()); } - public function test_refresh_token() + public function test_refresh_token(): void { $refreshToken = 'YYYY'; $accessToken = 'XXXX'; @@ -143,7 +142,7 @@ public function test_refresh_token() } - public function test_exception_is_thrown_when_access_token_is_not_returned_from_fetcher() + public function test_exception_is_thrown_when_access_token_is_not_returned_from_fetcher(): void { $this->tokenFetcher ->expects($this->once()) @@ -156,7 +155,7 @@ public function test_exception_is_thrown_when_access_token_is_not_returned_from_ $this->auth->fetchToken('XXXX'); } - public function test_exception_is_thrown_when_expiry_is_not_returned_from_fetcher() + public function test_exception_is_thrown_when_expiry_is_not_returned_from_fetcher(): void { $this->tokenFetcher ->expects($this->once()) @@ -169,7 +168,7 @@ public function test_exception_is_thrown_when_expiry_is_not_returned_from_fetche $this->auth->fetchToken('XXXX'); } - public function test_exception_is_thrown_when_refresh_token_is_not_returned_from_fetcher() + public function test_exception_is_thrown_when_refresh_token_is_not_returned_from_fetcher(): void { $this->tokenFetcher ->expects($this->once()) diff --git a/test/Auth/OAuth2/TwoLeggedAuthTest.php b/test/Auth/OAuth2/TwoLeggedAuthTest.php index 257290a..7d7f3da 100644 --- a/test/Auth/OAuth2/TwoLeggedAuthTest.php +++ b/test/Auth/OAuth2/TwoLeggedAuthTest.php @@ -1,39 +1,38 @@ tokenFetcher = $this->getMockBuilder(TokenFetcher::class) ->disableOriginalConstructor() - ->setMethods(['fetch']) + ->onlyMethods(['fetch']) ->getMock(); $this->scopeValidator = $this->getMockBuilder(ScopeValidator::class) @@ -43,7 +42,7 @@ public function setUp() $this->auth = new TwoLeggedAuth($this->tokenFetcher, $this->scopeValidator); } - public function test_fetch_token() + public function test_fetch_token(): void { $accessToken = 'XXXX'; $expiry = 100; @@ -60,7 +59,7 @@ public function test_fetch_token() $this->assertEquals($expiry, $this->auth->getExpiresIn()); } - public function test_exception_is_thrown_when_access_token_is_not_returned_from_fetcher() + public function test_exception_is_thrown_when_access_token_is_not_returned_from_fetcher(): void { $this->tokenFetcher ->expects($this->once()) @@ -73,7 +72,7 @@ public function test_exception_is_thrown_when_access_token_is_not_returned_from_ $this->auth->fetchToken(); } - public function test_exception_is_thrown_when_expiry_is_not_returned_from_fetcher() + public function test_exception_is_thrown_when_expiry_is_not_returned_from_fetcher(): void { $this->tokenFetcher ->expects($this->once()) diff --git a/test/Auth/ScopeValidatorTest.php b/test/Auth/ScopeValidatorTest.php index b6f3947..fcf0f3e 100644 --- a/test/Auth/ScopeValidatorTest.php +++ b/test/Auth/ScopeValidatorTest.php @@ -1,6 +1,6 @@ validator = new ScopeValidator(self::SCOPES); } - public function test_valid_scopes() + public function test_valid_scopes(): void { $this->assertTrue($this->validator->isScopeValid(self::VALID_SCOPE)); $this->assertFalse($this->validator->isScopeInvalid(self::VALID_SCOPE)); } - public function test_invalid_scopes() + public function test_invalid_scopes(): void { $this->assertFalse($this->validator->isScopeValid(self::INVALID_SCOPE)); $this->assertTrue($this->validator->isScopeInvalid(self::INVALID_SCOPE)); diff --git a/test/Auth/TokenFetcherTest.php b/test/Auth/TokenFetcherTest.php index d8e29a7..7868f3b 100644 --- a/test/Auth/TokenFetcherTest.php +++ b/test/Auth/TokenFetcherTest.php @@ -1,6 +1,6 @@ configuration = $this->getMockBuilder(Configuration::class) ->disableOriginalConstructor() - ->setMethods(['getHost']) + ->onlyMethods(['getHost']) ->getMock(); $this->httpClient = $this->getMockBuilder(GuzzleClient::class) ->disableOriginalConstructor() - ->setMethods(['post']) + ->onlyMethods(['post']) ->getMock(); $this->headersProvider = $this->getMockBuilder(HeadersProvider::class) ->disableOriginalConstructor() - ->setMethods(['getHeaders']) + ->onlyMethods(['getHeaders']) ->getMock(); $this->headersProvider @@ -68,15 +67,15 @@ public function setUp() ); } - public function test_exception_is_thrown_when_no_scopes_defined() + public function test_exception_is_thrown_when_no_scopes_defined(): void { $this->expectException(LogicException::class); $this->expectExceptionMessage('Cannot fetch token when no scopes where defined'); - $this->tokenFetcher->fetch('url', 'grantType', [], []); + $this->tokenFetcher->fetch('url', 'grantType', []); } - public function test_call_to_http_client() + public function test_call_to_http_client(): void { $path = 'somepage.php'; $domain = 'www.test.com/'; @@ -117,7 +116,7 @@ public function test_call_to_http_client() $this->assertEquals($response, $result); } - public function test_error_response_handling() + public function test_error_response_handling(): void { $this->httpClient ->expects($this->once()) diff --git a/test/Core/HeadersProviderTest.php b/test/Core/HeadersProviderTest.php index 5366e46..45a05a7 100644 --- a/test/Core/HeadersProviderTest.php +++ b/test/Core/HeadersProviderTest.php @@ -1,11 +1,10 @@ userAgentGenerator = $this->getMockBuilder(UserAgentGenerator::class) ->disableOriginalConstructor() - ->setMethods(['generate']) + ->onlyMethods(['generate']) ->getMock(); $this->userAgentGenerator @@ -36,12 +35,12 @@ public function setUp() $this->provider = new HeadersProvider(self::VERSION, $this->userAgentGenerator); } - public function test_x_ads_sdk_header_exists() + public function test_x_ads_sdk_header_exists(): void { $this->checkHeaderExists('x-ads-sdk'); } - public function test_x_ads_sdk_header_is_correct() + public function test_x_ads_sdk_header_is_correct(): void { $version = self::VERSION; @@ -49,29 +48,29 @@ public function test_x_ads_sdk_header_is_correct() $this->assertEquals("php-core-sdk-{$version}" , $headers['x-ads-sdk']); } - public function test_x_ads_request_time_exists() + public function test_x_ads_request_time_exists(): void { $this->checkHeaderExists('x-ads-request-time'); } - public function test_x_ads_request_time_format_is_correct() + public function test_x_ads_request_time_format_is_correct(): void { $headers = $this->provider->getHeaders(); - $this->assertRegExp('/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/', $headers['x-ads-request-time']); + $this->assertMatchesRegularExpression('/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/', $headers['x-ads-request-time']); } - public function test_user_agent_exists() + public function test_user_agent_exists(): void { $this->checkHeaderExists('User-Agent'); } - public function test_user_agent_is_taken_from_the_generator_class() + public function test_user_agent_is_taken_from_the_generator_class(): void { $headers = $this->provider->getHeaders(); $this->assertEquals(self::USER_AGENT , $headers['User-Agent']); } - private function checkHeaderExists($name) + private function checkHeaderExists(string $name): void { $this->assertArrayHasKey($name, $this->provider->getHeaders()); } diff --git a/test/Core/UserAgentGeneratorTest.php b/test/Core/UserAgentGeneratorTest.php index dde7ee9..0379d39 100644 --- a/test/Core/UserAgentGeneratorTest.php +++ b/test/Core/UserAgentGeneratorTest.php @@ -1,6 +1,6 @@ generator = new UserAgentGenerator(self::SDK_VERSION); } - public function test_user_agent_exists() + public function test_user_agent_exists(): void { $this->assertNotEmpty($this->generator->generate()); } - public function test_user_agent_format() + public function test_user_agent_format(): void { - $this->assertRegExp(self::USER_AGENT_PATTERN, $this->generator->generate()); + $this->assertMatchesRegularExpression(self::USER_AGENT_PATTERN, $this->generator->generate()); } } \ No newline at end of file diff --git a/test/Core/VersionDetectorTest.php b/test/Core/VersionDetectorTest.php index 4f1e01d..675b81e 100644 --- a/test/Core/VersionDetectorTest.php +++ b/test/Core/VersionDetectorTest.php @@ -1,34 +1,33 @@ composerJsonFetcher = $this->getMockBuilder(ComposerJsonFetcher::class) - ->setMethods(['fetch']) + ->onlyMethods(['fetch']) ->getMock(); $this->versionDetector = new VersionDetector($this->composerJsonFetcher); } - public function test_version_is_detected_correctly() + public function test_version_is_detected_correctly(): void { $this->composerJsonFetcher ->method('fetch') @@ -37,7 +36,7 @@ public function test_version_is_detected_correctly() $this->assertEquals('2.0', $this->versionDetector->detect()); } - public function test_version_is_not_fetched_twice() + public function test_version_is_not_fetched_twice(): void { $this->composerJsonFetcher ->expects($this->once()) @@ -50,7 +49,7 @@ public function test_version_is_not_fetched_twice() $this->versionDetector->detect(); } - public function test_fallback_when_version_is_not_in_composer_data() + public function test_fallback_when_version_is_not_in_composer_data(): void { $this->composerJsonFetcher ->method('fetch')