diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e54dc30..abdf4cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,6 @@ jobs: with: php-version: 8.5 - run: composer install --no-progress --prefer-dist - - run: vendor/bin/phpunit + - run: composer run check-quality env: API_KEY: ${{ secrets.API_KEY }} diff --git a/.gitignore b/.gitignore index f8aa5af..009984c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .phpunit.result.cache phpunit.xml vendor +var diff --git a/composer.json b/composer.json index 967c93e..3fac154 100644 --- a/composer.json +++ b/composer.json @@ -1,34 +1,59 @@ { - "name": "foxentry/php-api-client", - "description": "Foxentry.com PHP API client", - "keywords": ["Foxentry", "Foxentry.com"], - "license": "MIT", - "authors": [ - { - "name": "Foxentry", - "email": "info@foxentry.com" - } - ], - "support": { - "email": "info@foxentry.com" - }, - "require": { - "php": ">=8.2", - "guzzlehttp/guzzle": "^7.10.0", - "ext-json": "*" - }, - "require-dev": { - "phpunit/phpunit": "^12.5.4" - }, - "autoload": { - "psr-4": { - "Foxentry\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Tests\\": "tests/", - "Tests\\Unit\\": "tests/Unit/" - } + "name": "foxentry/php-api-client", + "description": "Foxentry.com PHP API client", + "keywords": [ + "Foxentry", + "Foxentry.com" + ], + "license": "MIT", + "authors": [ + { + "name": "Foxentry", + "email": "info@foxentry.com" } + ], + "support": { + "email": "info@foxentry.com" + }, + "require": { + "php": ">=8.1", + "guzzlehttp/guzzle": "^7.8", + "ext-json": "*" + }, + "require-dev": { + "phpunit/phpunit": "^11.3.1", + "phpstan/phpstan": "^1.12", + "squizlabs/php_codesniffer": "^3.10", + "slevomat/coding-standard": "^8.15", + "phpstan/phpstan-phpunit": "^1.4", + "phpstan/extension-installer": "^1.4" + }, + "autoload": { + "psr-4": { + "Foxentry\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/", + "Tests\\Unit\\": "tests/Unit/" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "phpstan/extension-installer": true + } + }, + "scripts": { + "lint": "phpcs -s", + "lint-fix": "phpcbf", + "phpstan": "phpstan analyse -c phpstan.neon", + "test": "phpunit", + "check-quality": [ + "@lint", + "@phpstan", + "@test" + ] + } } diff --git a/composer.lock b/composer.lock index 816e7b6..018b063 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": "5f32bb6e193e176348ed9267e292f7c2", + "content-hash": "48fd746ba0dd40952e1ee6c95ea3cb48", "packages": [ { "name": "guzzlehttp/guzzle", @@ -604,6 +604,102 @@ } ], "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "845eb62303d2ca9b289ef216356568ccc075ffd1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/845eb62303d2ca9b289ef216356568ccc075ffd1", + "reference": "845eb62303d2ca9b289ef216356568ccc075ffd1", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.2", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "^2.2", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcompatibility/php-compatibility": "^9.0 || ^10.0.0@dev", + "yoast/phpunit-polyfills": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "opensource@frenck.dev", + "homepage": "https://frenck.dev", + "role": "Open source developer" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "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/PHPCSStandards/composer-installer/issues", + "security": "https://github.com/PHPCSStandards/composer-installer/security/policy", + "source": "https://github.com/PHPCSStandards/composer-installer" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-11-11T04:32:07+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.13.4", @@ -840,18 +936,218 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpstan/extension-installer", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.0 || ^2.0" + }, + "require-dev": { + "composer/composer": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.4.3" + }, + "time": "2024-09-04T20:21:43+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "2.3.2", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/a004701b11273a26cd7955a61d67a7f1e525a45a", + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^5.3.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", + "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/2.3.2" + }, + "time": "2026-01-25T14:56:51+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.12.32", + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2770dcdf5078d0b0d53f94317e06affe88419aa8", + "reference": "2770dcdf5078d0b0d53f94317e06affe88419aa8", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2025-09-30T10:16:31+00:00" + }, + { + "name": "phpstan/phpstan-phpunit", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-phpunit.git", + "reference": "72a6721c9b64b3e4c9db55abbc38f790b318267e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/72a6721c9b64b3e4c9db55abbc38f790b318267e", + "reference": "72a6721c9b64b3e4c9db55abbc38f790b318267e", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.12" + }, + "conflict": { + "phpunit/phpunit": "<7.0" + }, + "require-dev": { + "nikic/php-parser": "^4.13.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-strict-rules": "^1.5.1", + "phpunit/phpunit": "^9.5" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon", + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPUnit extensions and rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-phpunit/issues", + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.4.2" + }, + "time": "2024-12-17T17:20:49+00:00" + }, { "name": "phpunit/php-code-coverage", - "version": "12.5.2", + "version": "11.0.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "4a9739b51cbcb355f6e95659612f92e282a7077b" + "reference": "2c1ed04922802c15e1de5d7447b4856de949cf56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4a9739b51cbcb355f6e95659612f92e282a7077b", - "reference": "4a9739b51cbcb355f6e95659612f92e282a7077b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2c1ed04922802c15e1de5d7447b4856de949cf56", + "reference": "2c1ed04922802c15e1de5d7447b4856de949cf56", "shasum": "" }, "require": { @@ -859,17 +1155,18 @@ "ext-libxml": "*", "ext-xmlwriter": "*", "nikic/php-parser": "^5.7.0", - "php": ">=8.3", - "phpunit/php-file-iterator": "^6.0", - "phpunit/php-text-template": "^5.0", - "sebastian/complexity": "^5.0", - "sebastian/environment": "^8.0.3", - "sebastian/lines-of-code": "^4.0", - "sebastian/version": "^6.0", - "theseer/tokenizer": "^2.0.1" + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.1", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.2", + "theseer/tokenizer": "^1.3.1" }, "require-dev": { - "phpunit/phpunit": "^12.5.1" + "phpunit/phpunit": "^11.5.46" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -878,7 +1175,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "12.5.x-dev" + "dev-main": "11.0.x-dev" } }, "autoload": { @@ -907,7 +1204,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/12.5.2" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.12" }, "funding": [ { @@ -927,32 +1224,32 @@ "type": "tidelift" } ], - "time": "2025-12-24T07:03:04+00:00" + "time": "2025-12-24T07:01:01+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "6.0.0", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "961bc913d42fe24a257bfff826a5068079ac7782" + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/961bc913d42fe24a257bfff826a5068079ac7782", - "reference": "961bc913d42fe24a257bfff826a5068079ac7782", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -980,7 +1277,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.0" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" }, "funding": [ { @@ -988,28 +1285,28 @@ "type": "github" } ], - "time": "2025-02-07T04:58:37+00:00" + "time": "2024-08-27T05:02:59+00:00" }, { "name": "phpunit/php-invoker", - "version": "6.0.0", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "12b54e689b07a25a9b41e57736dfab6ec9ae5406" + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/12b54e689b07a25a9b41e57736dfab6ec9ae5406", - "reference": "12b54e689b07a25a9b41e57736dfab6ec9ae5406", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcntl": "*" @@ -1017,7 +1314,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1044,7 +1341,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/6.0.0" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" }, "funding": [ { @@ -1052,32 +1349,32 @@ "type": "github" } ], - "time": "2025-02-07T04:58:58+00:00" + "time": "2024-07-03T05:07:44+00:00" }, { "name": "phpunit/php-text-template", - "version": "5.0.0", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "e1367a453f0eda562eedb4f659e13aa900d66c53" + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/e1367a453f0eda562eedb4f659e13aa900d66c53", - "reference": "e1367a453f0eda562eedb4f659e13aa900d66c53", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1104,7 +1401,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/5.0.0" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" }, "funding": [ { @@ -1112,32 +1409,32 @@ "type": "github" } ], - "time": "2025-02-07T04:59:16+00:00" + "time": "2024-07-03T05:08:43+00:00" }, { "name": "phpunit/php-timer", - "version": "8.0.0", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc" + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc", - "reference": "f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "8.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1164,7 +1461,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", "security": "https://github.com/sebastianbergmann/php-timer/security/policy", - "source": "https://github.com/sebastianbergmann/php-timer/tree/8.0.0" + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" }, "funding": [ { @@ -1172,20 +1469,20 @@ "type": "github" } ], - "time": "2025-02-07T04:59:38+00:00" + "time": "2024-07-03T05:09:35+00:00" }, { "name": "phpunit/phpunit", - "version": "12.5.4", + "version": "11.5.50", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "4ba0e923f9d3fc655de22f9547c01d15a41fc93a" + "reference": "fdfc727f0fcacfeb8fcb30c7e5da173125b58be3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4ba0e923f9d3fc655de22f9547c01d15a41fc93a", - "reference": "4ba0e923f9d3fc655de22f9547c01d15a41fc93a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fdfc727f0fcacfeb8fcb30c7e5da173125b58be3", + "reference": "fdfc727f0fcacfeb8fcb30c7e5da173125b58be3", "shasum": "" }, "require": { @@ -1198,30 +1495,34 @@ "myclabs/deep-copy": "^1.13.4", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", - "php": ">=8.3", - "phpunit/php-code-coverage": "^12.5.1", - "phpunit/php-file-iterator": "^6.0.0", - "phpunit/php-invoker": "^6.0.0", - "phpunit/php-text-template": "^5.0.0", - "phpunit/php-timer": "^8.0.0", - "sebastian/cli-parser": "^4.2.0", - "sebastian/comparator": "^7.1.3", - "sebastian/diff": "^7.0.0", - "sebastian/environment": "^8.0.3", - "sebastian/exporter": "^7.0.2", - "sebastian/global-state": "^8.0.2", - "sebastian/object-enumerator": "^7.0.0", - "sebastian/type": "^6.0.3", - "sebastian/version": "^6.0.0", + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.12", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.3", + "sebastian/comparator": "^6.3.3", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.1", + "sebastian/exporter": "^6.3.2", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.1.3", + "sebastian/version": "^5.0.2", "staabm/side-effects-detector": "^1.0.5" }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files" + }, "bin": [ "phpunit" ], "type": "library", "extra": { "branch-alias": { - "dev-main": "12.5-dev" + "dev-main": "11.5-dev" } }, "autoload": { @@ -1253,7 +1554,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.4" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.50" }, "funding": [ { @@ -1277,32 +1578,32 @@ "type": "tidelift" } ], - "time": "2025-12-15T06:05:34+00:00" + "time": "2026-01-27T05:59:18+00:00" }, { "name": "sebastian/cli-parser", - "version": "4.2.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "90f41072d220e5c40df6e8635f5dafba2d9d4d04" + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/90f41072d220e5c40df6e8635f5dafba2d9d4d04", - "reference": "90f41072d220e5c40df6e8635f5dafba2d9d4d04", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.2-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1326,51 +1627,152 @@ "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/4.2.0" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" - }, + } + ], + "time": "2024-07-03T04:41:36+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/54391c61e4af8078e5b276ab082b6d3c54c9ad64", + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.3" + }, + "funding": [ { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2025-03-19T07:56:08+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ { - "url": "https://tidelift.com/funding/github/packagist/sebastian/cli-parser", - "type": "tidelift" + "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/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "time": "2025-09-14T09:36:45+00:00" + "time": "2024-07-03T04:45:54+00:00" }, { "name": "sebastian/comparator", - "version": "7.1.3", + "version": "6.3.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "dc904b4bb3ab070865fa4068cd84f3da8b945148" + "reference": "2c95e1e86cb8dd41beb8d502057d1081ccc8eca9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dc904b4bb3ab070865fa4068cd84f3da8b945148", - "reference": "dc904b4bb3ab070865fa4068cd84f3da8b945148", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2c95e1e86cb8dd41beb8d502057d1081ccc8eca9", + "reference": "2c95e1e86cb8dd41beb8d502057d1081ccc8eca9", "shasum": "" }, "require": { "ext-dom": "*", "ext-mbstring": "*", - "php": ">=8.3", - "sebastian/diff": "^7.0", - "sebastian/exporter": "^7.0" + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^12.2" + "phpunit/phpunit": "^11.4" }, "suggest": { "ext-bcmath": "For comparing BcMath\\Number objects" @@ -1378,7 +1780,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "7.1-dev" + "dev-main": "6.3-dev" } }, "autoload": { @@ -1418,7 +1820,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/7.1.3" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.3" }, "funding": [ { @@ -1438,33 +1840,33 @@ "type": "tidelift" } ], - "time": "2025-08-20T11:27:00+00:00" + "time": "2026-01-24T09:26:40+00:00" }, { "name": "sebastian/complexity", - "version": "5.0.0", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "bad4316aba5303d0221f43f8cee37eb58d384bbb" + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/bad4316aba5303d0221f43f8cee37eb58d384bbb", - "reference": "bad4316aba5303d0221f43f8cee37eb58d384bbb", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", "shasum": "" }, "require": { "nikic/php-parser": "^5.0", - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1488,7 +1890,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/5.0.0" + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" }, "funding": [ { @@ -1496,33 +1898,33 @@ "type": "github" } ], - "time": "2025-02-07T04:55:25+00:00" + "time": "2024-07-03T04:49:50+00:00" }, { "name": "sebastian/diff", - "version": "7.0.0", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7ab1ea946c012266ca32390913653d844ecd085f" + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7ab1ea946c012266ca32390913653d844ecd085f", - "reference": "7ab1ea946c012266ca32390913653d844ecd085f", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0", - "symfony/process": "^7.2" + "phpunit/phpunit": "^11.0", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "7.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1555,7 +1957,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/7.0.0" + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" }, "funding": [ { @@ -1563,27 +1965,27 @@ "type": "github" } ], - "time": "2025-02-07T04:55:46+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "sebastian/environment", - "version": "8.0.3", + "version": "7.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "24a711b5c916efc6d6e62aa65aa2ec98fef77f68" + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/24a711b5c916efc6d6e62aa65aa2ec98fef77f68", - "reference": "24a711b5c916efc6d6e62aa65aa2ec98fef77f68", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4", + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.3" }, "suggest": { "ext-posix": "*" @@ -1591,7 +1993,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "8.0-dev" + "dev-main": "7.2-dev" } }, "autoload": { @@ -1619,7 +2021,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/8.0.3" + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.1" }, "funding": [ { @@ -1639,34 +2041,34 @@ "type": "tidelift" } ], - "time": "2025-08-12T14:11:56+00:00" + "time": "2025-05-21T11:55:47+00:00" }, { "name": "sebastian/exporter", - "version": "7.0.2", + "version": "6.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "016951ae10980765e4e7aee491eb288c64e505b7" + "reference": "70a298763b40b213ec087c51c739efcaa90bcd74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/016951ae10980765e4e7aee491eb288c64e505b7", - "reference": "016951ae10980765e4e7aee491eb288c64e505b7", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/70a298763b40b213ec087c51c739efcaa90bcd74", + "reference": "70a298763b40b213ec087c51c739efcaa90bcd74", "shasum": "" }, "require": { "ext-mbstring": "*", - "php": ">=8.3", - "sebastian/recursion-context": "^7.0" + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "7.0-dev" + "dev-main": "6.3-dev" } }, "autoload": { @@ -1709,7 +2111,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/7.0.2" + "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.2" }, "funding": [ { @@ -1729,35 +2131,35 @@ "type": "tidelift" } ], - "time": "2025-09-24T06:16:11+00:00" + "time": "2025-09-24T06:12:51+00:00" }, { "name": "sebastian/global-state", - "version": "8.0.2", + "version": "7.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "ef1377171613d09edd25b7816f05be8313f9115d" + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ef1377171613d09edd25b7816f05be8313f9115d", - "reference": "ef1377171613d09edd25b7816f05be8313f9115d", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", "shasum": "" }, "require": { - "php": ">=8.3", - "sebastian/object-reflector": "^5.0", - "sebastian/recursion-context": "^7.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "8.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1783,53 +2185,41 @@ "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/8.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" - }, - { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, - { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, - { - "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", - "type": "tidelift" } ], - "time": "2025-08-29T11:29:25+00:00" + "time": "2024-07-03T04:57:36+00:00" }, { "name": "sebastian/lines-of-code", - "version": "4.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "97ffee3bcfb5805568d6af7f0f893678fc076d2f" + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/97ffee3bcfb5805568d6af7f0f893678fc076d2f", - "reference": "97ffee3bcfb5805568d6af7f0f893678fc076d2f", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", "shasum": "" }, "require": { "nikic/php-parser": "^5.0", - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1853,7 +2243,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/4.0.0" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" }, "funding": [ { @@ -1861,34 +2251,34 @@ "type": "github" } ], - "time": "2025-02-07T04:57:28+00:00" + "time": "2024-07-03T04:58:38+00:00" }, { "name": "sebastian/object-enumerator", - "version": "7.0.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1effe8e9b8e068e9ae228e542d5d11b5d16db894" + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1effe8e9b8e068e9ae228e542d5d11b5d16db894", - "reference": "1effe8e9b8e068e9ae228e542d5d11b5d16db894", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", "shasum": "" }, "require": { - "php": ">=8.3", - "sebastian/object-reflector": "^5.0", - "sebastian/recursion-context": "^7.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "7.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1911,7 +2301,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/7.0.0" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" }, "funding": [ { @@ -1919,32 +2309,32 @@ "type": "github" } ], - "time": "2025-02-07T04:57:48+00:00" + "time": "2024-07-03T05:00:13+00:00" }, { "name": "sebastian/object-reflector", - "version": "5.0.0", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "4bfa827c969c98be1e527abd576533293c634f6a" + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/4bfa827c969c98be1e527abd576533293c634f6a", - "reference": "4bfa827c969c98be1e527abd576533293c634f6a", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1967,7 +2357,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/5.0.0" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" }, "funding": [ { @@ -1975,32 +2365,32 @@ "type": "github" } ], - "time": "2025-02-07T04:58:17+00:00" + "time": "2024-07-03T05:01:32+00:00" }, { "name": "sebastian/recursion-context", - "version": "7.0.1", + "version": "6.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "0b01998a7d5b1f122911a66bebcb8d46f0c82d8c" + "reference": "f6458abbf32a6c8174f8f26261475dc133b3d9dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/0b01998a7d5b1f122911a66bebcb8d46f0c82d8c", - "reference": "0b01998a7d5b1f122911a66bebcb8d46f0c82d8c", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/f6458abbf32a6c8174f8f26261475dc133b3d9dc", + "reference": "f6458abbf32a6c8174f8f26261475dc133b3d9dc", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "7.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2031,7 +2421,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/7.0.1" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.3" }, "funding": [ { @@ -2051,32 +2441,32 @@ "type": "tidelift" } ], - "time": "2025-08-13T04:44:59+00:00" + "time": "2025-08-13T04:42:22+00:00" }, { "name": "sebastian/type", - "version": "6.0.3", + "version": "5.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "e549163b9760b8f71f191651d22acf32d56d6d4d" + "reference": "f77d2d4e78738c98d9a68d2596fe5e8fa380f449" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/e549163b9760b8f71f191651d22acf32d56d6d4d", - "reference": "e549163b9760b8f71f191651d22acf32d56d6d4d", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/f77d2d4e78738c98d9a68d2596fe5e8fa380f449", + "reference": "f77d2d4e78738c98d9a68d2596fe5e8fa380f449", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -2100,7 +2490,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/type/issues", "security": "https://github.com/sebastianbergmann/type/security/policy", - "source": "https://github.com/sebastianbergmann/type/tree/6.0.3" + "source": "https://github.com/sebastianbergmann/type/tree/5.1.3" }, "funding": [ { @@ -2120,29 +2510,29 @@ "type": "tidelift" } ], - "time": "2025-08-09T06:57:12+00:00" + "time": "2025-08-09T06:55:48+00:00" }, { "name": "sebastian/version", - "version": "6.0.0", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "3e6ccf7657d4f0a59200564b08cead899313b53c" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c", - "reference": "3e6ccf7657d4f0a59200564b08cead899313b53c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { - "php": ">=8.3" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2166,7 +2556,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/version/issues", "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/6.0.0" + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -2174,7 +2564,151 @@ "type": "github" } ], - "time": "2025-02-07T05:00:38+00:00" + "time": "2024-10-09T05:16:32+00:00" + }, + { + "name": "slevomat/coding-standard", + "version": "8.22.1", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "1dd80bf3b93692bedb21a6623c496887fad05fec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/1dd80bf3b93692bedb21a6623c496887fad05fec", + "reference": "1dd80bf3b93692bedb21a6623c496887fad05fec", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.1.2", + "php": "^7.4 || ^8.0", + "phpstan/phpdoc-parser": "^2.3.0", + "squizlabs/php_codesniffer": "^3.13.4" + }, + "require-dev": { + "phing/phing": "3.0.1|3.1.0", + "php-parallel-lint/php-parallel-lint": "1.4.0", + "phpstan/phpstan": "2.1.24", + "phpstan/phpstan-deprecation-rules": "2.0.3", + "phpstan/phpstan-phpunit": "2.0.7", + "phpstan/phpstan-strict-rules": "2.0.6", + "phpunit/phpunit": "9.6.8|10.5.48|11.4.4|11.5.36|12.3.10" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "8.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.", + "keywords": [ + "dev", + "phpcs" + ], + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/8.22.1" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2025-09-13T08:53:30+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.13.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "0ca86845ce43291e8f5692c7356fccf3bcf02bf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0ca86845ce43291e8f5692c7356fccf3bcf02bf4", + "reference": "0ca86845ce43291e8f5692c7356fccf3bcf02bf4", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "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" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-11-04T16:30:35+00:00" }, { "name": "staabm/side-effects-detector", @@ -2230,23 +2764,23 @@ }, { "name": "theseer/tokenizer", - "version": "2.0.1", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "7989e43bf381af0eac72e4f0ca5bcbfa81658be4" + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/7989e43bf381af0eac72e4f0ca5bcbfa81658be4", - "reference": "7989e43bf381af0eac72e4f0ca5bcbfa81658be4", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": "^8.1" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -2268,7 +2802,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/2.0.1" + "source": "https://github.com/theseer/tokenizer/tree/1.3.1" }, "funding": [ { @@ -2276,7 +2810,7 @@ "type": "github" } ], - "time": "2025-12-08T11:19:18+00:00" + "time": "2025-11-17T20:03:58+00:00" } ], "aliases": [], @@ -2285,7 +2819,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.2", + "php": ">=8.1", "ext-json": "*" }, "platform-dev": {}, diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..7f17f87 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,59 @@ + + + Slim coding standard + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + + + + + + + + src + tests + + diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..47a2029 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,13 @@ +parameters: + level: 8 + phpVersion: 80100 + + tmpDir: %currentWorkingDirectory%/var/tmp/phpstan + + fileExtensions: + - php + - phpt + + paths: + - src + - tests diff --git a/src/ApiClient.php b/src/ApiClient.php index ab13b52..cb6e55b 100644 --- a/src/ApiClient.php +++ b/src/ApiClient.php @@ -1,5 +1,7 @@ setAuth($apiKey); } @@ -35,7 +38,8 @@ public function __construct( ?string $apiKey = null ) { * * @param string $apiKey The API key to set */ - public function setAuth( string $apiKey ): void { + public function setAuth(string $apiKey): void + { $this->apiKey = $apiKey; } @@ -44,34 +48,39 @@ public function setAuth( string $apiKey ): void { * * @param string $version The API version to set */ - public function setApiVersion( string $version ): void { + public function setApiVersion(string $version): void + { $this->apiVersion = $version; } - function company() { + public function company(): Company + { $request = new Request($this->apiVersion, $this->apiKey); - return new Company( $request ); + return new Company($request); } - function email() { + public function email(): Email + { $request = new Request($this->apiVersion, $this->apiKey); - return new Email( $request ); + return new Email($request); } - function location() { + public function location(): Location + { $request = new Request($this->apiVersion, $this->apiKey); - return new Location( $request ); + return new Location($request); } - function name() { + public function name(): Name + { $request = new Request($this->apiVersion, $this->apiKey); - return new Name( $request ); + return new Name($request); } - function phone() { + public function phone(): Phone + { $request = new Request($this->apiVersion, $this->apiKey); - return new Phone( $request ); + return new Phone($request); } - } diff --git a/src/Exception/BadRequestException.php b/src/Exception/BadRequestException.php index 0965bdd..20e2a01 100644 --- a/src/Exception/BadRequestException.php +++ b/src/Exception/BadRequestException.php @@ -1,5 +1,7 @@ hasResponse()) { - $statusCode = $e->getResponse()->getStatusCode(); - + $statusCode = $e->getResponse()?->getStatusCode() ?? -1; // Switch based on the status code of the response switch ($statusCode) { case 400: - return new BadRequestException("Request was invalid or cannot be processed."); + $foxentryException = new BadRequestException('Request was invalid or cannot be processed.'); + break; case 401: - return new UnauthorizedException("Unauthorized. Did you set your API key?"); + $foxentryException = new UnauthorizedException('Unauthorized. Did you set your API key?'); + break; case 402: - return new PaymentRequiredException("Payment is required to access this resource."); + $foxentryException = new PaymentRequiredException('Payment is required to access this resource.'); + break; case 403: - return new ForbiddenException("Forbidden."); + $foxentryException = new ForbiddenException('Forbidden.'); + break; case 404: - return new NotFoundException("Resource or endpoint requested is not found on the server."); + $foxentryException = new NotFoundException('Resource or endpoint requested is not found on the server.'); + break; case 429: - return new TooManyRequestsException("Too many requests have been made in the given time frame or the daily limit has been reached."); + $foxentryException = new TooManyRequestsException( + 'Too many requests have been made in the given time frame or the daily limit has been reached.' + ); + break; case 500: - return new ServerErrorException("Internal server error."); + $foxentryException = new ServerErrorException('Internal server error.'); + break; case 503: - return new ServiceUnavailableException("The server is temporarily unable to handle the request"); + $foxentryException = new ServiceUnavailableException('The server is temporarily unable to handle the request'); + break; default: // Handle the rest with generic FoxentryException class - return new self("Request exception: " . $e->getResponse()->getBody()->getContents(), $statusCode); + $foxentryException = new self('Request exception: ' . $e->getMessage(), $statusCode); + break; } - } else { - // Return a generic exception with the original exception message - return new self("Exception: " . $e->getMessage()); + + return $foxentryException->setResponse($e->getResponse()); } + + // Return a generic exception with the original exception message + return new self('Exception: ' . $e->getMessage()); + } + + public function setResponse(?ResponseInterface $response): self + { + $this->response = $response; + return $this; + } + + public function getResponse(): ?ResponseInterface + { + return $this->response; } -} \ No newline at end of file +} diff --git a/src/Exception/NotFoundException.php b/src/Exception/NotFoundException.php index f27ee67..8bb6db5 100644 --- a/src/Exception/NotFoundException.php +++ b/src/Exception/NotFoundException.php @@ -1,5 +1,7 @@ */ private array $headers = [ - "Foxentry-Include-Request-Details" => false, - "Content-Type" => "application/json", - "Accept" => "application/json", - "User-Agent" => "FoxentrySdk (PHP/2.3.0; ApiReference/2.0)" + 'Foxentry-Include-Request-Details' => false, + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', + 'User-Agent' => 'FoxentrySdk (PHP/2.3.0; ApiReference/2.0)', ]; /** * The request body data to send to the API. * - * @var object */ private object $body; /** * A custom ID for the request (optional). * - * @var string|null */ private ?string $customId = null; /** * The query parameters for the API request. * - * @var array + * @var array */ private array $query; /** * Additional options for the API request (optional). * - * @var array|null + * @var array|null */ private ?array $options = null; /** * The API endpoint to send the request to. * - * @var string */ private string $endpoint; /** * The HTTP client for making requests. * - * @var HttpClient */ private HttpClient $httpClient; /** * The API key used for authentication. * - * @var string */ private string $apiKey; /** * Information about the client making the request (optional). * - * @var object|null + * @var array */ - private ?object $client = null; + private ?array $client = null; - public function __construct(string $apiVersion, ?string $apiKey) { - $this->setHeader("Api-Version", $apiVersion); + public function __construct(string $apiVersion, ?string $apiKey) + { + $this->setHeader('Api-Version', $apiVersion); - if ($apiKey){ + if ($apiKey) { $this->setAuth($apiKey); } @@ -123,7 +119,7 @@ public function __construct(string $apiVersion, ?string $apiKey) { public function setAuth(string $apiKey): void { $this->apiKey = $apiKey; - $this->setHeader("Authorization", "Bearer $this->apiKey"); + $this->setHeader('Authorization', sprintf('Bearer %s', $this->apiKey)); } /** @@ -132,7 +128,7 @@ public function setAuth(string $apiKey): void * @param string $key The header key * @param mixed $value The header value */ - public function setHeader(string $key, $value): void + public function setHeader(string $key, mixed $value): void { $this->headers[$key] = $value; } @@ -150,7 +146,7 @@ public function setCustomId(string $id): void /** * Set query parameters for the request. * - * @param array $query The query parameters to set + * @param array $query The query parameters to set */ public function setQuery(array $query): void { @@ -160,7 +156,7 @@ public function setQuery(array $query): void /** * Set options for the request. * - * @param array $options The options to set + * @param array $options The options to set */ public function setOptions(array $options): void { @@ -184,13 +180,15 @@ public function setEndpoint(string $endpoint): void */ public function setClientIP(string $ip): void { - if(!filter_var($ip, FILTER_VALIDATE_IP)) - throw new \InvalidArgumentException("The specified IP address is not valid."); + if (!filter_var($ip, FILTER_VALIDATE_IP)) { + throw new \InvalidArgumentException('The specified IP address is not valid.'); + } - if(empty($this->client)) - $this->client = new \stdClass(); + if ($this->client === null) { + $this->client = []; + } - $this->client->ip = $ip; + $this->client['ip'] = $ip; } /** @@ -200,13 +198,15 @@ public function setClientIP(string $ip): void */ public function setClientCountry(string $country): void { - if(strlen($country) != 2) - throw new \InvalidArgumentException("The provided country code does not conform to the ISO-3166-1 alpha-2 format."); + if (strlen($country) != 2) { + throw new \InvalidArgumentException('The provided country code does not conform to the ISO-3166-1 alpha-2 format.'); + } - if(empty($this->client)) - $this->client = new \stdClass(); + if ($this->client === null) { + $this->client = []; + } - $this->client->country = $country; + $this->client['country'] = $country; } /** @@ -218,14 +218,15 @@ public function setClientCountry(string $country): void public function setClientLocation(float $lat, float $lon): void { $location = [ - "lat" => $lat, - "lon" => $lon, + 'lat' => $lat, + 'lon' => $lon, ]; - if(empty($this->client)) - $this->client = new \stdClass(); + if ($this->client === null) { + $this->client = []; + } - $this->client->location = (object)$location; + $this->client['location'] = $location; } /** @@ -250,8 +251,8 @@ public function send(): Response $this->validate(); $response = $this->httpClient->request($this->method, $this->endpoint, [ - "headers" => $this->headers, - "body" => json_encode($this->body) + 'headers' => $this->headers, + 'body' => json_encode($this->body), ]); $responseHeaders = $response->getHeaders(); @@ -269,12 +270,12 @@ public function send(): Response private function buildBody(): void { $body = [ - "request" => [ - "customId" => $this->customId, - "query" => $this->query, - "options" => $this->options, - "client" => $this->client - ] + 'request' => [ + 'customId' => $this->customId, + 'query' => $this->query, + 'options' => $this->options, + 'client' => $this->client, + ], ]; $this->body = (object)$body; diff --git a/src/Resource/BaseResource.php b/src/Resource/BaseResource.php index 25a88f5..59c33db 100644 --- a/src/Resource/BaseResource.php +++ b/src/Resource/BaseResource.php @@ -1,9 +1,20 @@ request->setHeader( "Foxentry-Include-Request-Details", $value ); + public function includeRequestDetails(bool $value = true): static + { + $this->request->setHeader('Foxentry-Include-Request-Details', $value); return $this; } @@ -39,9 +51,9 @@ public function includeRequestDetails( bool $value = true ): self { * * @param string $id The custom ID to set * - * @return BaseResource Returns $this for method chaining + * @return $this Returns $this for method chaining */ - public function setCustomId(string $id): BaseResource + public function setCustomId(string $id): self { $this->request->setCustomId($id); return $this; @@ -50,11 +62,11 @@ public function setCustomId(string $id): BaseResource /** * Set options for the resource request. * - * @param array $options The options to set + * @param array $options The options to set * - * @return BaseResource Returns $this for method chaining + * @return $this Returns $this for method chaining */ - public function setOptions(array $options): BaseResource + public function setOptions(array $options): self { $this->request->setOptions($options); return $this; @@ -65,9 +77,9 @@ public function setOptions(array $options): BaseResource * * @param string $ip The client IP address * - * @return BaseResource Returns $this for method chaining + * @return $this Returns $this for method chaining */ - public function setClientIP(string $ip): BaseResource + public function setClientIP(string $ip): self { $this->request->setClientIP($ip); return $this; @@ -78,10 +90,10 @@ public function setClientIP(string $ip): BaseResource * * @param string $country The client country code in format ISO-3166-1 alpha-2. * - * @return BaseResource Returns $this for method chaining + * @return $this Returns $this for method chaining * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO-3166-1 alpha-2 country code format */ - public function setClientCountry(string $country): BaseResource + public function setClientCountry(string $country): self { $this->request->setClientCountry($country); return $this; @@ -93,9 +105,9 @@ public function setClientCountry(string $country): BaseResource * @param float $lon The client's longitude * @param float $lat The client's latitude * - * @return BaseResource Returns $this for method chaining + * @return $this Returns $this for method chaining */ - public function setClientLocation(float $lat, float $lon): BaseResource + public function setClientLocation(float $lat, float $lon): self { $this->request->setClientLocation($lat, $lon); return $this; @@ -104,10 +116,18 @@ public function setClientLocation(float $lat, float $lon): BaseResource /** * Send a request to the API with the given query parameters. * - * @param array $query The query parameters for the request + * @param array $query The query parameters for the request * * @return Response The response from the API - * @throws \Exception + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ protected function send(array $query): Response { @@ -129,6 +149,6 @@ private function getCallerEndpoint(): string $class = strtolower($class); $method = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4)[3]['function']; - return "$class/$method"; + return $class . '/' . $method; } } diff --git a/src/Resource/Company.php b/src/Resource/Company.php index 14ae403..a93b7ea 100644 --- a/src/Resource/Company.php +++ b/src/Resource/Company.php @@ -1,8 +1,19 @@ $query Query parameters for the validation request * * @return Response The response from the validation request + * + * @return Response The response from the API + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ public function validate(array $query): Response { @@ -26,9 +48,20 @@ public function validate(array $query): Response /** * Search for a company. * - * @param array $query Query parameters for the search request + * @param array $query Query parameters for the search request + * + * @return Response The response from the API * * @return Response The response from the API + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ public function search(array $query): Response { @@ -38,9 +71,20 @@ public function search(array $query): Response /** * Get company details. * - * @param array $query Query parameters for the get request + * @param array $query Query parameters for the get request * * @return Response The response from the API + * + * @return Response The response from the API + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ public function get(array $query): Response { @@ -50,12 +94,23 @@ public function get(array $query): Response /** * Send a request to the API with the given query parameters. * - * @param array $query Query parameters for the request + * @param array $query Query parameters for the request + * + * @return Response The response from the API * * @return Response The response from the API + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ private function sendRequest(array $query): Response { - return parent::send($query); + return $this->send($query); } -} \ No newline at end of file +} diff --git a/src/Resource/Email.php b/src/Resource/Email.php index 5746313..a1675a4 100644 --- a/src/Resource/Email.php +++ b/src/Resource/Email.php @@ -1,8 +1,19 @@ $query Email address to validate * * @return Response The response from the validation request + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ - public function validate($query): Response + public function validate(string|array $query): Response { - $query = is_array($query) ? $query : ["email" => $query]; + $query = is_array($query) ? $query : ['email' => $query]; return $this->sendRequest($query); } /** * Search for information related to an email address. * - * @param string|array $query Email address to search for + * @param string|array $query Email address to search for * * @return Response The response from the search request + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ - public function search($query): Response + public function search(string|array $query): Response { - $query = is_array($query) ? $query : ["value" => $query]; + $query = is_array($query) ? $query : ['value' => $query]; return $this->sendRequest($query); } /** * Send a request to the API with the given query parameters. * - * @param array $query Query parameters for the request + * @param array $query Query parameters for the request * * @return Response The response from the API + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ private function sendRequest(array $query): Response { - return parent::send($query); + return $this->send($query); } } diff --git a/src/Resource/Location.php b/src/Resource/Location.php index 7012f94..f52ca74 100644 --- a/src/Resource/Location.php +++ b/src/Resource/Location.php @@ -1,8 +1,19 @@ $query Query parameters for the validation request + * * @return Response The response from the validation request + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ public function validate(array $query): Response { @@ -25,9 +47,19 @@ public function validate(array $query): Response /** * Search for a location. * - * @param array $query Query parameters for the search request + * @param array $query Query parameters for the search request * * @return Response The response from the API + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ public function search(array $query): Response { @@ -37,9 +69,19 @@ public function search(array $query): Response /** * Get location details. * - * @param array $query Query parameters for the get request + * @param array $query Query parameters for the get request * * @return Response The response from the API + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ public function get(array $query): Response { @@ -49,9 +91,19 @@ public function get(array $query): Response /** * Localize a location. * - * @param array $query Query parameters for the localize request + * @param array $query Query parameters for the localize request * * @return Response The response from the API + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ public function localize(array $query): Response { @@ -61,12 +113,22 @@ public function localize(array $query): Response /** * Send a request to the API with the given query parameters. * - * @param array $query Query parameters for the request + * @param array $query Query parameters for the request * * @return Response The response from the API + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ private function sendRequest(array $query): Response { - return parent::send($query); + return $this->send($query); } -} \ No newline at end of file +} diff --git a/src/Resource/Name.php b/src/Resource/Name.php index 04c7722..3339118 100644 --- a/src/Resource/Name.php +++ b/src/Resource/Name.php @@ -1,8 +1,19 @@ $query Query parameters for the validation request * * @return Response The response from the validation request + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ public function validate(array $query): Response { @@ -26,12 +47,22 @@ public function validate(array $query): Response /** * Send a request to the API with the given query parameters. * - * @param array $query Query parameters for the request + * @param array $query Query parameters for the request * * @return Response The response from the API + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ private function sendRequest(array $query): Response { - return parent::send($query); + return $this->send($query); } } diff --git a/src/Resource/Phone.php b/src/Resource/Phone.php index 689f194..57f7fd4 100644 --- a/src/Resource/Phone.php +++ b/src/Resource/Phone.php @@ -1,8 +1,19 @@ $query Query parameters for the validation request * * @return Response The response from the validation request + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ public function validate(array $query): Response { @@ -26,12 +47,22 @@ public function validate(array $query): Response /** * Send a request to the API with the given query parameters. * - * @param array $query Query parameters for the request + * @param array $query Query parameters for the request * * @return Response The response from the API + * + * @throws TooManyRequestsException + * @throws BadRequestException + * @throws ForbiddenException + * @throws NotFoundException + * @throws PaymentRequiredException + * @throws ServerErrorException + * @throws UnauthorizedException + * @throws FoxentryException + * @throws GuzzleException */ private function sendRequest(array $query): Response { - return parent::send($query); + return $this->send($query); } -} \ No newline at end of file +} diff --git a/src/Response.php b/src/Response.php index f85d347..11f061e 100644 --- a/src/Response.php +++ b/src/Response.php @@ -1,5 +1,7 @@ data->status ?? null; } @@ -52,7 +52,7 @@ public function getStatus() /** * Get headers received from the API response. * - * @return array Response headers + * @return string[][] Response headers */ public function getHeaders(): array { @@ -64,8 +64,9 @@ public function getHeaders(): array * * @return int Rate limit number */ - public function getRateLimit(): int { - return reset($this->headers['foxentry-rate-limit']); + public function getRateLimit(): int + { + return (int) reset($this->headers['foxentry-rate-limit']); } /** @@ -73,8 +74,9 @@ public function getRateLimit(): int { * * @return int Time period in seconds of how long it will take before the rate limit is restored */ - public function getRateLimitPeriod(): int { - return reset($this->headers['foxentry-rate-limit-period']); + public function getRateLimitPeriod(): int + { + return (int) reset($this->headers['foxentry-rate-limit-period']); } /** @@ -82,8 +84,9 @@ public function getRateLimitPeriod(): int { * * @return int Remaining rate limit */ - public function getRateLimitRemaining(): int { - return reset($this->headers['foxentry-rate-limit-remaining']); + public function getRateLimitRemaining(): int + { + return (int) reset($this->headers['foxentry-rate-limit-remaining']); } /** @@ -91,12 +94,13 @@ public function getRateLimitRemaining(): int { * * @return ?float Remaining daily credits, null if no limit is set */ - public function getDailyCreditsLeft(): ?float { - if (!isset($this->headers['foxentry-daily-credits-left'])){ + public function getDailyCreditsLeft(): ?float + { + if (!isset($this->headers['foxentry-daily-credits-left'])) { return null; } - return reset($this->headers['foxentry-daily-credits-left']); + return (float) reset($this->headers['foxentry-daily-credits-left']); } /** @@ -104,12 +108,13 @@ public function getDailyCreditsLeft(): ?float { * * @return ?int Daily credits limit, null if no limit is set */ - public function getDailyCreditsLimit(): ?int { - if (!isset($this->headers['foxentry-daily-credits-limit'])){ + public function getDailyCreditsLimit(): ?int + { + if (!isset($this->headers['foxentry-daily-credits-limit'])) { return null; } - return reset($this->headers['foxentry-daily-credits-limit']); + return (int) reset($this->headers['foxentry-daily-credits-limit']); } /** @@ -117,8 +122,9 @@ public function getDailyCreditsLimit(): ?int { * * @return float API version */ - public function getApiVersion(): float { - return reset($this->headers['foxentry-api-version']); + public function getApiVersion(): float + { + return (float) reset($this->headers['foxentry-api-version']); } /** @@ -126,7 +132,7 @@ public function getApiVersion(): float { * * @return mixed|null The request details or null if not present in the response */ - public function getRequest() + public function getRequest(): mixed { return $this->data->request ?? null; } @@ -136,7 +142,7 @@ public function getRequest() * * @return mixed|null The response data or null if not present in the response */ - public function getResponse() + public function getResponse(): mixed { return $this->data->response ?? null; } @@ -146,11 +152,12 @@ public function getResponse() * * @return mixed|null The result or null if not present in the response */ - public function getResult() + public function getResult(): mixed { $result = $this->getResponse()->result ?? null; - if(empty($result)) + if (empty($result)) { $result = $this->getResponse()->results ?? null; + } return $result; } @@ -160,7 +167,7 @@ public function getResult() * * @return mixed|null The corrected result or null if not present in the response */ - public function getResultCorrected() + public function getResultCorrected(): mixed { return $this->getResponse()->resultCorrected ?? null; } @@ -170,7 +177,7 @@ public function getResultCorrected() * * @return mixed|null The suggestions or null if not present in the response */ - public function getSuggestions() + public function getSuggestions(): mixed { return $this->getResponse()->suggestions ?? null; } @@ -180,7 +187,7 @@ public function getSuggestions() * * @return mixed|null The errors or null if not present in the response */ - public function getErrors() + public function getErrors(): mixed { return $this->data->errors ?? null; } diff --git a/tests/Base.php b/tests/Base.php index ad79edc..e18f3c9 100644 --- a/tests/Base.php +++ b/tests/Base.php @@ -1,4 +1,7 @@ assertNotEmpty($_ENV['API_KEY'], 'You didn\'t set your API key in .env file'); - $this->api = new ApiClient($_ENV['API_KEY']); - } + protected static ApiClient $api; - public function tearDown(): void + public static function setUpBeforeClass(): void { - $this->api = null; + self::assertNotEmpty($_ENV['API_KEY'], 'You didn\'t set your API key in .env file'); + self::$api = new ApiClient($_ENV['API_KEY']); } } diff --git a/tests/Unit/Company/CompanyGetTest.php b/tests/Unit/Company/CompanyGetTest.php index 40ceca1..e6d6a00 100644 --- a/tests/Unit/Company/CompanyGetTest.php +++ b/tests/Unit/Company/CompanyGetTest.php @@ -1,6 +1,8 @@ "CZ", - "registrationNumber" => "04997476" + 'country' => 'CZ', + 'registrationNumber' => '04997476', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform company data retrieval. - $response = $this->api->company()->setOptions($options)->get($query); + $response = self::$api->company()->setOptions($options)->get($query); $result = $response->getResult(); // Assertions. @@ -39,21 +41,21 @@ public function testBasicDataScope() /** * Test retrieval of extended data scope by country and registration number. */ - public function testExtendedDataScope() + public function testExtendedDataScope(): void { // Query parameters for retrieving company data by country and registration number. $query = [ - "country" => "CZ", - "registrationNumber" => "04997476" + 'country' => 'CZ', + 'registrationNumber' => '04997476', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "extended" + 'dataScope' => 'extended', ]; // Perform company data retrieval. - $response = $this->api->company()->setOptions($options)->get($query); + $response = self::$api->company()->setOptions($options)->get($query); $result = $response->getResult(); // Assertions. @@ -65,21 +67,21 @@ public function testExtendedDataScope() /** * Test retrieval of full data scope by country and registration number. */ - public function testFullDataScope() + public function testFullDataScope(): void { // Query parameters for retrieving company data by country and registration number. $query = [ - "country" => "CZ", - "registrationNumber" => "04997476" + 'country' => 'CZ', + 'registrationNumber' => '04997476', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "full" + 'dataScope' => 'full', ]; // Perform company data retrieval. - $response = $this->api->company()->setOptions($options)->get($query); + $response = self::$api->company()->setOptions($options)->get($query); $result = $response->getResult(); // Assertions. @@ -91,24 +93,24 @@ public function testFullDataScope() /** * Test company data retrieval with custom ID. */ - public function testWithCustomId() + public function testWithCustomId(): void { // Custom ID to identify the request. $customRequestID = 'MyCustomID'; // Query parameters for company data retrieval. $query = [ - "country" => "CZ", - "registrationNumber" => "04997476" + 'country' => 'CZ', + 'registrationNumber' => '04997476', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform company data retrieval. - $response = $this->api->company() + $response = self::$api->company() ->setCustomId($customRequestID) ->setOptions($options) ->get($query); @@ -124,24 +126,24 @@ public function testWithCustomId() /** * Test company data retrieval with client information. */ - public function testWithClient() + public function testWithClient(): void { // Query parameters for company data retrieval. $query = [ - "country" => "CZ", - "registrationNumber" => "04997476" + 'country' => 'CZ', + 'registrationNumber' => '04997476', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform company data retrieval with client information. - $response = $this->api->company() + $response = self::$api->company() ->setOptions($options) - ->setClientCountry("CZ") - ->setClientIP("127.0.0.1") + ->setClientCountry('CZ') + ->setClientIP('127.0.0.1') ->setClientLocation(50.073658, 14.418540) ->get($query); @@ -156,21 +158,21 @@ public function testWithClient() /** * Settings should not persist between calls. */ - public function testInstanceSettings() + public function testInstanceSettings(): void { // Name that will be sent to the API for validation. $query = [ - "country" => "CZ", - "registrationNumber" => "04997476" + 'country' => 'CZ', + 'registrationNumber' => '04997476', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform name validation with client information. - $response = $this->api->company() + $response = self::$api->company() ->setOptions($options) ->includeRequestDetails() ->get($query); @@ -180,7 +182,7 @@ public function testInstanceSettings() $this->assertObjectHasProperty('query', $result); - $response = $this->api->company() + $response = self::$api->company() ->setOptions($options) ->get($query); diff --git a/tests/Unit/Company/CompanySearchTest.php b/tests/Unit/Company/CompanySearchTest.php index b904850..c1edfe7 100644 --- a/tests/Unit/Company/CompanySearchTest.php +++ b/tests/Unit/Company/CompanySearchTest.php @@ -1,5 +1,7 @@ "name", - "value" => "Web" + 'type' => 'name', + 'value' => 'Web', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform company name search. - $response = $this->api->company()->setOptions($options)->search($query); + $response = self::$api->company()->setOptions($options)->search($query); $result = $response->getResult(); // Assertions. @@ -41,21 +43,21 @@ public function testSearchName() /** * Test valid registration number search. */ - public function testSearchRegistrationNumber() + public function testSearchRegistrationNumber(): void { // Input parameters for registration number search. $query = [ - "type" => "registrationNumber", - "value" => "10" + 'type' => 'registrationNumber', + 'value' => '10', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform registration number search. - $response = $this->api->company()->setOptions($options)->search($query); + $response = self::$api->company()->setOptions($options)->search($query); $result = $response->getResult(); // Assertions. @@ -69,21 +71,21 @@ public function testSearchRegistrationNumber() /** * Test valid tax number search. */ - public function testSearchTaxNumber() + public function testSearchTaxNumber(): void { // Input parameters for tax number search. $query = [ - "type" => "taxNumber", - "value" => "10" + 'type' => 'taxNumber', + 'value' => '10', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform tax number search. - $response = $this->api->company()->setOptions($options)->search($query); + $response = self::$api->company()->setOptions($options)->search($query); $result = $response->getResult(); // Assertions. @@ -97,21 +99,21 @@ public function testSearchTaxNumber() /** * Test valid VAT number search. */ - public function testSearchVatNumber() + public function testSearchVatNumber(): void { // Input parameters for VAT number search. $query = [ - "type" => "vatNumber", - "value" => "CZ04997476" + 'type' => 'vatNumber', + 'value' => 'CZ04997476', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform VAT number search. - $response = $this->api->company()->setOptions($options)->search($query); + $response = self::$api->company()->setOptions($options)->search($query); $result = $response->getResult(); // Assertions. @@ -125,24 +127,24 @@ public function testSearchVatNumber() /** * Test company data search with custom ID. */ - public function testWithCustomId() + public function testWithCustomId(): void { // Custom ID to identify the request. $customRequestID = 'MyCustomID'; // Input parameters for company name search. $query = [ - "type" => "name", - "value" => "Web" + 'type' => 'name', + 'value' => 'Web', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform company data search. - $response = $this->api->company() + $response = self::$api->company() ->setCustomId($customRequestID) ->setOptions($options) ->search($query); @@ -160,24 +162,24 @@ public function testWithCustomId() /** * Test company data search with client information. */ - public function testWithClient() + public function testWithClient(): void { // Input parameters for company name search. $query = [ - "type" => "name", - "value" => "Web" + 'type' => 'name', + 'value' => 'Web', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform company data search with client information. - $response = $this->api->company() + $response = self::$api->company() ->setOptions($options) - ->setClientCountry("CZ") - ->setClientIP("127.0.0.1") + ->setClientCountry('CZ') + ->setClientIP('127.0.0.1') ->setClientLocation(50.073658, 14.418540) ->search($query); diff --git a/tests/Unit/Company/CompanyValidateTest.php b/tests/Unit/Company/CompanyValidateTest.php index 223cb08..9e8e3bd 100644 --- a/tests/Unit/Company/CompanyValidateTest.php +++ b/tests/Unit/Company/CompanyValidateTest.php @@ -1,6 +1,8 @@ "AVANTRO s.r.o.", - "registrationNumber" => "04997476" + 'name' => 'AVANTRO s.r.o.', + 'registrationNumber' => '04997476', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform company data validation. - $response = $this->api->company()->setOptions($options)->validate($query); + $response = self::$api->company()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertTrue($result->isValid); - $this->assertEquals("valid", $result->proposal); + $this->assertEquals('valid', $result->proposal); $this->assertNotEmpty($result->data); } /** * Test invalid company data. */ - public function testInvalid() + public function testInvalid(): void { // Query parameters for validating company data. $query = [ - "name" => "AVANTRO", - "registrationNumber" => "25547" + 'name' => 'AVANTRO', + 'registrationNumber' => '25547', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic", + 'dataScope' => 'basic', ]; // Perform company data validation. - $response = $this->api->company()->setOptions($options)->validate($query); + $response = self::$api->company()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalid", $result->proposal); + $this->assertEquals('invalid', $result->proposal); $this->assertNotEmpty($result->errors); } /** * Test invalid company data with correction. */ - public function testInvalidWithCorrection() + public function testInvalidWithCorrection(): void { // Query parameters for validating company data. $query = [ - "name" => "AVANTRO", - "registrationNumber" => "04997476" + 'name' => 'AVANTRO', + 'registrationNumber' => '04997476', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic", + 'dataScope' => 'basic', ]; // Perform company data validation. - $response = $this->api->company()->setOptions($options)->validate($query); + $response = self::$api->company()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalidWithCorrection", $result->proposal); + $this->assertEquals('invalidWithCorrection', $result->proposal); $this->assertNotEmpty($response->getResultCorrected()); } /** * Test invalid company data with suggestion. */ - public function testInvalidWithSuggestion() + public function testInvalidWithSuggestion(): void { // Query parameters for validating company data. $query = [ - "registrationNumber" => "0499747" + 'registrationNumber' => '0499747', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform company data validation. - $response = $this->api->company()->setOptions($options)->validate($query); + $response = self::$api->company()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalidWithSuggestion", $result->proposal); + $this->assertEquals('invalidWithSuggestion', $result->proposal); $this->assertNotEmpty($response->getSuggestions()); } /** * Test company data validation with custom ID. */ - public function testWithCustomId() + public function testWithCustomId(): void { // Custom ID to identify the request. $customRequestID = 'MyCustomID'; // Query parameters for validating company data. $query = [ - "name" => "AVANTRO s.r.o.", - "registrationNumber" => "04997476" + 'name' => 'AVANTRO s.r.o.', + 'registrationNumber' => '04997476', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform company data validation. - $response = $this->api->company() + $response = self::$api->company() ->setCustomId($customRequestID) ->setOptions($options) ->validate($query); @@ -157,24 +159,24 @@ public function testWithCustomId() /** * Test company data validation with client information. */ - public function testWithClient() + public function testWithClient(): void { // Query parameters for validating company data. $query = [ - "name" => "AVANTRO s.r.o.", - "registrationNumber" => "04997476" + 'name' => 'AVANTRO s.r.o.', + 'registrationNumber' => '04997476', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform company data validation with client information. - $response = $this->api->company() + $response = self::$api->company() ->setOptions($options) - ->setClientCountry("CZ") - ->setClientIP("127.0.0.1") + ->setClientCountry('CZ') + ->setClientIP('127.0.0.1') ->setClientLocation(50.073658, 14.418540) ->validate($query); diff --git a/tests/Unit/Email/EmailSearchTest.php b/tests/Unit/Email/EmailSearchTest.php index 4f01183..ac02347 100644 --- a/tests/Unit/Email/EmailSearchTest.php +++ b/tests/Unit/Email/EmailSearchTest.php @@ -1,5 +1,7 @@ 5 + 'resultsLimit' => 5, ]; // Perform email search. - $response = $this->api->email()->setOptions($options)->search($input); + $response = self::$api->email()->setOptions($options)->search($input); $result = $response->getResult(); // Assertions. @@ -40,20 +42,20 @@ public function testSearchResults() /** * Test email search when the input parameter is specified as the entire query. */ - public function testQueryInput() + public function testQueryInput(): void { // Query that will be sent to the API for validation. $query = [ - "value" => "info@" + 'value' => 'info@', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 5 + 'resultsLimit' => 5, ]; // Perform email validation. - $response = $this->api->email()->setOptions($options)->search($query); + $response = self::$api->email()->setOptions($options)->search($query); // Assertions. $this->assertInstanceOf(Response::class, $response); diff --git a/tests/Unit/Email/EmailValidateTest.php b/tests/Unit/Email/EmailValidateTest.php index 8e444c4..4820616 100644 --- a/tests/Unit/Email/EmailValidateTest.php +++ b/tests/Unit/Email/EmailValidateTest.php @@ -1,5 +1,7 @@ "extended" + 'validationType' => 'extended', ]; // Perform email validation. - $response = $this->api->email()->setOptions($options)->validate($email); + $response = self::$api->email()->setOptions($options)->validate($email); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertTrue($result->isValid); - $this->assertEquals("valid", $result->proposal); + $this->assertEquals('valid', $result->proposal); $this->assertNotEmpty($result->data); } /** * Test invalid email. */ - public function testInvalid() + public function testInvalid(): void { // Email that will be sent to the API for validation. - $email = "invalidUser@foxentry.com"; + $email = 'invaliduser@foxentry.com'; // Options that will be sent within the request. $options = [ - "validationType" => "extended" + 'validationType' => 'extended', ]; // Perform email validation. - $response = $this->api->email()->setOptions($options)->validate($email); + $response = self::$api->email()->setOptions($options)->validate($email); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalidWithPartialCorrection", $result->proposal); + $this->assertEquals('invalid', $result->proposal); $this->assertNotEmpty($result->errors); } /** * Test invalid email with suggestion. */ - public function testInvalidWithSuggestion() + public function testInvalidWithSuggestion(): void { // Email that will be sent to the API for validation. - $email = "info@gmali.com"; + $email = 'asldikhjaoiwsdhjoiashdoi@gmail.cz'; // Options that will be sent within the request. $options = [ - "validationType" => "extended" + 'validationType' => 'extended', ]; // Perform email validation. - $response = $this->api->email()->setOptions($options)->validate($email); + $response = self::$api->email()->setOptions($options)->validate($email); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalidWithPartialCorrection", $result->proposal); - $this->assertNotEmpty($response->getResultCorrected()); + $this->assertEquals('invalidWithSuggestion', $result->proposal); + $this->assertNotEmpty($response->getSuggestions()); } /** * Test invalid email with correction. */ - public function testInvalidWithCorrection() + public function testInvalidWithCorrection(): void { // Email that will be sent to the API for validation. - $email = "info@foxentry,com"; // Notice the "," instead of "." before the com + $email = 'info@foxentry,com'; // Notice the "," instead of "." before the com // Options that will be sent within the request. $options = [ - "validationType" => "extended" + 'validationType' => 'extended', ]; // Perform email validation. - $response = $this->api->email()->setOptions($options)->validate($email); + $response = self::$api->email()->setOptions($options)->validate($email); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalidWithCorrection", $result->proposal); + $this->assertEquals('invalidWithCorrection', $result->proposal); $this->assertNotEmpty($response->getResultCorrected()); } /** * Test invalid email with partial correction. */ - public function testInvalidWithPartialCorrection() + public function testInvalidWithPartialCorrection(): void { // Email that will be sent to the API for validation. - $email = "infogmail.com"; + $email = 'infogmail.com'; // Options that will be sent within the request. $options = [ - "validationType" => "extended" + 'validationType' => 'extended', ]; // Perform email validation. - $response = $this->api->email()->setOptions($options)->validate($email); + $response = self::$api->email()->setOptions($options)->validate($email); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalidWithPartialCorrection", $result->proposal); + $this->assertEquals('invalidWithPartialCorrection', $result->proposal); $this->assertNotEmpty($response->getResultCorrected()); } /** * Test disallowed disposable email. */ - public function testDisallowedDisposable() + public function testDisallowedDisposable(): void { // Email that will be sent to the API for validation. - $email = "rasini3451@naymedia.com"; + $email = 'rasini3451@naymedia.com'; // Options that will be sent within the request. $options = [ - "acceptDisposableEmails" => false, + 'acceptDisposableEmails' => false, ]; // Perform email validation. - $response = $this->api->email()->setOptions($options)->validate($email); + $response = self::$api->email()->setOptions($options)->validate($email); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalid", $result->proposal); + $this->assertEquals('invalid', $result->proposal); $this->assertTrue($result->flags->isDisposableEmailAddress); $this->assertNotEmpty($result->errors); } @@ -164,25 +166,25 @@ public function testDisallowedDisposable() /** * Test disallowed freemail. */ - public function testDisallowedFreemails() + public function testDisallowedFreemails(): void { // Email that will be sent to the API for validation. - $email = "info@gmail.com"; + $email = 'info@gmail.com'; // Options that will be sent within the request. $options = [ - "acceptFreemails" => false, + 'acceptFreemails' => false, ]; // Perform email validation. - $response = $this->api->email()->setOptions($options)->validate($email); + $response = self::$api->email()->setOptions($options)->validate($email); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalid", $result->proposal); + $this->assertEquals('invalid', $result->proposal); $this->assertTrue($result->flags->isFreemail); $this->assertNotEmpty($result->errors); } @@ -190,7 +192,7 @@ public function testDisallowedFreemails() /** * Test email validation with custom ID. */ - public function testWithCustomId() + public function testWithCustomId(): void { // Custom ID to identify the request. $customRequestID = 'orderEmailValidation'; @@ -199,7 +201,7 @@ public function testWithCustomId() $email = 'info@foxentry.com'; // Perform email validation. - $response = $this->api->email() + $response = self::$api->email() ->setCustomId($customRequestID) ->validate($email); @@ -214,15 +216,15 @@ public function testWithCustomId() /** * Test email validation with client information. */ - public function testWithClient() + public function testWithClient(): void { // Email that will be sent to the API for validation. $email = 'info@foxentry.com'; // Perform email validation with client information. - $response = $this->api->email() - ->setClientCountry("CZ") - ->setClientIP("127.0.0.1") + $response = self::$api->email() + ->setClientCountry('CZ') + ->setClientIP('127.0.0.1') ->setClientLocation(50.073658, 14.418540) ->validate($email); @@ -237,20 +239,20 @@ public function testWithClient() /** * Test email validation when the input parameter is specified as the entire query. */ - public function testQueryInput() + public function testQueryInput(): void { // Query that will be sent to the API for validation. $query = [ - "email" => "info@foxentry.com" + 'email' => 'info@foxentry.com', ]; // Options that will be sent within the request. $options = [ - "validationType" => "extended" + 'validationType' => 'extended', ]; // Perform email validation. - $response = $this->api->email()->setOptions($options)->validate($query); + $response = self::$api->email()->setOptions($options)->validate($query); // Assertions. $this->assertInstanceOf(Response::class, $response); @@ -260,18 +262,18 @@ public function testQueryInput() /** * Test of receiving response headers */ - public function testResponseHeaders() + public function testResponseHeaders(): void { // Email that will be sent to the API for validation. - $email = "info@foxentry.com"; + $email = 'info@foxentry.com'; // Options that will be sent within the request. $options = [ - "validationType" => "extended" + 'validationType' => 'extended', ]; // Perform email validation and get headers of the response. - $response = $this->api->email()->setOptions($options)->validate($email); + $response = self::$api->email()->setOptions($options)->validate($email); $headers = $response->getHeaders(); $rateLimit = $response->getRateLimit(); $rateLimitPeriod = $response->getRateLimitPeriod(); @@ -290,13 +292,13 @@ public function testResponseHeaders() /** * Settings should not persist between calls. */ - public function testInstanceSettings() + public function testInstanceSettings(): void { // Name that will be sent to the API for validation. - $email = "info@foxentry.com"; + $email = 'info@foxentry.com'; // Perform name validation with client information. - $response = $this->api->email() + $response = self::$api->email() ->includeRequestDetails() ->validate($email); @@ -305,7 +307,7 @@ public function testInstanceSettings() $this->assertObjectHasProperty('query', $result); - $response = $this->api->email() + $response = self::$api->email() ->validate($email); $result = $response->getRequest(); diff --git a/tests/Unit/Location/LocationGetTest.php b/tests/Unit/Location/LocationGetTest.php index d8721d0..208499d 100644 --- a/tests/Unit/Location/LocationGetTest.php +++ b/tests/Unit/Location/LocationGetTest.php @@ -1,5 +1,7 @@ "CZ", - "id" => "d2ade877-1e95-4a83-baa6-5431ce5b3ca8" + 'country' => 'CZ', + 'id' => 'd2ade877-1e95-4a83-baa6-5431ce5b3ca8', ]; // Options that will be sent within the request. $options = [ - "idType" => "internal", - "dataScope" => "full" + 'idType' => 'internal', + 'dataScope' => 'full', ]; // Perform location data retrieval. - $response = $this->api->location()->setOptions($options)->get($query); + $response = self::$api->location()->setOptions($options)->get($query); $result = $response->getResult(); // Assertions. @@ -40,22 +42,22 @@ public function testGetFullDataScopeByInternalID() /** * Test retrieval of full data scope by external ID. */ - public function getFullDataScopeByExternalID() + public function getFullDataScopeByExternalID(): void { // Query parameters for retrieving location data by external ID. $query = [ - "country" => "CZ", - "id" => "22349995" + 'country' => 'CZ', + 'id' => '22349995', ]; // Options that will be sent within the request. $options = [ - "idType" => "external", - "dataScope" => "full" + 'idType' => 'external', + 'dataScope' => 'full', ]; // Perform location data retrieval. - $response = $this->api->location()->setOptions($options)->get($query); + $response = self::$api->location()->setOptions($options)->get($query); $result = $response->getResult(); // Assertions. @@ -67,25 +69,25 @@ public function getFullDataScopeByExternalID() /** * Test location data retrieval with custom ID. */ - public function testWithCustomId() + public function testWithCustomId(): void { // Custom ID to identify the request. $customRequestID = 'MyCustomID'; // Query parameters for location data retrieval. $query = [ - "country" => "CZ", - "id" => "22349995" + 'country' => 'CZ', + 'id' => '22349995', ]; // Options that will be sent within the request. $options = [ - "idType" => "external", - "dataScope" => "full" + 'idType' => 'external', + 'dataScope' => 'full', ]; // Perform location data retrieval. - $response = $this->api->location() + $response = self::$api->location() ->setCustomId($customRequestID) ->setOptions($options) ->get($query); @@ -101,25 +103,25 @@ public function testWithCustomId() /** * Test location data retrieval with client information. */ - public function testWithClient() + public function testWithClient(): void { // Query parameters for location data retrieval. $query = [ - "country" => "CZ", - "id" => "22349995" + 'country' => 'CZ', + 'id' => '22349995', ]; // Options that will be sent within the request. $options = [ - "idType" => "external", - "dataScope" => "full" + 'idType' => 'external', + 'dataScope' => 'full', ]; // Perform location data retrieval with client information. - $response = $this->api->location() + $response = self::$api->location() ->setOptions($options) - ->setClientCountry("CZ") - ->setClientIP("127.0.0.1") + ->setClientCountry('CZ') + ->setClientIP('127.0.0.1') ->setClientLocation(50.073658, 14.418540) ->get($query); @@ -134,22 +136,22 @@ public function testWithClient() /** * Settings should not persist between calls. */ - public function testInstanceSettings() + public function testInstanceSettings(): void { // Name that will be sent to the API for validation. $query = [ - "country" => "CZ", - "id" => "22349995" + 'country' => 'CZ', + 'id' => '22349995', ]; // Options that will be sent within the request. $options = [ - "idType" => "external", - "dataScope" => "basic" + 'idType' => 'external', + 'dataScope' => 'basic', ]; // Perform name validation with client information. - $response = $this->api->location() + $response = self::$api->location() ->setOptions($options) ->includeRequestDetails() ->get($query); @@ -159,7 +161,7 @@ public function testInstanceSettings() $this->assertObjectHasProperty('query', $result); - $response = $this->api->location() + $response = self::$api->location() ->setOptions($options) ->get($query); diff --git a/tests/Unit/Location/LocationLocalizeTest.php b/tests/Unit/Location/LocationLocalizeTest.php index ae670d6..ad52781 100644 --- a/tests/Unit/Location/LocationLocalizeTest.php +++ b/tests/Unit/Location/LocationLocalizeTest.php @@ -1,5 +1,7 @@ 50.0919999, - "lon" => 14.4527403 + 'lat' => 50.0919999, + 'lon' => 14.4527403, ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10, - "radius" => 15, - "acceptNearest" => false + 'resultsLimit' => 10, + 'radius' => 15, + 'acceptNearest' => false, ]; // Perform location data localization. - $response = $this->api->location()->setOptions($options)->localize($query); + $response = self::$api->location()->setOptions($options)->localize($query); $result = $response->getResult(); // Assertions. @@ -43,26 +45,26 @@ public function testLocalizationResults() /** * Test location data localization with custom ID. */ - public function testWithCustomId() + public function testWithCustomId(): void { // Custom ID to identify the request. $customRequestID = 'MyCustomID'; // Query parameters for localizing location data. $query = [ - "lat" => 50.0919999, - "lon" => 14.4527403 + 'lat' => 50.0919999, + 'lon' => 14.4527403, ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10, - "radius" => 15, - "acceptNearest" => false + 'resultsLimit' => 10, + 'radius' => 15, + 'acceptNearest' => false, ]; // Perform location data localization. - $response = $this->api->location() + $response = self::$api->location() ->setCustomId($customRequestID) ->setOptions($options) ->localize($query); @@ -80,26 +82,26 @@ public function testWithCustomId() /** * Test location data localization with client information. */ - public function testWithClient() + public function testWithClient(): void { // Query parameters for localizing location data. $query = [ - "lat" => 50.0919999, - "lon" => 14.4527403 + 'lat' => 50.0919999, + 'lon' => 14.4527403, ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10, - "radius" => 15, - "acceptNearest" => false + 'resultsLimit' => 10, + 'radius' => 15, + 'acceptNearest' => false, ]; // Perform location data localization with client information. - $response = $this->api->location() + $response = self::$api->location() ->setOptions($options) - ->setClientCountry("CZ") - ->setClientIP("127.0.0.1") + ->setClientCountry('CZ') + ->setClientIP('127.0.0.1') ->setClientLocation(50.073658, 14.418540) ->localize($query); diff --git a/tests/Unit/Location/LocationSearchTest.php b/tests/Unit/Location/LocationSearchTest.php index f63356a..9774d1a 100644 --- a/tests/Unit/Location/LocationSearchTest.php +++ b/tests/Unit/Location/LocationSearchTest.php @@ -1,5 +1,7 @@ "street", - "value" => "tha" + 'type' => 'street', + 'value' => 'tha', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform street search. - $response = $this->api->location()->setOptions($options)->search($query); + $response = self::$api->location()->setOptions($options)->search($query); $result = $response->getResult(); // Assertions. @@ -41,21 +43,21 @@ public function testSearchStreet() /** * Test valid city search. */ - public function testSearchCity() + public function testSearchCity(): void { // Input parameters for city search. $query = [ - "type" => "city", - "value" => "pra" + 'type' => 'city', + 'value' => 'pra', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform city search. - $response = $this->api->location()->setOptions($options)->search($query); + $response = self::$api->location()->setOptions($options)->search($query); $result = $response->getResult(); // Assertions. @@ -69,21 +71,21 @@ public function testSearchCity() /** * Test valid street with number search. */ - public function testSearchStreetWithNumber() + public function testSearchStreetWithNumber(): void { // Input parameters for street with number search. $query = [ - "type" => "streetWithNumber", - "value" => "Jeseniova 56" + 'type' => 'streetWithNumber', + 'value' => 'Jeseniova 56', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform street with number search. - $response = $this->api->location()->setOptions($options)->search($query); + $response = self::$api->location()->setOptions($options)->search($query); $result = $response->getResult(); // Assertions. @@ -97,21 +99,21 @@ public function testSearchStreetWithNumber() /** * Test valid ZIP code search. */ - public function testSearchZip() + public function testSearchZip(): void { // Input parameters for ZIP code search. $query = [ - "type" => "zip", - "value" => "1" + 'type' => 'zip', + 'value' => '1', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform ZIP code search. - $response = $this->api->location()->setOptions($options)->search($query); + $response = self::$api->location()->setOptions($options)->search($query); $result = $response->getResult(); // Assertions. @@ -125,21 +127,21 @@ public function testSearchZip() /** * Test valid full address search. */ - public function testSearchFull() + public function testSearchFull(): void { // Input parameters for full location search. $query = [ - "type" => "full", - "value" => "Jeseniova Praha" + 'type' => 'full', + 'value' => 'Jeseniova Praha', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform full location search. - $response = $this->api->location()->setOptions($options)->search($query); + $response = self::$api->location()->setOptions($options)->search($query); $result = $response->getResult(); // Assertions. @@ -153,24 +155,24 @@ public function testSearchFull() /** * Test location data validation with custom ID. */ - public function testWithCustomId() + public function testWithCustomId(): void { // Custom ID to identify the request. $customRequestID = 'MyCustomID'; // Input parameters for street search. $query = [ - "type" => "street", - "value" => "tha" + 'type' => 'street', + 'value' => 'tha', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform location data validation. - $response = $this->api->location() + $response = self::$api->location() ->setCustomId($customRequestID) ->setOptions($options) ->search($query); @@ -188,24 +190,24 @@ public function testWithCustomId() /** * Test location data validation with client information. */ - public function testWithClient() + public function testWithClient(): void { // Input parameters for street search. $query = [ - "type" => "street", - "value" => "tha" + 'type' => 'street', + 'value' => 'tha', ]; // Options that will be sent within the request. $options = [ - "resultsLimit" => 10 + 'resultsLimit' => 10, ]; // Perform location data validation with client information. - $response = $this->api->location() + $response = self::$api->location() ->setOptions($options) - ->setClientCountry("CZ") - ->setClientIP("127.0.0.1") + ->setClientCountry('CZ') + ->setClientIP('127.0.0.1') ->setClientLocation(50.073658, 14.418540) ->search($query); diff --git a/tests/Unit/Location/LocationValidateTest.php b/tests/Unit/Location/LocationValidateTest.php index e358213..153d484 100644 --- a/tests/Unit/Location/LocationValidateTest.php +++ b/tests/Unit/Location/LocationValidateTest.php @@ -1,5 +1,7 @@ "Thámova 137/16", - "city" => "Praha", - "zip" => "186 00" + 'streetWithNumber' => 'Thámova 137/16', + 'city' => 'Praha', + 'zip' => '186 00', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic", - "cityFormat" => "minimal", - "zipFormat" => true + 'dataScope' => 'basic', + 'cityFormat' => 'minimal', + 'zipFormat' => true, ]; // Perform location data validation. - $response = $this->api->location()->setOptions($options)->validate($query); + $response = self::$api->location()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertTrue($result->isValid); - $this->assertEquals("valid", $result->proposal); + $this->assertEquals('valid', $result->proposal); $this->assertNotEmpty($result->data); } /** * Test invalid location data. */ - public function testInvalid() + public function testInvalid(): void { // Query parameters for validating location data. $query = [ - "streetWithNumber" => "Thámova 123456789", - "city" => "Parharlin", - "zip" => "457545754" + 'streetWithNumber' => 'Thámova 123456789', + 'city' => 'Parharlin', + 'zip' => '457545754', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic", - "cityFormat" => "minimal", - "zipFormat" => true + 'dataScope' => 'basic', + 'cityFormat' => 'minimal', + 'zipFormat' => true, ]; // Perform location data validation. - $response = $this->api->location()->setOptions($options)->validate($query); + $response = self::$api->location()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalid", $result->proposal); + $this->assertEquals('invalid', $result->proposal); $this->assertNotEmpty($result->errors); } /** * Test invalid location data with correction. */ - public function testInvalidWithCorrection() + public function testInvalidWithCorrection(): void { // Query parameters for validating location data. $query = [ - "streetWithNumber" => "Thámova 137", - "city" => "Praha", - "zip" => "18600" + 'streetWithNumber' => 'Thámova 137', + 'city' => 'Praha', + 'zip' => '18600', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic", - "cityFormat" => "minimal", - "zipFormat" => true + 'dataScope' => 'basic', + 'cityFormat' => 'minimal', + 'zipFormat' => true, ]; // Perform location data validation. - $response = $this->api->location()->setOptions($options)->validate($query); + $response = self::$api->location()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalidWithCorrection", $result->proposal); + $this->assertEquals('invalidWithCorrection', $result->proposal); $this->assertNotEmpty($response->getResultCorrected()); } /** * Test invalid location data with suggestion. */ - public function testInvalidWithSuggestion() + public function testInvalidWithSuggestion(): void { // Query parameters for validating location data. $query = [ - "streetWithNumber" => "Olšanská 2898/4", - "city" => "Praha", - "zip" => "130 00" + 'streetWithNumber' => 'Olšanská 2898/4', + 'city' => 'Praha', + 'zip' => '130 00', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic", - "cityFormat" => "minimal", - "zipFormat" => true + 'dataScope' => 'basic', + 'cityFormat' => 'minimal', + 'zipFormat' => true, ]; // Perform location data validation. - $response = $this->api->location()->setOptions($options)->validate($query); + $response = self::$api->location()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalidWithSuggestion", $result->proposal); + $this->assertEquals('invalidWithSuggestion', $result->proposal); $this->assertNotEmpty($response->getSuggestions()); } /** * Test location data validation with custom ID. */ - public function testWithCustomId() + public function testWithCustomId(): void { // Custom ID to identify the request. $customRequestID = 'MyCustomID'; // Query parameters for validating location data. $query = [ - "streetWithNumber" => "Thámova 123456789", - "city" => "Parharlin", - "zip" => "457545754" + 'streetWithNumber' => 'Thámova 123456789', + 'city' => 'Parharlin', + 'zip' => '457545754', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic", - "cityFormat" => "minimal", - "zipFormat" => true + 'dataScope' => 'basic', + 'cityFormat' => 'minimal', + 'zipFormat' => true, ]; // Perform location data validation. - $response = $this->api->location() + $response = self::$api->location() ->setCustomId($customRequestID) ->setOptions($options) ->validate($query); @@ -173,27 +175,27 @@ public function testWithCustomId() /** * Test location data validation with client information. */ - public function testWithClient() + public function testWithClient(): void { // Query parameters for validating location data. $query = [ - "streetWithNumber" => "Thámova 137/16", - "city" => "Praha", - "zip" => "186 00" + 'streetWithNumber' => 'Thámova 137/16', + 'city' => 'Praha', + 'zip' => '186 00', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic", - "cityFormat" => "minimal", - "zipFormat" => true + 'dataScope' => 'basic', + 'cityFormat' => 'minimal', + 'zipFormat' => true, ]; // Perform location data validation with client information. - $response = $this->api->location() + $response = self::$api->location() ->setOptions($options) - ->setClientCountry("CZ") - ->setClientIP("127.0.0.1") + ->setClientCountry('CZ') + ->setClientIP('127.0.0.1') ->setClientLocation(50.073658, 14.418540) ->validate($query); diff --git a/tests/Unit/Name/NameValidateTest.php b/tests/Unit/Name/NameValidateTest.php index 33bb90a..94955b6 100644 --- a/tests/Unit/Name/NameValidateTest.php +++ b/tests/Unit/Name/NameValidateTest.php @@ -1,5 +1,7 @@ "Pavel" + 'name' => 'Pavel', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform name validation. - $response = $this->api->name()->setOptions($options)->validate($query); + $response = self::$api->name()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertTrue($result->isValid); - $this->assertEquals("valid", $result->proposal); + $this->assertEquals('valid', $result->proposal); $this->assertNotEmpty($result->data); } /** * Test invalid name. */ - public function testInvalid() + public function testInvalid(): void { // Name that will be sent to the API for validation. $query = [ - "name" => "Paeeewas" + 'name' => 'Paeeewas', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic", - "validationDepth" => "strict" + 'dataScope' => 'basic', + 'validationDepth' => 'strict', ]; // Perform name validation. - $response = $this->api->name()->setOptions($options)->validate($query); + $response = self::$api->name()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalid", $result->proposal); + $this->assertEquals('invalid', $result->proposal); $this->assertNotEmpty($result->errors); } /** * Test invalid name with correction. */ - public function testInvalidWithCorrection() + public function testInvalidWithCorrection(): void { // Name that will be sent to the API for validation. $query = [ - "name" => "Palve" + 'name' => 'PaVelll', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic", - "validationDepth" => "strict" + 'dataScope' => 'basic', + 'validationDepth' => 'strict', ]; // Perform name validation. - $response = $this->api->name()->setOptions($options)->validate($query); + $response = self::$api->name()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("invalidWithSuggestion", $result->proposal); - $this->assertNotEmpty($response->getSuggestions()); + $this->assertEquals('invalidWithCorrection', $result->proposal); + $this->assertNotEmpty($response->getResultCorrected()); } /** * Test valid full name validation. */ - public function tesValidNameSurnameFullDataScope() + public function tesValidNameSurnameFullDataScope(): void { // Full name that will be sent to the API for validation. $query = [ - "nameSurname" => "Pavel Novák" + 'nameSurname' => 'Pavel Novák', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "full" + 'dataScope' => 'full', ]; // Perform full name validation. - $response = $this->api->name()->setOptions($options)->validate($query); + $response = self::$api->name()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. $this->assertInstanceOf(Response::class, $response); $this->assertEquals(200, $response->getStatus()); $this->assertFalse($result->isValid); - $this->assertEquals("valid", $result->proposal); + $this->assertEquals('valid', $result->proposal); $this->assertNotEmpty($result->details); } /** * Test name validation with custom ID. */ - public function testWithCustomId() + public function testWithCustomId(): void { // Custom ID to identify the request. $customRequestID = 'MyCustomID'; // Name that will be sent to the API for validation. $query = [ - "name" => "Pavel" + 'name' => 'Pavel', ]; // Perform name validation. - $response = $this->api->name() + $response = self::$api->name() ->setCustomId($customRequestID) ->validate($query); @@ -149,23 +151,23 @@ public function testWithCustomId() /** * Test name validation with client information. */ - public function testWithClient() + public function testWithClient(): void { // Name that will be sent to the API for validation. $query = [ - "name" => "Pavel" + 'name' => 'Pavel', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform name validation with client information. - $response = $this->api->name() + $response = self::$api->name() ->setOptions($options) - ->setClientCountry("CZ") - ->setClientIP("127.0.0.1") + ->setClientCountry('CZ') + ->setClientIP('127.0.0.1') ->setClientLocation(50.073658, 14.418540) ->validate($query); @@ -180,20 +182,20 @@ public function testWithClient() /** * Settings should not persist between calls. */ - public function testInstanceSettings() + public function testInstanceSettings(): void { // Name that will be sent to the API for validation. $query = [ - "name" => "Pavel" + 'name' => 'Pavel', ]; // Options that will be sent within the request. $options = [ - "dataScope" => "basic" + 'dataScope' => 'basic', ]; // Perform name validation with client information. - $response = $this->api->name() + $response = self::$api->name() ->setOptions($options) ->includeRequestDetails() ->validate($query); @@ -203,7 +205,7 @@ public function testInstanceSettings() $this->assertObjectHasProperty('query', $result); - $response = $this->api->name() + $response = self::$api->name() ->setOptions($options) ->validate($query); diff --git a/tests/Unit/Phone/PhoneValidateTest.php b/tests/Unit/Phone/PhoneValidateTest.php index dde82c4..b2daa9d 100644 --- a/tests/Unit/Phone/PhoneValidateTest.php +++ b/tests/Unit/Phone/PhoneValidateTest.php @@ -1,5 +1,7 @@ "+420607123456" + 'numberWithPrefix' => '+420607123456', ]; // Options that will be sent within the request. $options = [ - "validationType" => "extended" + 'validationType' => 'extended', ]; // Perform phone number validation. - $response = $this->api->phone()->setOptions($options)->validate($query); + $response = self::$api->phone()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. - $this->assertInstanceOf(Response::class, $response); - $this->assertEquals(200, $response->getStatus()); - $this->assertTrue($result->isValid); - $this->assertEquals("valid", $result->proposal); - $this->assertNotEmpty($result->data); + self::assertInstanceOf(Response::class, $response); + self::assertEquals(200, $response->getStatus()); + self::assertTrue($result->isValid); + self::assertEquals('valid', $result->proposal); + self::assertNotEmpty($result->data); } /** * Test invalid phone number. */ - public function testInvalid() + public function testInvalid(): void { // Phone number with prefix that will be sent to the API for validation. $query = [ - "numberWithPrefix" => "+42060712345" + 'numberWithPrefix' => '+42060712345', ]; // Options that will be sent within the request. $options = [ - "validationType" => "extended" + 'validationType' => 'extended', ]; // Perform phone number validation. - $response = $this->api->phone()->setOptions($options)->validate($query); + $response = self::$api->phone()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. - $this->assertInstanceOf(Response::class, $response); - $this->assertEquals(200, $response->getStatus()); - $this->assertFalse($result->isValid); - $this->assertEquals("invalid", $result->proposal); - $this->assertNotEmpty($result->errors); + self::assertInstanceOf(Response::class, $response); + self::assertEquals(200, $response->getStatus()); + self::assertFalse($result->isValid); + self::assertEquals('invalid', $result->proposal); + self::assertNotEmpty($result->errors); } /** * Test valid phone number with suggestion. */ - public function testValidWithSuggestion() + public function testValidWithSuggestion(): void { // Phone number and prefix that will be sent to the API for validation. $query = [ - "prefix" => "+48", - "number" => "728984101" + 'prefix' => '+48', + 'number' => '728984101', ]; // Options that will be sent within the request. $options = [ - "validationType" => "extended" + 'validationType' => 'extended', ]; // Perform phone number validation. - $response = $this->api->phone()->setOptions($options)->validate($query); + $response = self::$api->phone()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. - $this->assertInstanceOf(Response::class, $response); - $this->assertEquals(200, $response->getStatus()); - $this->assertTrue($result->isValid); - $this->assertEquals("validWithSuggestion", $result->proposal); - $this->assertNotEmpty($response->getSuggestions()); + self::assertInstanceOf(Response::class, $response); + self::assertEquals(200, $response->getStatus()); + self::assertTrue($result->isValid); + self::assertEquals('validWithSuggestion', $result->proposal); + self::assertNotEmpty($response->getSuggestions()); } /** * Test invalid phone number with correction. */ - public function testInvalidWithCorrection() + public function testInvalidWithCorrection(): void { // Phone number and prefix that will be sent to the API for validation. $query = [ - "prefix" => "+421", - "number" => "607123456" + 'prefix' => '+421', + 'number' => '607123456', ]; // Options that will be sent within the request. $options = [ - "validationType" => "extended" + 'validationType' => 'extended', ]; // Perform phone number validation. - $response = $this->api->phone()->setOptions($options)->validate($query); + $response = self::$api->phone()->setOptions($options)->validate($query); $result = $response->getResult(); // Assertions. - $this->assertInstanceOf(Response::class, $response); - $this->assertEquals(200, $response->getStatus()); - $this->assertFalse($result->isValid); - $this->assertEquals("invalidWithCorrection", $result->proposal); - $this->assertNotEmpty($response->getResultCorrected()); + self::assertInstanceOf(Response::class, $response); + self::assertEquals(200, $response->getStatus()); + self::assertFalse($result->isValid); + self::assertEquals('invalidWithCorrection', $result->proposal); + self::assertNotEmpty($response->getResultCorrected()); } /** * Test phone number validation with custom ID. */ - public function testWithCustomId() + public function testWithCustomId(): void { // Custom ID to identify the request. $customRequestID = 'orderPhoneValidation'; // Phone number with prefix that will be sent to the API for validation. $query = [ - "numberWithPrefix" => "+420607123456" + 'numberWithPrefix' => '+420607123456', ]; // Perform phone number validation. - $response = $this->api->phone() + $response = self::$api->phone() ->setCustomId($customRequestID) ->validate($query); $request = $response->getRequest(); // Assertions. - $this->assertInstanceOf(Response::class, $response); - $this->assertEquals(200, $response->getStatus()); - $this->assertNotEmpty($request->customId); + self::assertInstanceOf(Response::class, $response); + self::assertEquals(200, $response->getStatus()); + self::assertNotEmpty($request->customId); } /** * Test phone number validation with client information. */ - public function testWithClient() + public function testWithClient(): void { // Phone number with prefix that will be sent to the API for validation. $query = [ - "numberWithPrefix" => "+420607123456" + 'numberWithPrefix' => '+420607123456', ]; // Perform phone number validation with client information. - $response = $this->api->phone() - ->setClientCountry("CZ") - ->setClientIP("127.0.0.1") + $response = self::$api->phone() + ->setClientCountry('CZ') + ->setClientIP('127.0.0.1') ->setClientLocation(50.073658, 14.418540) ->validate($query); $result = $response->getResult(); // Assertions. - $this->assertInstanceOf(Response::class, $response); - $this->assertEquals(200, $response->getStatus()); - $this->assertTrue($result->isValid); + self::assertInstanceOf(Response::class, $response); + self::assertEquals(200, $response->getStatus()); + self::assertTrue($result->isValid); } /** * Settings should not persist between calls. */ - public function testInstanceSettings() + public function testInstanceSettings(): void { // Name that will be sent to the API for validation. $query = [ - "numberWithPrefix" => "+420607123456" + 'numberWithPrefix' => '+420607123456', ]; // Perform name validation with client information. - $response = $this->api->phone() + $response = self::$api->phone() ->includeRequestDetails() ->validate($query); $result = $response->getRequest(); - $this->assertObjectHasProperty('query', $result); + self::assertObjectHasProperty('query', $result); - $response = $this->api->phone() + $response = self::$api->phone() ->validate($query); $result = $response->getRequest(); - $this->assertObjectNotHasProperty('query', $result); + self::assertObjectNotHasProperty('query', $result); } }