diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 5bdc0de..7c70f41 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -16,10 +16,10 @@ jobs:
uses: php-actions/composer@40-env
with:
version: 2
- php_version: 7.4
+ php_version: 8.0
only_args: --prefer-dist --no-progress
- name: Run phpunit tests
- uses: php-actions/phpunit@v8
+ uses: php-actions/phpunit@v9
with:
configuration: ./phpunit.xml
diff --git a/composer.json b/composer.json
index 352104b..c9438f6 100644
--- a/composer.json
+++ b/composer.json
@@ -39,26 +39,30 @@
}
],
"require": {
- "php": ">=7.4",
+ "php": ">=8.0",
"ext-json": "*",
- "guzzlehttp/guzzle": "^6.5",
- "psr/log": "^1.1",
- "ramsey/uuid": "^3.9"
+ "ext-mbstring": "*",
+ "guzzlehttp/guzzle": "^7.4",
+ "psr/log": "^3",
+ "ramsey/uuid": "^4.2",
+ "myclabs/php-enum": "^1.8",
+ "illuminate/collections": "^8.70"
},
"require-dev": {
- "phpunit/phpunit": "^8.5"
+ "phpunit/phpunit": "^9.5"
},
"autoload": {
- "classmap": [
- "src/AtolOnline/Api/",
- "src/AtolOnline/Exceptions/",
- "src/AtolOnline/Entities/",
- "src/AtolOnline/Traits/",
- "src/AtolOnline/Constants/",
- "tests/"
- ],
- "files": [
- "src/helpers.php"
- ]
+ "psr-4": {
+ "AtolOnline\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "AtolOnline\\Tests\\": "tests/"
+ }
+ },
+ "scripts": {
+ "test": "vendor/bin/phpunit --colors=always",
+ "test-cov": "vendor/bin/phpunit --coverage-html coverage"
}
}
diff --git a/composer.lock b/composer.lock
index 47340ed..8acd671 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,41 +4,105 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "5e1b55b0c481ba8d05be29bf5310f5ef",
+ "content-hash": "b03e06fba2a861f7ce366484ec6421c3",
"packages": [
{
- "name": "guzzlehttp/guzzle",
- "version": "6.5.5",
+ "name": "brick/math",
+ "version": "0.9.3",
"source": {
"type": "git",
- "url": "https://github.com/guzzle/guzzle.git",
- "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e"
+ "url": "https://github.com/brick/math.git",
+ "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
- "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
+ "url": "https://api.github.com/repos/brick/math/zipball/ca57d18f028f84f777b2168cd1911b0dee2343ae",
+ "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae",
"shasum": ""
},
"require": {
"ext-json": "*",
- "guzzlehttp/promises": "^1.0",
- "guzzlehttp/psr7": "^1.6.1",
- "php": ">=5.5",
- "symfony/polyfill-intl-idn": "^1.17.0"
+ "php": "^7.1 || ^8.0"
},
"require-dev": {
+ "php-coveralls/php-coveralls": "^2.2",
+ "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0",
+ "vimeo/psalm": "4.9.2"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Brick\\Math\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Arbitrary-precision arithmetic library",
+ "keywords": [
+ "Arbitrary-precision",
+ "BigInteger",
+ "BigRational",
+ "arithmetic",
+ "bigdecimal",
+ "bignum",
+ "brick",
+ "math"
+ ],
+ "funding": [
+ {
+ "url": "https://github.com/BenMorel",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/brick/math",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-08-15T20:50:18+00:00"
+ },
+ {
+ "name": "guzzlehttp/guzzle",
+ "version": "7.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/guzzle.git",
+ "reference": "868b3571a039f0ebc11ac8f344f4080babe2cb94"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/868b3571a039f0ebc11ac8f344f4080babe2cb94",
+ "reference": "868b3571a039f0ebc11ac8f344f4080babe2cb94",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "guzzlehttp/promises": "^1.5",
+ "guzzlehttp/psr7": "^1.8.3 || ^2.1",
+ "php": "^7.2.5 || ^8.0",
+ "psr/http-client": "^1.0",
+ "symfony/deprecation-contracts": "^2.2"
+ },
+ "provide": {
+ "psr/http-client-implementation": "1.0"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.4.1",
"ext-curl": "*",
- "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
- "psr/log": "^1.1"
+ "php-http/client-integration-tests": "^3.0",
+ "phpunit/phpunit": "^8.5.5 || ^9.3.5",
+ "psr/log": "^1.1 || ^2.0 || ^3.0"
},
"suggest": {
+ "ext-curl": "Required for CURL handler support",
+ "ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "6.5-dev"
+ "dev-master": "7.4-dev"
}
},
"autoload": {
@@ -54,41 +118,82 @@
"MIT"
],
"authors": [
+ {
+ "name": "Graham Campbell",
+ "email": "hello@gjcampbell.co.uk",
+ "homepage": "https://github.com/GrahamCampbell"
+ },
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "Jeremy Lindblom",
+ "email": "jeremeamia@gmail.com",
+ "homepage": "https://github.com/jeremeamia"
+ },
+ {
+ "name": "George Mponos",
+ "email": "gmponos@gmail.com",
+ "homepage": "https://github.com/gmponos"
+ },
+ {
+ "name": "Tobias Nyholm",
+ "email": "tobias.nyholm@gmail.com",
+ "homepage": "https://github.com/Nyholm"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com",
+ "homepage": "https://github.com/sagikazarmark"
+ },
+ {
+ "name": "Tobias Schultze",
+ "email": "webmaster@tubo-world.de",
+ "homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle is a PHP HTTP client library",
- "homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
+ "psr-18",
+ "psr-7",
"rest",
"web service"
],
- "support": {
- "issues": "https://github.com/guzzle/guzzle/issues",
- "source": "https://github.com/guzzle/guzzle/tree/6.5"
- },
- "time": "2020-06-16T21:01:06+00:00"
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/Nyholm",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-10-18T09:52:00+00:00"
},
{
"name": "guzzlehttp/promises",
- "version": "1.4.1",
+ "version": "1.5.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
- "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d"
+ "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d",
- "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d",
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da",
+ "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da",
"shasum": ""
},
"require": {
@@ -100,7 +205,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.4-dev"
+ "dev-master": "1.5-dev"
}
},
"autoload": {
@@ -116,47 +221,75 @@
"MIT"
],
"authors": [
+ {
+ "name": "Graham Campbell",
+ "email": "hello@gjcampbell.co.uk",
+ "homepage": "https://github.com/GrahamCampbell"
+ },
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "Tobias Nyholm",
+ "email": "tobias.nyholm@gmail.com",
+ "homepage": "https://github.com/Nyholm"
+ },
+ {
+ "name": "Tobias Schultze",
+ "email": "webmaster@tubo-world.de",
+ "homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
- "support": {
- "issues": "https://github.com/guzzle/promises/issues",
- "source": "https://github.com/guzzle/promises/tree/1.4.1"
- },
- "time": "2021-03-07T09:25:29+00:00"
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/Nyholm",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-10-22T20:56:57+00:00"
},
{
"name": "guzzlehttp/psr7",
- "version": "1.8.2",
+ "version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
- "reference": "dc960a912984efb74d0a90222870c72c87f10c91"
+ "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91",
- "reference": "dc960a912984efb74d0a90222870c72c87f10c91",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/089edd38f5b8abba6cb01567c2a8aaa47cec4c72",
+ "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72",
"shasum": ""
},
"require": {
- "php": ">=5.4.0",
- "psr/http-message": "~1.0",
- "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
+ "php": "^7.2.5 || ^8.0",
+ "psr/http-factory": "^1.0",
+ "psr/http-message": "^1.0",
+ "ralouphie/getallheaders": "^3.0"
},
"provide": {
+ "psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
- "ext-zlib": "*",
- "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
+ "bamarni/composer-bin-plugin": "^1.4.1",
+ "http-interop/http-factory-tests": "^0.9",
+ "phpunit/phpunit": "^8.5.8 || ^9.3.10"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
@@ -164,30 +297,53 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.7-dev"
+ "dev-master": "2.1-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
- },
- "files": [
- "src/functions_include.php"
- ]
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
+ {
+ "name": "Graham Campbell",
+ "email": "hello@gjcampbell.co.uk",
+ "homepage": "https://github.com/GrahamCampbell"
+ },
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
+ {
+ "name": "George Mponos",
+ "email": "gmponos@gmail.com",
+ "homepage": "https://github.com/gmponos"
+ },
+ {
+ "name": "Tobias Nyholm",
+ "email": "tobias.nyholm@gmail.com",
+ "homepage": "https://github.com/Nyholm"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com",
+ "homepage": "https://github.com/sagikazarmark"
+ },
{
"name": "Tobias Schultze",
+ "email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com",
+ "homepage": "https://sagikazarmark.hu"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
@@ -201,61 +357,358 @@
"uri",
"url"
],
- "support": {
- "issues": "https://github.com/guzzle/psr7/issues",
- "source": "https://github.com/guzzle/psr7/tree/1.8.2"
- },
- "time": "2021-04-26T09:17:50+00:00"
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/Nyholm",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-10-06T17:43:30+00:00"
},
{
- "name": "paragonie/random_compat",
- "version": "v9.99.99",
+ "name": "illuminate/collections",
+ "version": "v8.70.2",
"source": {
"type": "git",
- "url": "https://github.com/paragonie/random_compat.git",
- "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
+ "url": "https://github.com/illuminate/collections.git",
+ "reference": "05f286ec5fd2dd286e8384577047efc375c8954c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
- "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
+ "url": "https://api.github.com/repos/illuminate/collections/zipball/05f286ec5fd2dd286e8384577047efc375c8954c",
+ "reference": "05f286ec5fd2dd286e8384577047efc375c8954c",
"shasum": ""
},
"require": {
- "php": "^7"
- },
- "require-dev": {
- "phpunit/phpunit": "4.*|5.*",
- "vimeo/psalm": "^1"
+ "illuminate/contracts": "^8.0",
+ "illuminate/macroable": "^8.0",
+ "php": "^7.3|^8.0"
},
"suggest": {
- "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
+ "symfony/var-dumper": "Required to use the dump method (^5.1.4)."
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "8.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Support\\": ""
+ },
+ "files": [
+ "helpers.php"
+ ]
+ },
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
- "name": "Paragon Initiative Enterprises",
- "email": "security@paragonie.com",
- "homepage": "https://paragonie.com"
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
}
],
- "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
- "keywords": [
- "csprng",
- "polyfill",
- "pseudorandom",
- "random"
- ],
- "support": {
- "email": "info@paragonie.com",
- "issues": "https://github.com/paragonie/random_compat/issues",
- "source": "https://github.com/paragonie/random_compat"
+ "description": "The Illuminate Collections package.",
+ "homepage": "https://laravel.com",
+ "time": "2021-10-22T18:01:46+00:00"
+ },
+ {
+ "name": "illuminate/contracts",
+ "version": "v8.70.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/contracts.git",
+ "reference": "e76f4bce73a2a1656add24bd5210ebc4b8af49c0"
},
- "time": "2018-07-02T15:55:56+00:00"
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/contracts/zipball/e76f4bce73a2a1656add24bd5210ebc4b8af49c0",
+ "reference": "e76f4bce73a2a1656add24bd5210ebc4b8af49c0",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.3|^8.0",
+ "psr/container": "^1.0",
+ "psr/simple-cache": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "8.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Contracts\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "The Illuminate Contracts package.",
+ "homepage": "https://laravel.com",
+ "time": "2021-10-22T18:01:46+00:00"
+ },
+ {
+ "name": "illuminate/macroable",
+ "version": "v8.70.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/illuminate/macroable.git",
+ "reference": "300aa13c086f25116b5f3cde3ca54ff5c822fb05"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/illuminate/macroable/zipball/300aa13c086f25116b5f3cde3ca54ff5c822fb05",
+ "reference": "300aa13c086f25116b5f3cde3ca54ff5c822fb05",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.3|^8.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "8.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Illuminate\\Support\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "The Illuminate Macroable package.",
+ "homepage": "https://laravel.com",
+ "time": "2020-10-27T15:20:30+00:00"
+ },
+ {
+ "name": "myclabs/php-enum",
+ "version": "1.8.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/myclabs/php-enum.git",
+ "reference": "b942d263c641ddb5190929ff840c68f78713e937"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/myclabs/php-enum/zipball/b942d263c641ddb5190929ff840c68f78713e937",
+ "reference": "b942d263c641ddb5190929ff840c68f78713e937",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "php": "^7.3 || ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.5",
+ "squizlabs/php_codesniffer": "1.*",
+ "vimeo/psalm": "^4.6.2"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "MyCLabs\\Enum\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP Enum contributors",
+ "homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
+ }
+ ],
+ "description": "PHP Enum implementation",
+ "homepage": "http://github.com/myclabs/php-enum",
+ "keywords": [
+ "enum"
+ ],
+ "funding": [
+ {
+ "url": "https://github.com/mnapoli",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-07-05T08:18:36+00:00"
+ },
+ {
+ "name": "psr/container",
+ "version": "1.1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/container.git",
+ "reference": "513e0666f7216c7459170d56df27dfcefe1689ea"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea",
+ "reference": "513e0666f7216c7459170d56df27dfcefe1689ea",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.4.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Psr\\Container\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common Container Interface (PHP FIG PSR-11)",
+ "homepage": "https://github.com/php-fig/container",
+ "keywords": [
+ "PSR-11",
+ "container",
+ "container-interface",
+ "container-interop",
+ "psr"
+ ],
+ "time": "2021-11-05T16:50:12+00:00"
+ },
+ {
+ "name": "psr/http-client",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-client.git",
+ "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
+ "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0 || ^8.0",
+ "psr/http-message": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Client\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP clients",
+ "homepage": "https://github.com/php-fig/http-client",
+ "keywords": [
+ "http",
+ "http-client",
+ "psr",
+ "psr-18"
+ ],
+ "time": "2020-06-29T06:28:15+00:00"
+ },
+ {
+ "name": "psr/http-factory",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-factory.git",
+ "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
+ "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.0.0",
+ "psr/http-message": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interfaces for PSR-7 HTTP message factories",
+ "keywords": [
+ "factory",
+ "http",
+ "message",
+ "psr",
+ "psr-17",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "time": "2019-04-30T12:38:16+00:00"
},
{
"name": "psr/http-message",
@@ -312,30 +765,30 @@
},
{
"name": "psr/log",
- "version": "1.1.4",
+ "version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
- "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
+ "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
- "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001",
+ "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001",
"shasum": ""
},
"require": {
- "php": ">=5.3.0"
+ "php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1.x-dev"
+ "dev-master": "3.x-dev"
}
},
"autoload": {
"psr-4": {
- "Psr\\Log\\": "Psr/Log/"
+ "Psr\\Log\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -355,10 +808,55 @@
"psr",
"psr-3"
],
- "support": {
- "source": "https://github.com/php-fig/log/tree/1.1.4"
+ "time": "2021-07-14T16:46:02+00:00"
+ },
+ {
+ "name": "psr/simple-cache",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/simple-cache.git",
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
},
- "time": "2021-05-03T11:20:27+00:00"
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\SimpleCache\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interfaces for simple caching",
+ "keywords": [
+ "cache",
+ "caching",
+ "psr",
+ "psr-16",
+ "simple-cache"
+ ],
+ "time": "2017-10-23T01:57:42+00:00"
},
{
"name": "ralouphie/getallheaders",
@@ -405,54 +903,142 @@
"time": "2019-03-08T08:55:37+00:00"
},
{
- "name": "ramsey/uuid",
- "version": "3.9.3",
+ "name": "ramsey/collection",
+ "version": "1.2.2",
"source": {
"type": "git",
- "url": "https://github.com/ramsey/uuid.git",
- "reference": "7e1633a6964b48589b142d60542f9ed31bd37a92"
+ "url": "https://github.com/ramsey/collection.git",
+ "reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ramsey/uuid/zipball/7e1633a6964b48589b142d60542f9ed31bd37a92",
- "reference": "7e1633a6964b48589b142d60542f9ed31bd37a92",
+ "url": "https://api.github.com/repos/ramsey/collection/zipball/cccc74ee5e328031b15640b51056ee8d3bb66c0a",
+ "reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a",
"shasum": ""
},
"require": {
+ "php": "^7.3 || ^8",
+ "symfony/polyfill-php81": "^1.23"
+ },
+ "require-dev": {
+ "captainhook/captainhook": "^5.3",
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
+ "ergebnis/composer-normalize": "^2.6",
+ "fakerphp/faker": "^1.5",
+ "hamcrest/hamcrest-php": "^2",
+ "jangregor/phpstan-prophecy": "^0.8",
+ "mockery/mockery": "^1.3",
+ "phpspec/prophecy-phpunit": "^2.0",
+ "phpstan/extension-installer": "^1",
+ "phpstan/phpstan": "^0.12.32",
+ "phpstan/phpstan-mockery": "^0.12.5",
+ "phpstan/phpstan-phpunit": "^0.12.11",
+ "phpunit/phpunit": "^8.5 || ^9",
+ "psy/psysh": "^0.10.4",
+ "slevomat/coding-standard": "^6.3",
+ "squizlabs/php_codesniffer": "^3.5",
+ "vimeo/psalm": "^4.4"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Ramsey\\Collection\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Ben Ramsey",
+ "email": "ben@benramsey.com",
+ "homepage": "https://benramsey.com"
+ }
+ ],
+ "description": "A PHP library for representing and manipulating collections.",
+ "keywords": [
+ "array",
+ "collection",
+ "hash",
+ "map",
+ "queue",
+ "set"
+ ],
+ "funding": [
+ {
+ "url": "https://github.com/ramsey",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/ramsey/collection",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-10-10T03:01:02+00:00"
+ },
+ {
+ "name": "ramsey/uuid",
+ "version": "4.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/ramsey/uuid.git",
+ "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df",
+ "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df",
+ "shasum": ""
+ },
+ "require": {
+ "brick/math": "^0.8 || ^0.9",
"ext-json": "*",
- "paragonie/random_compat": "^1 | ^2 | 9.99.99",
- "php": "^5.4 | ^7 | ^8",
- "symfony/polyfill-ctype": "^1.8"
+ "php": "^7.2 || ^8.0",
+ "ramsey/collection": "^1.0",
+ "symfony/polyfill-ctype": "^1.8",
+ "symfony/polyfill-php80": "^1.14"
},
"replace": {
"rhumsaa/uuid": "self.version"
},
"require-dev": {
- "codeception/aspect-mock": "^1 | ^2",
- "doctrine/annotations": "^1.2",
- "goaop/framework": "1.0.0-alpha.2 | ^1 | ^2.1",
- "jakub-onderka/php-parallel-lint": "^1",
- "mockery/mockery": "^0.9.11 | ^1",
+ "captainhook/captainhook": "^5.10",
+ "captainhook/plugin-composer": "^5.3",
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
+ "doctrine/annotations": "^1.8",
+ "ergebnis/composer-normalize": "^2.15",
+ "mockery/mockery": "^1.3",
"moontoast/math": "^1.1",
"paragonie/random-lib": "^2",
- "php-mock/php-mock-phpunit": "^0.3 | ^1.1",
- "phpunit/phpunit": "^4.8 | ^5.4 | ^6.5",
- "squizlabs/php_codesniffer": "^3.5"
+ "php-mock/php-mock": "^2.2",
+ "php-mock/php-mock-mockery": "^1.3",
+ "php-parallel-lint/php-parallel-lint": "^1.1",
+ "phpbench/phpbench": "^1.0",
+ "phpstan/extension-installer": "^1.0",
+ "phpstan/phpstan": "^0.12",
+ "phpstan/phpstan-mockery": "^0.12",
+ "phpstan/phpstan-phpunit": "^0.12",
+ "phpunit/phpunit": "^8.5 || ^9",
+ "slevomat/coding-standard": "^7.0",
+ "squizlabs/php_codesniffer": "^3.5",
+ "vimeo/psalm": "^4.9"
},
"suggest": {
- "ext-ctype": "Provides support for PHP Ctype functions",
- "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator",
- "ext-openssl": "Provides the OpenSSL extension for use with the OpenSslGenerator",
- "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator",
- "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).",
+ "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.",
+ "ext-ctype": "Enables faster processing of character classification using ctype functions.",
+ "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.",
+ "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.",
"paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter",
- "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid",
"ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type."
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.x-dev"
+ "dev-main": "4.x-dev"
+ },
+ "captainhook": {
+ "force-install": true
}
},
"autoload": {
@@ -467,48 +1053,100 @@
"license": [
"MIT"
],
- "authors": [
- {
- "name": "Ben Ramsey",
- "email": "ben@benramsey.com",
- "homepage": "https://benramsey.com"
- },
- {
- "name": "Marijn Huizendveld",
- "email": "marijn.huizendveld@gmail.com"
- },
- {
- "name": "Thibaud Fabre",
- "email": "thibaud@aztech.io"
- }
- ],
- "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).",
- "homepage": "https://github.com/ramsey/uuid",
+ "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).",
"keywords": [
"guid",
"identifier",
"uuid"
],
- "support": {
- "issues": "https://github.com/ramsey/uuid/issues",
- "rss": "https://github.com/ramsey/uuid/releases.atom",
- "source": "https://github.com/ramsey/uuid",
- "wiki": "https://github.com/ramsey/uuid/wiki"
- },
- "time": "2020-02-21T04:36:14+00:00"
+ "funding": [
+ {
+ "url": "https://github.com/ramsey",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-09-25T23:10:38+00:00"
},
{
- "name": "symfony/polyfill-ctype",
- "version": "v1.22.1",
+ "name": "symfony/deprecation-contracts",
+ "version": "v2.4.0",
"source": {
"type": "git",
- "url": "https://github.com/symfony/polyfill-ctype.git",
- "reference": "c6c942b1ac76c82448322025e084cadc56048b4e"
+ "url": "https://github.com/symfony/deprecation-contracts.git",
+ "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e",
- "reference": "c6c942b1ac76c82448322025e084cadc56048b4e",
+ "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627",
+ "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "2.4-dev"
+ },
+ "thanks": {
+ "name": "symfony/contracts",
+ "url": "https://github.com/symfony/contracts"
+ }
+ },
+ "autoload": {
+ "files": [
+ "function.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "A generic function and convention to trigger deprecation notices",
+ "homepage": "https://symfony.com",
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-03-23T23:28:01+00:00"
+ },
+ {
+ "name": "symfony/polyfill-ctype",
+ "version": "v1.23.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-ctype.git",
+ "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce",
+ "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"shasum": ""
},
"require": {
@@ -520,7 +1158,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.22-dev"
+ "dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -557,9 +1195,6 @@
"polyfill",
"portable"
],
- "support": {
- "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1"
- },
"funding": [
{
"url": "https://symfony.com/sponsor",
@@ -574,34 +1209,29 @@
"type": "tidelift"
}
],
- "time": "2021-01-07T16:49:33+00:00"
+ "time": "2021-02-19T12:13:01+00:00"
},
{
- "name": "symfony/polyfill-intl-idn",
- "version": "v1.22.1",
+ "name": "symfony/polyfill-php80",
+ "version": "v1.23.1",
"source": {
"type": "git",
- "url": "https://github.com/symfony/polyfill-intl-idn.git",
- "reference": "2d63434d922daf7da8dd863e7907e67ee3031483"
+ "url": "https://github.com/symfony/polyfill-php80.git",
+ "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/2d63434d922daf7da8dd863e7907e67ee3031483",
- "reference": "2d63434d922daf7da8dd863e7907e67ee3031483",
+ "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be",
+ "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be",
"shasum": ""
},
"require": {
- "php": ">=7.1",
- "symfony/polyfill-intl-normalizer": "^1.10",
- "symfony/polyfill-php72": "^1.10"
- },
- "suggest": {
- "ext-intl": "For best performance"
+ "php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.22-dev"
+ "dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -610,10 +1240,13 @@
},
"autoload": {
"psr-4": {
- "Symfony\\Polyfill\\Intl\\Idn\\": ""
+ "Symfony\\Polyfill\\Php80\\": ""
},
"files": [
"bootstrap.php"
+ ],
+ "classmap": [
+ "Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
@@ -622,31 +1255,26 @@
],
"authors": [
{
- "name": "Laurent Bassin",
- "email": "laurent@bassin.info"
+ "name": "Ion Bazan",
+ "email": "ion.bazan@gmail.com"
},
{
- "name": "Trevor Rowbotham",
- "email": "trevor.rowbotham@pm.me"
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
- "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
+ "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
- "idn",
- "intl",
"polyfill",
"portable",
"shim"
],
- "support": {
- "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.22.1"
- },
"funding": [
{
"url": "https://symfony.com/sponsor",
@@ -661,32 +1289,29 @@
"type": "tidelift"
}
],
- "time": "2021-01-22T09:19:47+00:00"
+ "time": "2021-07-28T13:41:28+00:00"
},
{
- "name": "symfony/polyfill-intl-normalizer",
- "version": "v1.22.1",
+ "name": "symfony/polyfill-php81",
+ "version": "v1.23.0",
"source": {
"type": "git",
- "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
- "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248"
+ "url": "https://github.com/symfony/polyfill-php81.git",
+ "reference": "e66119f3de95efc359483f810c4c3e6436279436"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/43a0283138253ed1d48d352ab6d0bdb3f809f248",
- "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248",
+ "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/e66119f3de95efc359483f810c4c3e6436279436",
+ "reference": "e66119f3de95efc359483f810c4c3e6436279436",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
- "suggest": {
- "ext-intl": "For best performance"
- },
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "1.22-dev"
+ "dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -695,7 +1320,7 @@
},
"autoload": {
"psr-4": {
- "Symfony\\Polyfill\\Intl\\Normalizer\\": ""
+ "Symfony\\Polyfill\\Php81\\": ""
},
"files": [
"bootstrap.php"
@@ -718,19 +1343,14 @@
"homepage": "https://symfony.com/contributors"
}
],
- "description": "Symfony polyfill for intl's Normalizer class and related functions",
+ "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
- "intl",
- "normalizer",
"polyfill",
"portable",
"shim"
],
- "support": {
- "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.1"
- },
"funding": [
{
"url": "https://symfony.com/sponsor",
@@ -745,83 +1365,7 @@
"type": "tidelift"
}
],
- "time": "2021-01-22T09:19:47+00:00"
- },
- {
- "name": "symfony/polyfill-php72",
- "version": "v1.22.1",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-php72.git",
- "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9",
- "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9",
- "shasum": ""
- },
- "require": {
- "php": ">=7.1"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-main": "1.22-dev"
- },
- "thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Polyfill\\Php72\\": ""
- },
- "files": [
- "bootstrap.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
- "homepage": "https://symfony.com",
- "keywords": [
- "compatibility",
- "polyfill",
- "portable",
- "shim"
- ],
- "support": {
- "source": "https://github.com/symfony/polyfill-php72/tree/v1.22.1"
- },
- "funding": [
- {
- "url": "https://symfony.com/sponsor",
- "type": "custom"
- },
- {
- "url": "https://github.com/fabpot",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
- "type": "tidelift"
- }
- ],
- "time": "2021-01-07T16:49:33+00:00"
+ "time": "2021-05-21T13:25:03+00:00"
}
],
"packages-dev": [
@@ -953,17 +1497,69 @@
"time": "2020-11-13T09:40:50+00:00"
},
{
- "name": "phar-io/manifest",
- "version": "2.0.1",
+ "name": "nikic/php-parser",
+ "version": "v4.13.1",
"source": {
"type": "git",
- "url": "https://github.com/phar-io/manifest.git",
- "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133"
+ "url": "https://github.com/nikic/PHP-Parser.git",
+ "reference": "63a79e8daa781cac14e5195e63ed8ae231dd10fd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133",
- "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/63a79e8daa781cac14e5195e63ed8ae231dd10fd",
+ "reference": "63a79e8daa781cac14e5195e63ed8ae231dd10fd",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=7.0"
+ },
+ "require-dev": {
+ "ircmaxell/php-yacc": "^0.0.7",
+ "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0"
+ },
+ "bin": [
+ "bin/php-parse"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.9-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PhpParser\\": "lib/PhpParser"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Nikita Popov"
+ }
+ ],
+ "description": "A PHP parser written in PHP",
+ "keywords": [
+ "parser",
+ "php"
+ ],
+ "time": "2021-11-03T20:52:16+00:00"
+ },
+ {
+ "name": "phar-io/manifest",
+ "version": "2.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phar-io/manifest.git",
+ "reference": "97803eca37d319dfa7826cc2437fc020857acb53"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53",
+ "reference": "97803eca37d319dfa7826cc2437fc020857acb53",
"shasum": ""
},
"require": {
@@ -1006,11 +1602,7 @@
}
],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
- "support": {
- "issues": "https://github.com/phar-io/manifest/issues",
- "source": "https://github.com/phar-io/manifest/tree/master"
- },
- "time": "2020-06-27T14:33:11+00:00"
+ "time": "2021-07-20T11:28:43+00:00"
},
{
"name": "phar-io/version",
@@ -1118,16 +1710,16 @@
},
{
"name": "phpdocumentor/reflection-docblock",
- "version": "5.2.2",
+ "version": "5.3.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
- "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556"
+ "reference": "622548b623e81ca6d78b721c5e029f4ce664f170"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556",
- "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170",
+ "reference": "622548b623e81ca6d78b721c5e029f4ce664f170",
"shasum": ""
},
"require": {
@@ -1138,7 +1730,8 @@
"webmozart/assert": "^1.9.1"
},
"require-dev": {
- "mockery/mockery": "~1.3.2"
+ "mockery/mockery": "~1.3.2",
+ "psalm/phar": "^4.8"
},
"type": "library",
"extra": {
@@ -1166,24 +1759,20 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
- "support": {
- "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
- "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master"
- },
- "time": "2020-09-03T19:13:55+00:00"
+ "time": "2021-10-19T17:43:47+00:00"
},
{
"name": "phpdocumentor/type-resolver",
- "version": "1.4.0",
+ "version": "1.5.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
- "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0"
+ "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
- "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
+ "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae",
+ "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"shasum": ""
},
"require": {
@@ -1191,7 +1780,8 @@
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
- "ext-tokenizer": "*"
+ "ext-tokenizer": "*",
+ "psalm/phar": "^4.8"
},
"type": "library",
"extra": {
@@ -1215,41 +1805,37 @@
}
],
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
- "support": {
- "issues": "https://github.com/phpDocumentor/TypeResolver/issues",
- "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0"
- },
- "time": "2020-09-17T18:55:26+00:00"
+ "time": "2021-10-02T14:08:47+00:00"
},
{
"name": "phpspec/prophecy",
- "version": "1.13.0",
+ "version": "1.14.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
- "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea"
+ "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea",
- "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e",
+ "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.2",
- "php": "^7.2 || ~8.0, <8.1",
+ "php": "^7.2 || ~8.0, <8.2",
"phpdocumentor/reflection-docblock": "^5.2",
"sebastian/comparator": "^3.0 || ^4.0",
"sebastian/recursion-context": "^3.0 || ^4.0"
},
"require-dev": {
- "phpspec/phpspec": "^6.0",
+ "phpspec/phpspec": "^6.0 || ^7.0",
"phpunit/phpunit": "^8.0 || ^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.11.x-dev"
+ "dev-master": "1.x-dev"
}
},
"autoload": {
@@ -1282,48 +1868,48 @@
"spy",
"stub"
],
- "support": {
- "issues": "https://github.com/phpspec/prophecy/issues",
- "source": "https://github.com/phpspec/prophecy/tree/1.13.0"
- },
- "time": "2021-03-17T13:42:18+00:00"
+ "time": "2021-09-10T09:02:12+00:00"
},
{
"name": "phpunit/php-code-coverage",
- "version": "7.0.14",
+ "version": "9.2.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "bb7c9a210c72e4709cdde67f8b7362f672f2225c"
+ "reference": "cf04e88a2e3c56fc1a65488afd493325b4c1bc3e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/bb7c9a210c72e4709cdde67f8b7362f672f2225c",
- "reference": "bb7c9a210c72e4709cdde67f8b7362f672f2225c",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cf04e88a2e3c56fc1a65488afd493325b4c1bc3e",
+ "reference": "cf04e88a2e3c56fc1a65488afd493325b4c1bc3e",
"shasum": ""
},
"require": {
"ext-dom": "*",
+ "ext-libxml": "*",
"ext-xmlwriter": "*",
- "php": ">=7.2",
- "phpunit/php-file-iterator": "^2.0.2",
- "phpunit/php-text-template": "^1.2.1",
- "phpunit/php-token-stream": "^3.1.1 || ^4.0",
- "sebastian/code-unit-reverse-lookup": "^1.0.1",
- "sebastian/environment": "^4.2.2",
- "sebastian/version": "^2.0.1",
- "theseer/tokenizer": "^1.1.3"
+ "nikic/php-parser": "^4.13.0",
+ "php": ">=7.3",
+ "phpunit/php-file-iterator": "^3.0.3",
+ "phpunit/php-text-template": "^2.0.2",
+ "sebastian/code-unit-reverse-lookup": "^2.0.2",
+ "sebastian/complexity": "^2.0",
+ "sebastian/environment": "^5.1.2",
+ "sebastian/lines-of-code": "^1.0.3",
+ "sebastian/version": "^3.0.1",
+ "theseer/tokenizer": "^1.2.0"
},
"require-dev": {
- "phpunit/phpunit": "^8.2.2"
+ "phpunit/phpunit": "^9.3"
},
"suggest": {
- "ext-xdebug": "^2.7.2"
+ "ext-pcov": "*",
+ "ext-xdebug": "*"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "7.0-dev"
+ "dev-master": "9.2-dev"
}
},
"autoload": {
@@ -1349,42 +1935,38 @@
"testing",
"xunit"
],
- "support": {
- "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
- "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.14"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-12-02T13:39:03+00:00"
+ "time": "2021-10-30T08:01:38+00:00"
},
{
"name": "phpunit/php-file-iterator",
- "version": "2.0.3",
+ "version": "3.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
- "reference": "4b49fb70f067272b659ef0174ff9ca40fdaa6357"
+ "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/4b49fb70f067272b659ef0174ff9ca40fdaa6357",
- "reference": "4b49fb70f067272b659ef0174ff9ca40fdaa6357",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8",
+ "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8",
"shasum": ""
},
"require": {
- "php": ">=7.1"
+ "php": ">=7.3"
},
"require-dev": {
- "phpunit/phpunit": "^8.5"
+ "phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0.x-dev"
+ "dev-master": "3.0-dev"
}
},
"autoload": {
@@ -1409,36 +1991,99 @@
"filesystem",
"iterator"
],
- "support": {
- "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
- "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.3"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T08:25:21+00:00"
+ "time": "2020-09-28T05:57:25+00:00"
},
{
- "name": "phpunit/php-text-template",
- "version": "1.2.1",
+ "name": "phpunit/php-invoker",
+ "version": "3.1.1",
"source": {
"type": "git",
- "url": "https://github.com/sebastianbergmann/php-text-template.git",
- "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
+ "url": "https://github.com/sebastianbergmann/php-invoker.git",
+ "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
- "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67",
+ "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.3"
+ },
+ "require-dev": {
+ "ext-pcntl": "*",
+ "phpunit/phpunit": "^9.3"
+ },
+ "suggest": {
+ "ext-pcntl": "*"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Invoke callables with a timeout",
+ "homepage": "https://github.com/sebastianbergmann/php-invoker/",
+ "keywords": [
+ "process"
+ ],
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2020-09-28T05:58:55+00:00"
+ },
+ {
+ "name": "phpunit/php-text-template",
+ "version": "2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28",
+ "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0-dev"
+ }
+ },
"autoload": {
"classmap": [
"src/"
@@ -1460,36 +2105,38 @@
"keywords": [
"template"
],
- "support": {
- "issues": "https://github.com/sebastianbergmann/php-text-template/issues",
- "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1"
- },
- "time": "2015-06-21T13:50:34+00:00"
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2020-10-26T05:33:50+00:00"
},
{
"name": "phpunit/php-timer",
- "version": "2.1.3",
+ "version": "5.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
- "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662"
+ "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662",
- "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2",
+ "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2",
"shasum": ""
},
"require": {
- "php": ">=7.1"
+ "php": ">=7.3"
},
"require-dev": {
- "phpunit/phpunit": "^8.5"
+ "phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.1-dev"
+ "dev-master": "5.0-dev"
}
},
"autoload": {
@@ -1513,90 +2160,26 @@
"keywords": [
"timer"
],
- "support": {
- "issues": "https://github.com/sebastianbergmann/php-timer/issues",
- "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T08:20:02+00:00"
- },
- {
- "name": "phpunit/php-token-stream",
- "version": "4.0.4",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-token-stream.git",
- "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3",
- "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3",
- "shasum": ""
- },
- "require": {
- "ext-tokenizer": "*",
- "php": "^7.3 || ^8.0"
- },
- "require-dev": {
- "phpunit/phpunit": "^9.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "4.0-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Wrapper around PHP's tokenizer extension.",
- "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
- "keywords": [
- "tokenizer"
- ],
- "support": {
- "issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
- "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master"
- },
- "funding": [
- {
- "url": "https://github.com/sebastianbergmann",
- "type": "github"
- }
- ],
- "abandoned": true,
- "time": "2020-08-04T08:28:15+00:00"
+ "time": "2020-10-26T13:16:10+00:00"
},
{
"name": "phpunit/phpunit",
- "version": "8.5.15",
+ "version": "9.5.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "038d4196d8e8cb405cd5e82cedfe413ad6eef9ef"
+ "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/038d4196d8e8cb405cd5e82cedfe413ad6eef9ef",
- "reference": "038d4196d8e8cb405cd5e82cedfe413ad6eef9ef",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a",
+ "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a",
"shasum": ""
},
"require": {
@@ -1607,32 +2190,35 @@
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
- "myclabs/deep-copy": "^1.10.0",
- "phar-io/manifest": "^2.0.1",
+ "myclabs/deep-copy": "^1.10.1",
+ "phar-io/manifest": "^2.0.3",
"phar-io/version": "^3.0.2",
- "php": ">=7.2",
- "phpspec/prophecy": "^1.10.3",
- "phpunit/php-code-coverage": "^7.0.12",
- "phpunit/php-file-iterator": "^2.0.2",
- "phpunit/php-text-template": "^1.2.1",
- "phpunit/php-timer": "^2.1.2",
- "sebastian/comparator": "^3.0.2",
- "sebastian/diff": "^3.0.2",
- "sebastian/environment": "^4.2.3",
- "sebastian/exporter": "^3.1.2",
- "sebastian/global-state": "^3.0.0",
- "sebastian/object-enumerator": "^3.0.3",
- "sebastian/resource-operations": "^2.0.1",
- "sebastian/type": "^1.1.3",
- "sebastian/version": "^2.0.1"
+ "php": ">=7.3",
+ "phpspec/prophecy": "^1.12.1",
+ "phpunit/php-code-coverage": "^9.2.7",
+ "phpunit/php-file-iterator": "^3.0.5",
+ "phpunit/php-invoker": "^3.1.1",
+ "phpunit/php-text-template": "^2.0.3",
+ "phpunit/php-timer": "^5.0.2",
+ "sebastian/cli-parser": "^1.0.1",
+ "sebastian/code-unit": "^1.0.6",
+ "sebastian/comparator": "^4.0.5",
+ "sebastian/diff": "^4.0.3",
+ "sebastian/environment": "^5.1.3",
+ "sebastian/exporter": "^4.0.3",
+ "sebastian/global-state": "^5.0.1",
+ "sebastian/object-enumerator": "^4.0.3",
+ "sebastian/resource-operations": "^3.0.3",
+ "sebastian/type": "^2.3.4",
+ "sebastian/version": "^3.0.2"
},
"require-dev": {
- "ext-pdo": "*"
+ "ext-pdo": "*",
+ "phpspec/prophecy-phpunit": "^2.0.1"
},
"suggest": {
"ext-soap": "*",
- "ext-xdebug": "*",
- "phpunit/php-invoker": "^2.0.0"
+ "ext-xdebug": "*"
},
"bin": [
"phpunit"
@@ -1640,12 +2226,15 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "8.5-dev"
+ "dev-master": "9.5-dev"
}
},
"autoload": {
"classmap": [
"src/"
+ ],
+ "files": [
+ "src/Framework/Assert/Functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
@@ -1666,10 +2255,6 @@
"testing",
"xunit"
],
- "support": {
- "issues": "https://github.com/sebastianbergmann/phpunit/issues",
- "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.15"
- },
"funding": [
{
"url": "https://phpunit.de/donate.html",
@@ -1680,32 +2265,136 @@
"type": "github"
}
],
- "time": "2021-03-17T07:27:54+00:00"
+ "time": "2021-09-25T07:38:51+00:00"
},
{
- "name": "sebastian/code-unit-reverse-lookup",
- "version": "1.0.2",
+ "name": "sebastian/cli-parser",
+ "version": "1.0.1",
"source": {
"type": "git",
- "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
- "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619"
+ "url": "https://github.com/sebastianbergmann/cli-parser.git",
+ "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619",
- "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619",
+ "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2",
+ "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2",
"shasum": ""
},
"require": {
- "php": ">=5.6"
+ "php": ">=7.3"
},
"require-dev": {
- "phpunit/phpunit": "^8.5"
+ "phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0.x-dev"
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library for parsing CLI options",
+ "homepage": "https://github.com/sebastianbergmann/cli-parser",
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2020-09-28T06:08:49+00:00"
+ },
+ {
+ "name": "sebastian/code-unit",
+ "version": "1.0.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/code-unit.git",
+ "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120",
+ "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Collection of value objects that represent the PHP code units",
+ "homepage": "https://github.com/sebastianbergmann/code-unit",
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2020-10-26T13:08:54+00:00"
+ },
+ {
+ "name": "sebastian/code-unit-reverse-lookup",
+ "version": "2.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
+ "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5",
+ "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0-dev"
}
},
"autoload": {
@@ -1725,44 +2414,40 @@
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
- "support": {
- "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
- "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T08:15:22+00:00"
+ "time": "2020-09-28T05:30:19+00:00"
},
{
"name": "sebastian/comparator",
- "version": "3.0.3",
+ "version": "4.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
- "reference": "1071dfcef776a57013124ff35e1fc41ccd294758"
+ "reference": "55f4261989e546dc112258c7a75935a81a7ce382"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758",
- "reference": "1071dfcef776a57013124ff35e1fc41ccd294758",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382",
+ "reference": "55f4261989e546dc112258c7a75935a81a7ce382",
"shasum": ""
},
"require": {
- "php": ">=7.1",
- "sebastian/diff": "^3.0",
- "sebastian/exporter": "^3.1"
+ "php": ">=7.3",
+ "sebastian/diff": "^4.0",
+ "sebastian/exporter": "^4.0"
},
"require-dev": {
- "phpunit/phpunit": "^8.5"
+ "phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -1799,43 +2484,92 @@
"compare",
"equality"
],
- "support": {
- "issues": "https://github.com/sebastianbergmann/comparator/issues",
- "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T08:04:30+00:00"
+ "time": "2020-10-26T15:49:45+00:00"
},
{
- "name": "sebastian/diff",
- "version": "3.0.3",
+ "name": "sebastian/complexity",
+ "version": "2.0.2",
"source": {
"type": "git",
- "url": "https://github.com/sebastianbergmann/diff.git",
- "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211"
+ "url": "https://github.com/sebastianbergmann/complexity.git",
+ "reference": "739b35e53379900cc9ac327b2147867b8b6efd88"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211",
- "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211",
+ "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88",
+ "reference": "739b35e53379900cc9ac327b2147867b8b6efd88",
"shasum": ""
},
"require": {
- "php": ">=7.1"
+ "nikic/php-parser": "^4.7",
+ "php": ">=7.3"
},
"require-dev": {
- "phpunit/phpunit": "^7.5 || ^8.0",
- "symfony/process": "^2 || ^3.3 || ^4"
+ "phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library for calculating the complexity of PHP code units",
+ "homepage": "https://github.com/sebastianbergmann/complexity",
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2020-10-26T15:52:27+00:00"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "4.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d",
+ "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.3",
+ "symfony/process": "^4.2 || ^5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -1865,37 +2599,33 @@
"unidiff",
"unified diff"
],
- "support": {
- "issues": "https://github.com/sebastianbergmann/diff/issues",
- "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T07:59:04+00:00"
+ "time": "2020-10-26T13:10:38+00:00"
},
{
"name": "sebastian/environment",
- "version": "4.2.4",
+ "version": "5.1.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
- "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0"
+ "reference": "388b6ced16caa751030f6a69e588299fa09200ac"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0",
- "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac",
+ "reference": "388b6ced16caa751030f6a69e588299fa09200ac",
"shasum": ""
},
"require": {
- "php": ">=7.1"
+ "php": ">=7.3"
},
"require-dev": {
- "phpunit/phpunit": "^7.5"
+ "phpunit/phpunit": "^9.3"
},
"suggest": {
"ext-posix": "*"
@@ -1903,7 +2633,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.2-dev"
+ "dev-master": "5.1-dev"
}
},
"autoload": {
@@ -1928,44 +2658,40 @@
"environment",
"hhvm"
],
- "support": {
- "issues": "https://github.com/sebastianbergmann/environment/issues",
- "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T07:53:42+00:00"
+ "time": "2020-09-28T05:52:38+00:00"
},
{
"name": "sebastian/exporter",
- "version": "3.1.3",
+ "version": "4.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
- "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e"
+ "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e",
- "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9",
+ "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9",
"shasum": ""
},
"require": {
- "php": ">=7.0",
- "sebastian/recursion-context": "^3.0"
+ "php": ">=7.3",
+ "sebastian/recursion-context": "^4.0"
},
"require-dev": {
"ext-mbstring": "*",
- "phpunit/phpunit": "^6.0"
+ "phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.1.x-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -2000,45 +2726,41 @@
}
],
"description": "Provides the functionality to export PHP variables for visualization",
- "homepage": "http://www.github.com/sebastianbergmann/exporter",
+ "homepage": "https://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
- "support": {
- "issues": "https://github.com/sebastianbergmann/exporter/issues",
- "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.3"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T07:47:53+00:00"
+ "time": "2021-11-11T14:18:36+00:00"
},
{
"name": "sebastian/global-state",
- "version": "3.0.1",
+ "version": "5.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
- "reference": "474fb9edb7ab891665d3bfc6317f42a0a150454b"
+ "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/474fb9edb7ab891665d3bfc6317f42a0a150454b",
- "reference": "474fb9edb7ab891665d3bfc6317f42a0a150454b",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49",
+ "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49",
"shasum": ""
},
"require": {
- "php": ">=7.2",
- "sebastian/object-reflector": "^1.1.1",
- "sebastian/recursion-context": "^3.0"
+ "php": ">=7.3",
+ "sebastian/object-reflector": "^2.0",
+ "sebastian/recursion-context": "^4.0"
},
"require-dev": {
"ext-dom": "*",
- "phpunit/phpunit": "^8.0"
+ "phpunit/phpunit": "^9.3"
},
"suggest": {
"ext-uopz": "*"
@@ -2046,7 +2768,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "5.0-dev"
}
},
"autoload": {
@@ -2069,44 +2791,93 @@
"keywords": [
"global state"
],
- "support": {
- "issues": "https://github.com/sebastianbergmann/global-state/issues",
- "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.1"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T07:43:24+00:00"
+ "time": "2021-06-11T13:31:12+00:00"
},
{
- "name": "sebastian/object-enumerator",
- "version": "3.0.4",
+ "name": "sebastian/lines-of-code",
+ "version": "1.0.3",
"source": {
"type": "git",
- "url": "https://github.com/sebastianbergmann/object-enumerator.git",
- "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2"
+ "url": "https://github.com/sebastianbergmann/lines-of-code.git",
+ "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2",
- "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2",
+ "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc",
+ "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc",
"shasum": ""
},
"require": {
- "php": ">=7.0",
- "sebastian/object-reflector": "^1.1.1",
- "sebastian/recursion-context": "^3.0"
+ "nikic/php-parser": "^4.6",
+ "php": ">=7.3"
},
"require-dev": {
- "phpunit/phpunit": "^6.0"
+ "phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0.x-dev"
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library for counting the lines of code in PHP source code",
+ "homepage": "https://github.com/sebastianbergmann/lines-of-code",
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2020-11-28T06:42:11+00:00"
+ },
+ {
+ "name": "sebastian/object-enumerator",
+ "version": "4.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/object-enumerator.git",
+ "reference": "5c9eeac41b290a3712d88851518825ad78f45c71"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71",
+ "reference": "5c9eeac41b290a3712d88851518825ad78f45c71",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.3",
+ "sebastian/object-reflector": "^2.0",
+ "sebastian/recursion-context": "^4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -2126,42 +2897,38 @@
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
- "support": {
- "issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
- "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T07:40:27+00:00"
+ "time": "2020-10-26T13:12:34+00:00"
},
{
"name": "sebastian/object-reflector",
- "version": "1.1.2",
+ "version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-reflector.git",
- "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d"
+ "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d",
- "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7",
+ "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7",
"shasum": ""
},
"require": {
- "php": ">=7.0"
+ "php": ">=7.3"
},
"require-dev": {
- "phpunit/phpunit": "^6.0"
+ "phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1-dev"
+ "dev-master": "2.0-dev"
}
},
"autoload": {
@@ -2181,42 +2948,38 @@
],
"description": "Allows reflection of object attributes, including inherited and non-public ones",
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
- "support": {
- "issues": "https://github.com/sebastianbergmann/object-reflector/issues",
- "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T07:37:18+00:00"
+ "time": "2020-10-26T13:14:26+00:00"
},
{
"name": "sebastian/recursion-context",
- "version": "3.0.1",
+ "version": "4.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
- "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb"
+ "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb",
- "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172",
+ "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172",
"shasum": ""
},
"require": {
- "php": ">=7.0"
+ "php": ">=7.3"
},
"require-dev": {
- "phpunit/phpunit": "^6.0"
+ "phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0.x-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -2244,39 +3007,38 @@
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
- "support": {
- "issues": "https://github.com/sebastianbergmann/recursion-context/issues",
- "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T07:34:24+00:00"
+ "time": "2020-10-26T13:17:30+00:00"
},
{
"name": "sebastian/resource-operations",
- "version": "2.0.2",
+ "version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/resource-operations.git",
- "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3"
+ "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3",
- "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3",
+ "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8",
+ "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8",
"shasum": ""
},
"require": {
- "php": ">=7.1"
+ "php": ">=7.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0-dev"
+ "dev-master": "3.0-dev"
}
},
"autoload": {
@@ -2296,42 +3058,38 @@
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
- "support": {
- "issues": "https://github.com/sebastianbergmann/resource-operations/issues",
- "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T07:30:19+00:00"
+ "time": "2020-09-28T06:45:17+00:00"
},
{
"name": "sebastian/type",
- "version": "1.1.4",
+ "version": "2.3.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
- "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4"
+ "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4",
- "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4",
+ "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914",
+ "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"shasum": ""
},
"require": {
- "php": ">=7.2"
+ "php": ">=7.3"
},
"require-dev": {
- "phpunit/phpunit": "^8.2"
+ "phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1-dev"
+ "dev-master": "2.3-dev"
}
},
"autoload": {
@@ -2352,39 +3110,35 @@
],
"description": "Collection of value objects that represent the types of the PHP type system",
"homepage": "https://github.com/sebastianbergmann/type",
- "support": {
- "issues": "https://github.com/sebastianbergmann/type/issues",
- "source": "https://github.com/sebastianbergmann/type/tree/1.1.4"
- },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
- "time": "2020-11-30T07:25:11+00:00"
+ "time": "2021-06-15T12:49:02+00:00"
},
{
"name": "sebastian/version",
- "version": "2.0.1",
+ "version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
- "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019"
+ "reference": "c6c1022351a901512170118436c764e473f6de8c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
- "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c",
+ "reference": "c6c1022351a901512170118436c764e473f6de8c",
"shasum": ""
},
"require": {
- "php": ">=5.6"
+ "php": ">=7.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0.x-dev"
+ "dev-master": "3.0-dev"
}
},
"autoload": {
@@ -2405,24 +3159,26 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
- "support": {
- "issues": "https://github.com/sebastianbergmann/version/issues",
- "source": "https://github.com/sebastianbergmann/version/tree/master"
- },
- "time": "2016-10-03T07:35:21+00:00"
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2020-09-28T06:39:44+00:00"
},
{
"name": "theseer/tokenizer",
- "version": "1.2.0",
+ "version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
- "reference": "75a63c33a8577608444246075ea0af0d052e452a"
+ "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a",
- "reference": "75a63c33a8577608444246075ea0af0d052e452a",
+ "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e",
+ "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e",
"shasum": ""
},
"require": {
@@ -2449,17 +3205,13 @@
}
],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
- "support": {
- "issues": "https://github.com/theseer/tokenizer/issues",
- "source": "https://github.com/theseer/tokenizer/tree/master"
- },
"funding": [
{
"url": "https://github.com/theseer",
"type": "github"
}
],
- "time": "2020-07-12T23:59:07+00:00"
+ "time": "2021-07-28T10:34:58+00:00"
},
{
"name": "webmozart/assert",
@@ -2526,9 +3278,10 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
- "php": ">=7.4",
- "ext-json": "*"
+ "php": ">=8.0",
+ "ext-json": "*",
+ "ext-mbstring": "*"
},
"platform-dev": [],
- "plugin-api-version": "2.0.0"
+ "plugin-api-version": "1.1.0"
}
diff --git a/phpunit.xml b/phpunit.xml
index 8814837..45ebb1c 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,4 +1,12 @@
+
+
-
- ClientTest.php
- CompanyTest.php
- VatTest.php
- ./tests/Unit
-
-
- ItemTest.php
- ./tests/Feature
+
+ ./tests
+
+
+
+ src
+
+
\ No newline at end of file
diff --git a/src/Api/Kkt.php b/src/Api/Kkt.php
new file mode 100644
index 0000000..7459c74
--- /dev/null
+++ b/src/Api/Kkt.php
@@ -0,0 +1,591 @@
+resetKktConfig();
+ if ($group) {
+ $this->setGroup($group);
+ }
+ if ($login) {
+ $this->setLogin($login);
+ }
+ if ($login) {
+ $this->setPassword($pass);
+ }
+ $this->setTestMode($test_mode);
+ $guzzle_config['base_uri'] = $this->getEndpoint();
+ $guzzle_config['http_errors'] = $guzzle_config['http_errors'] ?? false;
+ parent::__construct($guzzle_config);
+ }
+
+ /**
+ * Устанавливает группу доступа к ККТ
+ *
+ * @param string $group
+ * @return $this
+ */
+ public function setGroup(string $group): Kkt
+ {
+ $this->kkt_config['prod']['group'] = $group;
+ return $this;
+ }
+
+ /**
+ * Возвращает группу доступа к ККТ в соответствии с флагом тестового режима
+ *
+ * @return string
+ */
+ public function getGroup(): string
+ {
+ return $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['group'];
+ }
+
+ /**
+ * Устанавливает логин доступа к ККТ
+ *
+ * @param string $login
+ * @return $this
+ * @throws EmptyKktLoginException Логин ККТ не может быть пустым
+ * @throws TooLongKktLoginException Слишком длинный логин ККТ
+ */
+ public function setLogin(string $login): Kkt
+ {
+ if (empty($login)) {
+ throw new EmptyKktLoginException();
+ } elseif (mb_strlen($login) > Constraints::MAX_LENGTH_LOGIN) {
+ throw new TooLongKktLoginException($login, Constraints::MAX_LENGTH_LOGIN);
+ }
+ $this->kkt_config['prod']['login'] = $login;
+ return $this;
+ }
+
+ /**
+ * Возвращает логин доступа к ККТ в соответствии с флагом тестового режима
+ *
+ * @return string
+ */
+ public function getLogin(): string
+ {
+ return $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['login'];
+ }
+
+ /**
+ * Устанавливает пароль доступа к ККТ
+ *
+ * @param string $password
+ * @return $this
+ * @throws EmptyKktPasswordException Пароль ККТ не может быть пустым
+ * @throws TooLongKktPasswordException Слишком длинный пароль ККТ
+ */
+ public function setPassword(string $password): Kkt
+ {
+ if (empty($password)) {
+ throw new EmptyKktPasswordException();
+ } elseif (mb_strlen($password) > Constraints::MAX_LENGTH_PASSWORD) {
+ throw new TooLongKktPasswordException($password, Constraints::MAX_LENGTH_PASSWORD);
+ }
+ $this->kkt_config['prod']['pass'] = $password;
+ return $this;
+ }
+
+ /**
+ * Возвращает логин ККТ в соответствии с флагом тестового режима
+ *
+ * @return string
+ */
+ public function getPassword(): string
+ {
+ return $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['pass'];
+ }
+
+ /**
+ * Устанавливает URL для приёма колбеков
+ *
+ * @param string $url
+ * @return $this
+ * @throws TooLongCallbackUrlException Слишком длинный Callback URL
+ * @throws InvalidCallbackUrlException Невалидный Callback URL
+ */
+ public function setCallbackUrl(string $url): Kkt
+ {
+ if (mb_strlen($url) > Constraints::MAX_LENGTH_CALLBACK_URL) {
+ throw new TooLongCallbackUrlException($url, Constraints::MAX_LENGTH_CALLBACK_URL);
+ } elseif (!preg_match(Constraints::PATTERN_CALLBACK_URL, $url)) {
+ throw new InvalidCallbackUrlException('Callback URL not matches with pattern');
+ }
+ $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['callback_url'] = $url;
+ return $this;
+ }
+
+ /**
+ * Возвращает URL для приёма колбеков
+ *
+ * @return string
+ */
+ public function getCallbackUrl(): string
+ {
+ return $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['callback_url'];
+ }
+
+ /**
+ * Возвращает последний ответ сервера
+ *
+ * @return KktResponse|null
+ */
+ public function getLastResponse(): ?KktResponse
+ {
+ return $this->last_response;
+ }
+
+ /**
+ * Возвращает флаг тестового режима
+ *
+ * @return bool
+ */
+ public function isTestMode(): bool
+ {
+ return $this->is_test_mode;
+ }
+
+ /**
+ * Устанавливает флаг тестового режима
+ *
+ * @param bool $test_mode
+ * @return $this
+ */
+ public function setTestMode(bool $test_mode = true): Kkt
+ {
+ $this->is_test_mode = $test_mode;
+ return $this;
+ }
+
+ /**
+ * Регистрирует документ прихода
+ *
+ * @param Document $document Объект документа
+ * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
+ * @return KktResponse
+ * @throws AuthFailedException Ошибка авторизации
+ * @throws EmptyCorrectionInfoException В документе есть данные коррекции
+ * @throws InvalidInnLengthException Некорректная длина ИНН
+ * @throws TooLongPaymentAddressException Слишком длинный адрес места расчётов
+ * @throws InvalidDocumentTypeException Некорректный тип документа
+ * @throws GuzzleException
+ */
+ public function sell(Document $document, ?string $external_id = null): KktResponse
+ {
+ if ($document->getCorrectionInfo()) {
+ throw new EmptyCorrectionInfoException('Некорректная операция над документом коррекции');
+ }
+ return $this->registerDocument('sell', 'receipt', $document, $external_id);
+ }
+
+ /**
+ * Регистрирует документ возврата прихода
+ *
+ * @param Document $document Объект документа
+ * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
+ * @return KktResponse
+ * @throws AuthFailedException Ошибка авторизации
+ * @throws EmptyCorrectionInfoException В документе есть данные коррекции
+ * @throws InvalidInnLengthException Некорректная длина ИНН
+ * @throws TooLongPaymentAddressException Слишком длинный адрес места расчётов
+ * @throws TooManyVatsException Слишком много ставок НДС
+ * @throws InvalidDocumentTypeException Некорректный тип документа
+ * @throws GuzzleException
+ */
+ public function sellRefund(Document $document, ?string $external_id = null): KktResponse
+ {
+ if ($document->getCorrectionInfo()) {
+ throw new EmptyCorrectionInfoException('Invalid operation on correction document');
+ }
+ return $this->registerDocument('sell_refund', 'receipt', $document->clearVats(), $external_id);
+ }
+
+ /**
+ * Регистрирует документ коррекции прихода
+ *
+ * @param Document $document Объект документа
+ * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
+ * @return KktResponse
+ * @throws AuthFailedException Ошибка авторизации
+ * @throws EmptyCorrectionInfoException В документе отсутствуют данные коррекции
+ * @throws InvalidInnLengthException Некорректная длина ИНН
+ * @throws TooLongPaymentAddressException Слишком длинный адрес места расчётов
+ * @throws TooManyItemsException Слишком много предметов расчёта
+ * @throws InvalidDocumentTypeException Некорректный тип документа
+ * @throws GuzzleException
+ */
+ public function sellCorrection(Document $document, ?string $external_id = null): KktResponse
+ {
+ if (!$document->getCorrectionInfo()) {
+ throw new EmptyCorrectionInfoException();
+ }
+ $document->setClient(null)->setItems([]);
+ return $this->registerDocument('sell_correction', 'correction', $document, $external_id);
+ }
+
+ /**
+ * Регистрирует документ расхода
+ *
+ * @param Document $document
+ * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
+ * @return KktResponse
+ * @throws AuthFailedException Ошибка авторизации
+ * @throws EmptyCorrectionInfoException В документе есть данные коррекции
+ * @throws InvalidInnLengthException Некорректная длина ИНН
+ * @throws TooLongPaymentAddressException Слишком длинный адрес места расчётов
+ * @throws InvalidDocumentTypeException Некорректный тип документа
+ * @throws GuzzleException
+ */
+ public function buy(Document $document, ?string $external_id = null): KktResponse
+ {
+ if ($document->getCorrectionInfo()) {
+ throw new EmptyCorrectionInfoException('Invalid operation on correction document');
+ }
+ return $this->registerDocument('buy', 'receipt', $document, $external_id);
+ }
+
+ /**
+ * Регистрирует документ возврата расхода
+ *
+ * @param Document $document
+ * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
+ * @return KktResponse
+ * @throws AuthFailedException Ошибка авторизации
+ * @throws EmptyCorrectionInfoException В документе есть данные коррекции
+ * @throws InvalidInnLengthException Некорректная длина ИНН
+ * @throws TooLongPaymentAddressException Слишком длинный адрес места расчётов
+ * @throws TooManyVatsException Слишком много ставок НДС
+ * @throws InvalidDocumentTypeException Некорректный тип документа
+ * @throws GuzzleException
+ */
+ public function buyRefund(Document $document, ?string $external_id = null): KktResponse
+ {
+ if ($document->getCorrectionInfo()) {
+ throw new EmptyCorrectionInfoException('Invalid operation on correction document');
+ }
+ return $this->registerDocument('buy_refund', 'receipt', $document->clearVats(), $external_id);
+ }
+
+ /**
+ * Регистрирует документ коррекции расхода
+ *
+ * @param Document $document
+ * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
+ * @return KktResponse
+ * @throws AuthFailedException Ошибка авторизации
+ * @throws EmptyCorrectionInfoException В документе отсутствуют данные коррекции
+ * @throws InvalidInnLengthException Некорректная длтина ИНН
+ * @throws TooLongPaymentAddressException Слишком длинный адрес места расчётов
+ * @throws TooManyItemsException Слишком много предметов расчёта
+ * @throws InvalidDocumentTypeException Некорректный тип документа
+ * @throws GuzzleException
+ */
+ public function buyCorrection(Document $document, ?string $external_id = null): KktResponse
+ {
+ if (!$document->getCorrectionInfo()) {
+ throw new EmptyCorrectionInfoException();
+ }
+ $document->setClient(null)->setItems([]);
+ return $this->registerDocument('buy_correction', 'correction', $document, $external_id);
+ }
+
+ /**
+ * Проверяет статус чека на ККТ один раз
+ *
+ * @param string $uuid UUID регистрации
+ * @return KktResponse
+ * @throws AuthFailedException Ошибка авторизации
+ * @throws InvalidUuidException Некорректный UUID документа
+ * @throws GuzzleException
+ */
+ public function getDocumentStatus(string $uuid): KktResponse
+ {
+ $uuid = trim($uuid);
+ if (!Uuid::isValid($uuid)) {
+ throw new InvalidUuidException($uuid);
+ }
+ $this->auth();
+ return $this->sendAtolRequest('GET', 'report/' . $uuid);
+ }
+
+ /**
+ * Проверяет статус чека на ККТ нужное количество раз с указанным интервалом.
+ * Вернёт результат как только при очередной проверке сменится статус регистрации документа.
+ *
+ * @param string $uuid UUID регистрации
+ * @param int $retry_count Количество попыток
+ * @param int $timeout Таймаут в секундах между попытками
+ * @return KktResponse
+ * @throws AuthFailedException Ошибка авторизации
+ * @throws InvalidUuidException Некорректный UUID документа
+ * @throws GuzzleException
+ */
+ public function pollDocumentStatus(string $uuid, int $retry_count = 5, int $timeout = 1): KktResponse
+ {
+ $try = 0;
+ do {
+ $response = $this->getDocumentStatus($uuid);
+ if ($response->isValid() && $response->getContent()->status == 'done') {
+ break;
+ } else {
+ sleep($timeout);
+ }
+ ++$try;
+ } while ($try < $retry_count);
+ return $response;
+ }
+
+ /**
+ * Возвращает текущий токен авторизации
+ *
+ * @return string
+ */
+ public function getAuthToken(): ?string
+ {
+ return $this->auth_token;
+ }
+
+ /**
+ * Устанавливает заранее известный токен авторизации
+ *
+ * @param string|null $auth_token
+ * @return $this
+ */
+ public function setAuthToken(?string $auth_token): Kkt
+ {
+ $this->auth_token = $auth_token;
+ return $this;
+ }
+
+ /**
+ * Сбрасывает настройки ККТ по умолчанию
+ */
+ protected function resetKktConfig(): void
+ {
+ $this->kkt_config['prod']['group'] = '';
+ $this->kkt_config['prod']['login'] = '';
+ $this->kkt_config['prod']['pass'] = '';
+ $this->kkt_config['prod']['url'] = 'https://online.atol.ru/possystem/v4';
+ $this->kkt_config['prod']['callback_url'] = '';
+ $this->kkt_config['test']['group'] = TestEnvParams::FFD105()['group'];
+ $this->kkt_config['test']['login'] = TestEnvParams::FFD105()['login'];
+ $this->kkt_config['test']['pass'] = TestEnvParams::FFD105()['password'];
+ $this->kkt_config['test']['url'] = 'https://testonline.atol.ru/possystem/v4';
+ $this->kkt_config['test']['callback_url'] = '';
+ }
+
+ /**
+ * Возвращает набор заголовков для HTTP-запроса
+ *
+ * @return array
+ */
+ protected function getHeaders(): array
+ {
+ $headers['Content-type'] = 'application/json; charset=utf-8';
+ if ($this->getAuthToken()) {
+ $headers['Token'] = $this->getAuthToken();
+ }
+ return $headers;
+ }
+
+ /**
+ * Возвращает адрес сервера в соответствии с флагом тестового режима
+ *
+ * @return string
+ */
+ protected function getEndpoint(): string
+ {
+ return $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['url'];
+ }
+
+ /**
+ * Возвращает полный URL до метода API
+ *
+ * @param string $to_method
+ * @param array|null $get_parameters
+ * @return string
+ */
+ protected function makeUrl(string $to_method, array $get_parameters = null): string
+ {
+ $url = $this->getEndpoint() . ($this->getAuthToken() ? '/' . $this->getGroup() : '') . '/' . $to_method;
+ if ($get_parameters && is_array($get_parameters)) {
+ $url .= '?' . http_build_query($get_parameters);
+ }
+ return $url;
+ }
+
+ /**
+ * Делает запрос, возвращает декодированный ответ
+ *
+ * @param string $http_method Метод HTTP (GET, POST и пр)
+ * @param string $api_method Метод API
+ * @param mixed $data Данные для передачи
+ * @param array|null $options Параметры Guzzle
+ * @return KktResponse
+ * @throws GuzzleException
+ * @see https://guzzle.readthedocs.io/en/latest/request-options.html
+ */
+ protected function sendAtolRequest(
+ string $http_method,
+ string $api_method,
+ $data = null,
+ array $options = null
+ ): KktResponse {
+ $http_method = strtoupper($http_method);
+ $options['headers'] = $this->getHeaders();
+ $url = $http_method == 'GET'
+ ? $this->makeUrl($api_method, $data)
+ : $this->makeUrl($api_method, ['token' => $this->getAuthToken()]);
+ if ($http_method != 'GET') {
+ $options['json'] = $data;
+ }
+ $response = $this->request($http_method, $url, $options);
+ return $this->last_response = new KktResponse($response);
+ }
+
+ /**
+ * Производит авторизацию на ККТ и получает токен доступа для дальнейших HTTP-запросов
+ *
+ * @return bool
+ * @throws AuthFailedException Ошибка авторизации
+ * @throws GuzzleException
+ */
+ protected function auth(): bool
+ {
+ if (!$this->getAuthToken()) {
+ $result = $this->sendAtolRequest('GET', 'getToken', [
+ 'login' => $this->getLogin(),
+ 'pass' => $this->getPassword(),
+ ]);
+ if (!$result->isValid() || !$result->getContent()->token) {
+ throw new AuthFailedException($result);
+ }
+ $this->auth_token = $result->getContent()->token;
+ }
+ return true;
+ }
+
+ /**
+ * Отправляет документ на регистрацию
+ *
+ * @param string $api_method Метод API
+ * @param string $type Тип документа: receipt, correction
+ * @param Document $document Объект документа
+ * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
+ * @return KktResponse
+ * @throws AuthFailedException Ошибка авторизации
+ * @throws InvalidDocumentTypeException Некорректный тип документа
+ * @throws InvalidInnLengthException Некорректная длина ИНН
+ * @throws TooLongPaymentAddressException Слишком длинный адрес места расчётов
+ * @throws GuzzleException
+ * @throws Exception
+ */
+ protected function registerDocument(
+ string $api_method,
+ string $type,
+ Document $document,
+ ?string $external_id = null
+ ): KktResponse {
+ $type = trim($type);
+ if (!in_array($type, ['receipt', 'correction'])) {
+ throw new InvalidDocumentTypeException($type);
+ }
+ $this->auth();
+ if ($this->isTestMode()) {
+ $document->setCompany(($document->getCompany() ?: new Company())
+ ->setInn(TestEnvParams::FFD105()['inn'])
+ ->setSno(TestEnvParams::FFD105()['sno'])
+ ->setPaymentAddress(TestEnvParams::FFD105()['payment_address']));
+ }
+ $data['timestamp'] = date('d.m.y H:i:s');
+ $data['external_id'] = $external_id ?: Uuid::uuid4()->toString();
+ $data[$type] = $document;
+ if ($this->getCallbackUrl()) {
+ $data['service'] = ['callback_url' => $this->getCallbackUrl()];
+ }
+ return $this->sendAtolRequest('POST', trim($api_method), $data);
+ }
+}
diff --git a/src/AtolOnline/Api/KktResponse.php b/src/Api/KktResponse.php
similarity index 85%
rename from src/AtolOnline/Api/KktResponse.php
rename to src/Api/KktResponse.php
index c52bb9b..7fe359a 100644
--- a/src/AtolOnline/Api/KktResponse.php
+++ b/src/Api/KktResponse.php
@@ -1,12 +1,14 @@
code = $response->getStatusCode();
$this->headers = $response->getHeaders();
- $this->content = json_decode($response->getBody());
+ $this->content = json_decode((string)$response->getBody());
}
/**
@@ -93,12 +96,12 @@ class KktResponse implements JsonSerializable
*
* @return bool
*/
- public function isValid()
+ public function isValid(): bool
{
return !empty($this->getCode())
&& !empty($this->getContent())
&& empty($this->getContent()->error)
- && (int)$this->getCode() < 400;
+ && $this->getCode() < 400;
}
/**
diff --git a/src/AtolOnline/Api/Kkt.php b/src/AtolOnline/Api/Kkt.php
deleted file mode 100644
index 54c2d45..0000000
--- a/src/AtolOnline/Api/Kkt.php
+++ /dev/null
@@ -1,576 +0,0 @@
-resetKktConfig();
- if ($group) {
- $this->setGroup($group);
- }
- if ($login) {
- $this->setLogin($login);
- }
- if ($login) {
- $this->setPassword($pass);
- }
- $this->setTestMode($test_mode);
- $guzzle_config['base_uri'] = $this->getEndpoint();
- $guzzle_config['http_errors'] = $guzzle_config['http_errors'] ?? false;
- parent::__construct($guzzle_config);
- }
-
- /**
- * Устанавливает группу доступа к ККТ
- *
- * @param string $group
- * @return $this
- */
- public function setGroup(string $group)
- {
- $this->kkt_config['prod']['group'] = $group;
- return $this;
- }
-
- /**
- * Возвращает группу доступа к ККТ в соответствии с флагом тестового режима
- *
- * @return string
- */
- public function getGroup(): string
- {
- return $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['group'];
- }
-
- /**
- * Устанавливает логин доступа к ККТ
- *
- * @param string $login
- * @return $this
- * @throws \AtolOnline\Exceptions\AtolKktLoginEmptyException Логин ККТ не может быть пустым
- * @throws \AtolOnline\Exceptions\AtolKktLoginTooLongException Слишком длинный логин ККТ
- */
- public function setLogin(string $login)
- {
- if (empty($login)) {
- throw new AtolKktLoginEmptyException();
- } elseif (valid_strlen($login) > Constraints::MAX_LENGTH_LOGIN) {
- throw new AtolKktLoginTooLongException($login, Constraints::MAX_LENGTH_LOGIN);
- }
- $this->kkt_config['prod']['login'] = $login;
- return $this;
- }
-
- /**
- * Возвращает логин доступа к ККТ в соответствии с флагом тестового режима
- *
- * @return string
- */
- public function getLogin(): string
- {
- return $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['login'];
- }
-
- /**
- * Устанавливает пароль доступа к ККТ
- *
- * @param string $password
- * @return $this
- * @throws \AtolOnline\Exceptions\AtolKktPasswordEmptyException Пароль ККТ не может быть пустым
- * @throws \AtolOnline\Exceptions\AtolKktPasswordTooLongException Слишком длинный пароль ККТ
- */
- public function setPassword(string $password)
- {
- if (empty($password)) {
- throw new AtolKktPasswordEmptyException();
- } elseif (valid_strlen($password) > Constraints::MAX_LENGTH_PASSWORD) {
- throw new AtolKktPasswordTooLongException($password, Constraints::MAX_LENGTH_PASSWORD);
- }
- $this->kkt_config['prod']['pass'] = $password;
- return $this;
- }
-
- /**
- * Возвращает логин ККТ в соответствии с флагом тестового режима
- *
- * @return string
- */
- public function getPassword(): string
- {
- return $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['pass'];
- }
-
- /**
- * Устанавливает URL для приёма колбеков
- *
- * @param string $url
- * @return $this
- * @throws \AtolOnline\Exceptions\AtolCallbackUrlTooLongException Слишком длинный Callback URL
- * @throws \AtolOnline\Exceptions\AtolInvalidCallbackUrlException Невалидный Callback URL
- */
- public function setCallbackUrl(string $url)
- {
- if (valid_strlen($url) > Constraints::MAX_LENGTH_CALLBACK_URL) {
- throw new AtolCallbackUrlTooLongException($url, Constraints::MAX_LENGTH_CALLBACK_URL);
- } elseif (!preg_match(Constraints::PATTERN_CALLBACK_URL, $url)) {
- throw new AtolInvalidCallbackUrlException('Callback URL not matches with pattern');
- }
- $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['callback_url'] = $url;
- return $this;
- }
-
- /**
- * Возвращает URL для приёма колбеков
- *
- * @return string
- */
- public function getCallbackUrl(): string
- {
- return $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['callback_url'];
- }
-
- /**
- * Возвращает последний ответ сервера
- *
- * @return mixed
- */
- public function getLastResponse()
- {
- return $this->last_response;
- }
-
- /**
- * Возвращает флаг тестового режима
- *
- * @return bool
- */
- public function isTestMode(): bool
- {
- return $this->is_test_mode;
- }
-
- /**
- * Устанавливает флаг тестового режима
- *
- * @param bool $test_mode
- * @return $this
- */
- public function setTestMode(bool $test_mode = true)
- {
- $this->is_test_mode = $test_mode;
- return $this;
- }
-
- /**
- * Регистрирует документ прихода
- *
- * @param \AtolOnline\Entities\Document $document Объект документа
- * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
- * @return \AtolOnline\Api\KktResponse
- * @throws \AtolOnline\Exceptions\AtolAuthFailedException Ошибка авторизации
- * @throws \AtolOnline\Exceptions\AtolCorrectionInfoException В документе есть данные коррекции
- * @throws \AtolOnline\Exceptions\AtolInnWrongLengthException Некорректная длина ИНН
- * @throws \AtolOnline\Exceptions\AtolPaymentAddressTooLongException Слишком длинный адрес места расчётов
- * @throws \AtolOnline\Exceptions\AtolWrongDocumentTypeException Некорректный тип документа
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function sell(Document $document, ?string $external_id = null)
- {
- if ($document->getCorrectionInfo()) {
- throw new AtolCorrectionInfoException('Некорректная операция над документом коррекции');
- }
- return $this->registerDocument('sell', 'receipt', $document, $external_id);
- }
-
- /**
- * Регистрирует документ возврата прихода
- *
- * @param \AtolOnline\Entities\Document $document Объект документа
- * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
- * @return \AtolOnline\Api\KktResponse
- * @throws \AtolOnline\Exceptions\AtolAuthFailedException Ошибка авторизации
- * @throws \AtolOnline\Exceptions\AtolCorrectionInfoException В документе есть данные коррекции
- * @throws \AtolOnline\Exceptions\AtolInnWrongLengthException Некорректная длина ИНН
- * @throws \AtolOnline\Exceptions\AtolPaymentAddressTooLongException Слишком длинный адрес места расчётов
- * @throws \AtolOnline\Exceptions\AtolPriceTooHighException Слишком большая сумма
- * @throws \AtolOnline\Exceptions\AtolTooManyVatsException Слишком много ставок НДС
- * @throws \AtolOnline\Exceptions\AtolWrongDocumentTypeException Некорректный тип документа
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function sellRefund(Document $document, ?string $external_id = null)
- {
- if ($document->getCorrectionInfo()) {
- throw new AtolCorrectionInfoException('Invalid operation on correction document');
- }
- return $this->registerDocument('sell_refund', 'receipt', $document->clearVats(), $external_id);
- }
-
- /**
- * Регистрирует документ коррекции прихода
- *
- * @param \AtolOnline\Entities\Document $document Объект документа
- * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
- * @return \AtolOnline\Api\KktResponse
- * @throws \AtolOnline\Exceptions\AtolAuthFailedException Ошибка авторизации
- * @throws \AtolOnline\Exceptions\AtolCorrectionInfoException В документе отсутствуют данные коррекции
- * @throws \AtolOnline\Exceptions\AtolInnWrongLengthException Некорректная длина ИНН
- * @throws \AtolOnline\Exceptions\AtolPaymentAddressTooLongException Слишком длинный адрес места расчётов
- * @throws \AtolOnline\Exceptions\AtolTooManyItemsException Слишком много предметов расчёта
- * @throws \AtolOnline\Exceptions\AtolWrongDocumentTypeException Некорректный тип документа
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function sellCorrection(Document $document, ?string $external_id = null)
- {
- if (!$document->getCorrectionInfo()) {
- throw new AtolCorrectionInfoException();
- }
- $document->setClient(null)->setItems([]);
- return $this->registerDocument('sell_correction', 'correction', $document, $external_id);
- }
-
- /**
- * Регистрирует документ расхода
- *
- * @param \AtolOnline\Entities\Document $document
- * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
- * @return \AtolOnline\Api\KktResponse
- * @throws \AtolOnline\Exceptions\AtolAuthFailedException Ошибка авторизации
- * @throws \AtolOnline\Exceptions\AtolCorrectionInfoException В документе есть данные коррекции
- * @throws \AtolOnline\Exceptions\AtolInnWrongLengthException Некорректная длина ИНН
- * @throws \AtolOnline\Exceptions\AtolPaymentAddressTooLongException Слишком длинный адрес места расчётов
- * @throws \AtolOnline\Exceptions\AtolWrongDocumentTypeException Некорректный тип документа
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function buy(Document $document, ?string $external_id = null)
- {
- if ($document->getCorrectionInfo()) {
- throw new AtolCorrectionInfoException('Invalid operation on correction document');
- }
- return $this->registerDocument('buy', 'receipt', $document, $external_id);
- }
-
- /**
- * Регистрирует документ возврата расхода
- *
- * @param \AtolOnline\Entities\Document $document
- * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
- * @return \AtolOnline\Api\KktResponse
- * @throws \AtolOnline\Exceptions\AtolAuthFailedException Ошибка авторизации
- * @throws \AtolOnline\Exceptions\AtolCorrectionInfoException В документе есть данные коррекции
- * @throws \AtolOnline\Exceptions\AtolInnWrongLengthException Некорректная длина ИНН
- * @throws \AtolOnline\Exceptions\AtolPaymentAddressTooLongException Слишком длинный адрес места расчётов
- * @throws \AtolOnline\Exceptions\AtolPriceTooHighException Слишком большая сумма
- * @throws \AtolOnline\Exceptions\AtolTooManyVatsException Слишком много ставок НДС
- * @throws \AtolOnline\Exceptions\AtolWrongDocumentTypeException Некорректный тип документа
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function buyRefund(Document $document, ?string $external_id = null)
- {
- if ($document->getCorrectionInfo()) {
- throw new AtolCorrectionInfoException('Invalid operation on correction document');
- }
- return $this->registerDocument('buy_refund', 'receipt', $document->clearVats(), $external_id);
- }
-
- /**
- * Регистрирует документ коррекции расхода
- *
- * @param \AtolOnline\Entities\Document $document
- * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
- * @return \AtolOnline\Api\KktResponse
- * @throws \AtolOnline\Exceptions\AtolAuthFailedException Ошибка авторизации
- * @throws \AtolOnline\Exceptions\AtolCorrectionInfoException В документе отсутствуют данные коррекции
- * @throws \AtolOnline\Exceptions\AtolInnWrongLengthException Некорректная длтина ИНН
- * @throws \AtolOnline\Exceptions\AtolPaymentAddressTooLongException Слишком длинный адрес места расчётов
- * @throws \AtolOnline\Exceptions\AtolTooManyItemsException Слишком много предметов расчёта
- * @throws \AtolOnline\Exceptions\AtolWrongDocumentTypeException Некорректный тип документа
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function buyCorrection(Document $document, ?string $external_id = null)
- {
- if (!$document->getCorrectionInfo()) {
- throw new AtolCorrectionInfoException();
- }
- $document->setClient(null)->setItems([]);
- return $this->registerDocument('buy_correction', 'correction', $document, $external_id);
- }
-
- /**
- * Проверяет статус чека на ККТ один раз
- *
- * @param string $uuid UUID регистрации
- * @return \AtolOnline\Api\KktResponse
- * @throws \AtolOnline\Exceptions\AtolAuthFailedException Ошибка авторизации
- * @throws \AtolOnline\Exceptions\AtolInvalidUuidException Некорректный UUID документа
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function getDocumentStatus(string $uuid)
- {
- $uuid = trim($uuid);
- if (!Uuid::isValid($uuid)) {
- throw new AtolInvalidUuidException($uuid);
- }
- $this->auth();
- return $this->sendAtolRequest('GET', 'report/'.$uuid);
- }
-
- /**
- * Проверяет статус чека на ККТ нужное количество раз с указанным интервалом.
- * Вернёт результат как только при очередной проверке сменится статус регистрации документа.
- *
- * @param string $uuid UUID регистрации
- * @param int $retry_count Количество попыток
- * @param int $timeout Таймаут в секундах между попытками
- * @return \AtolOnline\Api\KktResponse
- * @throws \AtolOnline\Exceptions\AtolAuthFailedException Ошибка авторизации
- * @throws \AtolOnline\Exceptions\AtolInvalidUuidException Некорректный UUID документа
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function pollDocumentStatus(string $uuid, int $retry_count = 5, int $timeout = 1)
- {
- $try = 0;
- do {
- $response = $this->getDocumentStatus($uuid);
- if ($response->isValid() && $response->getContent()->status == 'done') {
- break;
- } else {
- sleep($timeout);
- }
- ++$try;
- } while ($try < $retry_count);
- return $response;
- }
-
- /**
- * Возвращает текущий токен авторизации
- *
- * @return string
- */
- public function getAuthToken(): ?string
- {
- return $this->auth_token;
- }
-
- /**
- * Устанавливает заранее известный токен авторизации
- *
- * @param string|null $auth_token
- * @return $this
- */
- public function setAuthToken(?string $auth_token)
- {
- $this->auth_token = $auth_token;
- return $this;
- }
-
- /**
- * Сбрасывает настройки ККТ по умолчанию
- */
- protected function resetKktConfig(): void
- {
- $this->kkt_config['prod']['group'] = '';
- $this->kkt_config['prod']['login'] = '';
- $this->kkt_config['prod']['pass'] = '';
- $this->kkt_config['prod']['url'] = 'https://online.atol.ru/possystem/v4';
- $this->kkt_config['prod']['callback_url'] = '';
- $this->kkt_config['test']['group'] = TestEnvParams::GROUP;
- $this->kkt_config['test']['login'] = TestEnvParams::LOGIN;
- $this->kkt_config['test']['pass'] = TestEnvParams::PASSWORD;
- $this->kkt_config['test']['url'] = 'https://testonline.atol.ru/possystem/v4';
- $this->kkt_config['test']['callback_url'] = '';
- }
-
- /**
- * Возвращает набор заголовков для HTTP-запроса
- *
- * @return array
- */
- protected function getHeaders()
- {
- $headers['Content-type'] = 'application/json; charset=utf-8';
- if ($this->getAuthToken()) {
- $headers['Token'] = $this->getAuthToken();
- }
- return $headers;
- }
-
- /**
- * Возвращает адрес сервера в соответствии с флагом тестового режима
- *
- * @return string
- */
- protected function getEndpoint(): string
- {
- return $this->kkt_config[$this->isTestMode() ? 'test' : 'prod']['url'];
- }
-
- /**
- * Возвращает полный URL до метода API
- *
- * @param string $to_method
- * @param array|null $get_parameters
- * @return string
- */
- protected function makeUrl(string $to_method, array $get_parameters = null)
- {
- $url = $this->getEndpoint().($this->getAuthToken() ? '/'.$this->getGroup() : '').'/'.$to_method;
- if ($get_parameters && is_array($get_parameters)) {
- $url .= '?'.http_build_query($get_parameters);
- }
- return $url;
- }
-
- /**
- * Делает запрос, возвращает декодированный ответ
- *
- * @param string $http_method Метод HTTP (GET, POST и пр)
- * @param string $api_method Метод API
- * @param mixed $data Данные для передачи
- * @param array|null $options Параметры Guzzle
- * @return \AtolOnline\Api\KktResponse
- * @throws \GuzzleHttp\Exception\GuzzleException
- * @see https://guzzle.readthedocs.io/en/latest/request-options.html
- */
- protected function sendAtolRequest(string $http_method, string $api_method, $data = null, array $options = null)
- {
- $http_method = strtoupper($http_method);
- $options['headers'] = $this->getHeaders();
- $url = $http_method == 'GET'
- ? $this->makeUrl($api_method, $data)
- : $this->makeUrl($api_method, ['token' => $this->getAuthToken()]);
- if ($http_method != 'GET') {
- $options['json'] = $data;
- }
- $response = $this->request($http_method, $url, $options);
- return $this->last_response = new KktResponse($response);
- }
-
- /**
- * Производит авторизацию на ККТ и получает токен доступа для дальнейших HTTP-запросов
- *
- * @return bool
- * @throws \AtolOnline\Exceptions\AtolAuthFailedException Ошибка авторизации
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- protected function auth()
- {
- if (!$this->getAuthToken()) {
- $result = $this->sendAtolRequest('GET', 'getToken', [
- 'login' => $this->getLogin(),
- 'pass' => $this->getPassword(),
- ]);
- if (!$result->isValid() || !$result->getContent()->token) {
- throw new AtolAuthFailedException($result);
- }
- $this->auth_token = $result->getContent()->token;
- }
- return true;
- }
-
- /**
- * Отправляет документ на регистрацию
- *
- * @param string $api_method Метод API
- * @param string $type Тип документа: receipt, correction
- * @param \AtolOnline\Entities\Document $document Объект документа
- * @param string|null $external_id Уникальный код документа (если не указан, то будет создан UUID)
- * @return \AtolOnline\Api\KktResponse
- * @throws \AtolOnline\Exceptions\AtolAuthFailedException Ошибка авторизации
- * @throws \AtolOnline\Exceptions\AtolWrongDocumentTypeException Некорректный тип документа
- * @throws \AtolOnline\Exceptions\AtolInnWrongLengthException Некорректная длина ИНН
- * @throws \AtolOnline\Exceptions\AtolPaymentAddressTooLongException Слишком длинный адрес места расчётов
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- protected function registerDocument(string $api_method, string $type, Document $document, ?string $external_id = null)
- {
- $type = trim($type);
- if (!in_array($type, ['receipt', 'correction'])) {
- throw new AtolWrongDocumentTypeException($type);
- }
- $this->auth();
- if ($this->isTestMode()) {
- $document->setCompany(($document->getCompany() ?: new Company())
- ->setInn(TestEnvParams::INN)
- ->setSno(TestEnvParams::SNO)
- ->setPaymentAddress(TestEnvParams::PAYMENT_ADDRESS));
- }
- $data['timestamp'] = date('d.m.y H:i:s');
- $data['external_id'] = $external_id ?: Uuid::uuid4()->toString();
- $data[$type] = $document;
- if ($this->getCallbackUrl()) {
- $data['service'] = ['callback_url' => $this->getCallbackUrl()];
- }
- return $this->sendAtolRequest('POST', trim($api_method), $data);
- }
-}
diff --git a/src/AtolOnline/Constants/PaymentTypes.php b/src/AtolOnline/Constants/PaymentTypes.php
deleted file mode 100644
index 80202f7..0000000
--- a/src/AtolOnline/Constants/PaymentTypes.php
+++ /dev/null
@@ -1,53 +0,0 @@
-setName($name);
- }
- if ($email) {
- $this->setEmail($email);
- }
- if ($phone) {
- $this->setPhone($phone);
- }
- if ($inn) {
- $this->setInn($inn);
- }
- }
-
- /**
- * Возвращает имя покупателя. Тег ФФД - 1227.
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * Устанавливает имя покупателя
- * Тег ФФД - 1227.
- *
- * @param string $name
- * @return $this
- * @throws AtolNameTooLongException
- */
- public function setName(string $name)
- {
- $name = trim($name);
- if (valid_strlen($name) > Constraints::MAX_LENGTH_CLIENT_NAME) {
- throw new AtolNameTooLongException($name, Constraints::MAX_LENGTH_CLIENT_NAME);
- }
- $this->name = $name;
- return $this;
- }
-
- /**
- * Возвращает телефон покупателя.
- * Тег ФФД - 1008.
- *
- * @return string
- */
- public function getPhone()
- {
- return $this->phone ?? '';
- }
-
- /**
- * Устанавливает телефон покупателя.
- * Тег ФФД - 1008.
- * Входная строка лишается всех знаков, кроме цифр и знака '+'.
- *
- * @param string $phone
- * @return $this
- * @throws AtolPhoneTooLongException
- */
- public function setPhone(string $phone)
- {
- $phone = preg_replace("/[^0-9+]/", '', $phone);
- if (valid_strlen($phone) > Constraints::MAX_LENGTH_CLIENT_PHONE) {
- throw new AtolPhoneTooLongException($phone, Constraints::MAX_LENGTH_CLIENT_PHONE);
- }
- $this->phone = $phone;
- return $this;
- }
-
- /**
- * @inheritDoc
- */
- public function jsonSerialize()
- {
- $json = [];
- if ($this->getName()) {
- $json['name'] = $this->getName() ?? '';
- }
- if ($this->getEmail()) {
- $json['email'] = $this->getEmail() ?? '';
- }
- if ($this->getPhone()) {
- $json['phone'] = $this->getPhone() ?? '';
- }
- if ($this->getInn()) {
- $json['inn'] = $this->getInn() ?? '';
- }
- return $json;
- }
-}
diff --git a/src/AtolOnline/Entities/Company.php b/src/AtolOnline/Entities/Company.php
deleted file mode 100644
index 97b3e69..0000000
--- a/src/AtolOnline/Entities/Company.php
+++ /dev/null
@@ -1,138 +0,0 @@
-setSno($sno);
- }
- if ($inn) {
- $this->setInn($inn);
- }
- if ($paymentAddress) {
- $this->setPaymentAddress($paymentAddress);
- }
- if ($email) {
- $this->setEmail($email);
- }
- }
-
- /**
- * Возвращает установленный тип налогообложения. Тег ФФД - 1055.
- *
- * @return string
- */
- public function getSno()
- {
- return $this->sno;
- }
-
- /**
- * Устанавливает тип налогообложения. Тег ФФД - 1055.
- *
- * @param string $sno
- * @return $this
- */
- public function setSno(string $sno)
- {
- $this->sno = trim($sno);
- return $this;
- }
-
- /**
- * Возвращает установленный адрес места расчётов. Тег ФФД - 1187.
- *
- * @return string
- */
- public function getPaymentAddress()
- {
- return $this->payment_address;
- }
-
- /**
- * Устанавливает адрес места расчётов. Тег ФФД - 1187.
- *
- * @param string $payment_address
- * @return $this
- * @throws AtolPaymentAddressTooLongException Слишком длинный адрес места расчётов
- */
- public function setPaymentAddress(string $payment_address)
- {
- $payment_address = trim($payment_address);
- if (valid_strlen($payment_address) > Constraints::MAX_LENGTH_PAYMENT_ADDRESS) {
- throw new AtolPaymentAddressTooLongException($payment_address, Constraints::MAX_LENGTH_PAYMENT_ADDRESS);
- }
- $this->payment_address = $payment_address;
- return $this;
- }
-
- /**
- * @inheritDoc
- */
- public function jsonSerialize()
- {
- return [
- 'email' => $this->getEmail(),
- 'sno' => $this->getSno(),
- 'inn' => $this->getInn(),
- 'payment_address' => $this->getPaymentAddress(),
- ];
- }
-}
\ No newline at end of file
diff --git a/src/AtolOnline/Exceptions/AtolEmailValidateException.php b/src/AtolOnline/Exceptions/AtolEmailValidateException.php
deleted file mode 100644
index ff1bcdb..0000000
--- a/src/AtolOnline/Exceptions/AtolEmailValidateException.php
+++ /dev/null
@@ -1,41 +0,0 @@
-email;
- }
-
- /**
- * Устанавливает почту. Тег ФФД: 1008, 1117.
- *
- * @param string $email
- * @return $this
- * @throws \AtolOnline\Exceptions\AtolEmailTooLongException Слишком длинный email
- * @throws \AtolOnline\Exceptions\AtolEmailValidateException Невалидный email
- */
- public function setEmail(string $email)
- {
- $email = trim($email);
- if (valid_strlen($email) > Constraints::MAX_LENGTH_EMAIL) {
- throw new AtolEmailTooLongException($email, Constraints::MAX_LENGTH_EMAIL);
- } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
- throw new AtolEmailValidateException($email);
- }
- $this->email = $email;
- return $this;
- }
-}
\ No newline at end of file
diff --git a/src/AtolOnline/Traits/HasInn.php b/src/AtolOnline/Traits/HasInn.php
deleted file mode 100644
index 856055a..0000000
--- a/src/AtolOnline/Traits/HasInn.php
+++ /dev/null
@@ -1,54 +0,0 @@
-inn ?? '';
- }
-
- /**
- * Устанавливает ИНН. Тег ФФД: 1228, 1018.
- * Входная строка лишается всех знаков, кроме цифр.
- *
- * @param string $inn
- * @return $this
- * @throws AtolInnWrongLengthException Некорректная длина ИНН
- */
- public function setInn(string $inn)
- {
- $inn = preg_replace("/[^0-9]/", '', $inn);
- if (preg_match_all(Constraints::PATTERN_INN, $inn) == 0) {
- throw new AtolInnWrongLengthException($inn);
- }
- $this->inn = $inn;
- return $this;
- }
-}
\ No newline at end of file
diff --git a/src/AtolOnline/Traits/RublesKopeksConverter.php b/src/AtolOnline/Traits/RublesKopeksConverter.php
deleted file mode 100644
index 95ecc78..0000000
--- a/src/AtolOnline/Traits/RublesKopeksConverter.php
+++ /dev/null
@@ -1,40 +0,0 @@
- копейки
- *
- * @package AtolOnline\Traits
- */
-trait RublesKopeksConverter
-{
- /**
- * Конвертирует рубли в копейки, учитывая только 2 знака после запятой
- *
- * @param float|null $rubles Рубли
- * @return int Копейки
- */
- protected static function toKop(?float $rubles = null)
- {
- return $rubles === null ? null : (int)round($rubles * 100, 2);
- }
-
- /**
- * Конвертирует копейки в рубли, оставляя только 2 знака после запятой
- *
- * @param int|null $kopeks Копейки
- * @return float Рубли
- */
- protected static function toRub(?int $kopeks = null)
- {
- return $kopeks === null ? null : round($kopeks / 100, 2);
- }
-}
diff --git a/src/AtolOnline/Constants/Constraints.php b/src/Constants/Constraints.php
similarity index 84%
rename from src/AtolOnline/Constants/Constraints.php
rename to src/Constants/Constraints.php
index 92c1040..5ca70b7 100644
--- a/src/AtolOnline/Constants/Constraints.php
+++ b/src/Constants/Constraints.php
@@ -1,19 +1,26 @@
setName($name);
+ $email && $this->setEmail($email);
+ $phone && $this->setPhone($phone);
+ $inn && $this->setInn($inn);
+ }
+
+ /**
+ * Возвращает наименование покупателя
+ *
+ * Тег ФФД - 1227
+ *
+ * @return string|null
+ */
+ public function getName(): ?string
+ {
+ return $this->name;
+ }
+
+ /**
+ * Устанавливает наименование покупателя
+ *
+ * Тег ФФД - 1227
+ *
+ * @param string|null $name
+ * @return $this
+ * @throws TooLongNameException
+ */
+ public function setName(?string $name): Client
+ {
+ if (is_string($name)) {
+ $name = preg_replace('/[\n\r\t]/', '', trim($name));
+ if (mb_strlen($name) > Constraints::MAX_LENGTH_CLIENT_NAME) {
+ throw new TooLongNameException($name, Constraints::MAX_LENGTH_CLIENT_NAME);
+ }
+ }
+ $this->name = empty($name) ? null : $name;
+ return $this;
+ }
+
+ /**
+ * Возвращает установленный email
+ *
+ * @return string|null
+ */
+ public function getEmail(): ?string
+ {
+ return $this->email;
+ }
+
+ /**
+ * Устанавливает email
+ *
+ * @param string|null $email
+ * @return $this
+ * @throws TooLongEmailException Слишком длинный email
+ * @throws InvalidEmailException Невалидный email
+ */
+ public function setEmail(?string $email): self
+ {
+ if (is_string($email)) {
+ $email = preg_replace('/[\n\r\t]/', '', trim($email));
+ if (mb_strlen($email) > Constraints::MAX_LENGTH_EMAIL) {
+ throw new TooLongEmailException($email, Constraints::MAX_LENGTH_EMAIL);
+ } elseif (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
+ throw new InvalidEmailException($email);
+ }
+ }
+ $this->email = empty($email) ? null : $email;
+ return $this;
+ }
+
+ /**
+ * Возвращает установленный телефон
+ *
+ * Тег ФФД - 1008
+ *
+ * @return string|null
+ */
+ public function getPhone(): ?string
+ {
+ return $this->phone;
+ }
+
+ /**
+ * Устанавливает телефон
+ *
+ * Тег ФФД - 1008
+ *
+ * @param string|null $phone Номер телефона
+ * @return $this
+ * @throws TooLongPhoneException
+ */
+ public function setPhone(?string $phone): Client
+ {
+ if (is_string($phone)) {
+ $phone = preg_replace('/[^\d]/', '', trim($phone));
+ if (mb_strlen($phone) > Constraints::MAX_LENGTH_CLIENT_PHONE) {
+ throw new TooLongPhoneException($phone, Constraints::MAX_LENGTH_CLIENT_PHONE);
+ }
+ }
+ $this->phone = empty($phone) ? null : "+$phone";
+ return $this;
+ }
+
+ /**
+ * Возвращает установленный ИНН
+ *
+ * @return string|null
+ */
+ public function getInn(): ?string
+ {
+ return $this->inn;
+ }
+
+ /**
+ * Устанавливает ИНН
+ *
+ * @param string|null $inn
+ * @return $this
+ * @throws InvalidInnLengthException Некорректная длина ИНН
+ */
+ public function setInn(?string $inn): self
+ {
+ if (is_string($inn)) {
+ $inn = preg_replace('/[^\d]/', '', trim($inn));
+ if (preg_match_all(Constraints::PATTERN_INN, $inn) === 0) {
+ throw new InvalidInnLengthException($inn);
+ }
+ }
+ $this->inn = empty($inn) ? null : $inn;
+ return $this;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function jsonSerialize(): object
+ {
+ $json = [];
+ $this->getName() && $json['name'] = $this->getName();
+ $this->getEmail() && $json['email'] = $this->getEmail();
+ $this->getPhone() && $json['phone'] = $this->getPhone();
+ $this->getInn() && $json['inn'] = $this->getInn();
+ return (object)$json;
+ }
+}
diff --git a/src/Entities/Company.php b/src/Entities/Company.php
new file mode 100644
index 0000000..f37f955
--- /dev/null
+++ b/src/Entities/Company.php
@@ -0,0 +1,227 @@
+setEmail($email);
+ $this->setSno($sno);
+ $this->setInn($inn);
+ $this->setPaymentAddress($payment_address);
+ }
+
+ /**
+ * Возвращает установленный email
+ *
+ * @return string
+ */
+ public function getEmail(): string
+ {
+ return $this->email;
+ }
+
+ /**
+ * Устанавливает email
+ *
+ * @param string $email
+ * @return $this
+ * @throws TooLongEmailException Слишком длинный email
+ * @throws InvalidEmailException Невалидный email
+ */
+ public function setEmail(string $email): self
+ {
+ $email = preg_replace('/[\n\r\t]/', '', trim($email));
+ if (mb_strlen($email) > Constraints::MAX_LENGTH_EMAIL) {
+ throw new TooLongEmailException($email, Constraints::MAX_LENGTH_EMAIL);
+ } elseif (empty($email) || filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
+ throw new InvalidEmailException($email);
+ }
+ $this->email = $email;
+ return $this;
+ }
+
+ /**
+ * Возвращает установленный тип налогообложения
+ *
+ * Тег ФФД - 1055
+ *
+ * @return string
+ */
+ public function getSno(): string
+ {
+ return $this->sno;
+ }
+
+ /**
+ * Устанавливает тип налогообложения
+ *
+ * Тег ФФД - 1055
+ *
+ * @param string $sno
+ * @return $this
+ * @throws InvalidSnoException
+ */
+ public function setSno(string $sno): Company
+ {
+ $sno = trim($sno);
+ if (empty($sno) || !in_array($sno, SnoTypes::toArray())) {
+ throw new InvalidSnoException($sno);
+ }
+ $this->sno = $sno;
+ return $this;
+ }
+
+ /**
+ * Возвращает установленный ИНН
+ *
+ * Тег ФФД - 1018
+ *
+ * @return string
+ */
+ public function getInn(): string
+ {
+ return $this->inn;
+ }
+
+ /**
+ * Устанавливает ИНН
+ *
+ * Тег ФФД - 1018
+ *
+ * @param string $inn
+ * @return $this
+ * @throws InvalidInnLengthException
+ */
+ public function setInn(string $inn): self
+ {
+ $inn = preg_replace('/[^\d]/', '', trim($inn));
+ if (empty($inn) || preg_match_all(Constraints::PATTERN_INN, $inn) === 0) {
+ throw new InvalidInnLengthException($inn);
+ }
+ $this->inn = $inn;
+ return $this;
+ }
+
+ /**
+ * Возвращает установленный адрес места расчётов
+ *
+ * Тег ФФД - 1187
+ *
+ * @return string
+ */
+ public function getPaymentAddress(): string
+ {
+ return $this->payment_address;
+ }
+
+ /**
+ * Устанавливает адрес места расчётов
+ *
+ * Тег ФФД - 1187
+ *
+ * @param string $payment_address
+ * @return $this
+ * @throws TooLongPaymentAddressException
+ * @throws InvalidPaymentAddressException
+ */
+ public function setPaymentAddress(string $payment_address): Company
+ {
+ $payment_address = trim($payment_address);
+ if (empty($payment_address)) {
+ throw new InvalidPaymentAddressException();
+ } elseif (mb_strlen($payment_address) > Constraints::MAX_LENGTH_PAYMENT_ADDRESS) {
+ throw new TooLongPaymentAddressException($payment_address, Constraints::MAX_LENGTH_PAYMENT_ADDRESS);
+ }
+ $this->payment_address = $payment_address;
+ return $this;
+ }
+
+ /**
+ * @inheritDoc
+ * @throws InvalidEmailException
+ * @throws InvalidSnoException
+ * @throws InvalidInnLengthException
+ * @throws InvalidPaymentAddressException
+ */
+ public function jsonSerialize(): object
+ {
+ return (object)[
+ 'email' => $this->email
+ ? $this->getEmail()
+ : throw new InvalidEmailException(),
+ 'sno' => $this->sno
+ ? $this->getSno()
+ : throw new InvalidSnoException(),
+ 'inn' => $this->inn
+ ? $this->getInn()
+ : throw new InvalidInnLengthException(),
+ 'payment_address' => $this->payment_address
+ ? $this->getPaymentAddress()
+ : throw new InvalidPaymentAddressException(),
+ ];
+ }
+}
\ No newline at end of file
diff --git a/src/AtolOnline/Entities/CorrectionInfo.php b/src/Entities/CorrectionInfo.php
similarity index 87%
rename from src/AtolOnline/Entities/CorrectionInfo.php
rename to src/Entities/CorrectionInfo.php
index 2cbde55..d6f11e6 100644
--- a/src/AtolOnline/Entities/CorrectionInfo.php
+++ b/src/Entities/CorrectionInfo.php
@@ -1,40 +1,40 @@
base_number = trim($number);
return $this;
@@ -102,7 +102,7 @@ class CorrectionInfo extends Entity
* @param string $name
* @return $this
*/
- public function setName(string $name)
+ public function setName(string $name): CorrectionInfo
{
$this->base_name = trim($name);
return $this;
@@ -126,7 +126,7 @@ class CorrectionInfo extends Entity
* @param string $date Строка в формате d.m.Y
* @return $this
*/
- public function setDate(string $date)
+ public function setDate(string $date): CorrectionInfo
{
$this->base_date = $date;
return $this;
@@ -150,7 +150,7 @@ class CorrectionInfo extends Entity
* @param string $type
* @return $this
*/
- public function setType(string $type)
+ public function setType(string $type): CorrectionInfo
{
$this->type = $type;
return $this;
diff --git a/src/AtolOnline/Entities/Document.php b/src/Entities/Document.php
similarity index 68%
rename from src/AtolOnline/Entities/Document.php
rename to src/Entities/Document.php
index 66716fd..af72077 100644
--- a/src/AtolOnline/Entities/Document.php
+++ b/src/Entities/Document.php
@@ -1,18 +1,34 @@
payments = new PaymentArray();
$this->items = new ItemArray();
}
-
+
/**
* Удаляет все налоги из документа и предметов расчёта
*
* @return $this
- * @throws \AtolOnline\Exceptions\AtolPriceTooHighException Слишком большая сумма
- * @throws \AtolOnline\Exceptions\AtolTooManyVatsException Слишком много ставок НДС
+ * @throws TooManyVatsException Слишком много ставок НДС
*/
- public function clearVats()
+ public function clearVats(): Document
{
$this->setVats([]);
return $this;
}
-
+
/**
* Добавляет новую ставку НДС в массив ставок НДС
*
- * @param \AtolOnline\Entities\Vat $vat Объект ставки НДС
+ * @param Vat $vat Объект ставки НДС
* @return $this
- * @throws \AtolOnline\Exceptions\AtolTooManyVatsException Слишком много ставок НДС
+ * @throws TooManyVatsException Слишком много ставок НДС
*/
- public function addVat(Vat $vat)
+ public function addVat(Vat $vat): Document
{
$this->vats->add($vat);
return $this;
}
-
+
/**
* Возвращает массив ставок НДС
*
- * @return \AtolOnline\Entities\Vat[]
+ * @return Vat[]
*/
public function getVats(): array
{
return $this->vats->get();
}
-
+
/**
* Устанавливает массив ставок НДС
*
- * @param \AtolOnline\Entities\Vat[] $vats Массив ставок НДС
+ * @param Vat[] $vats Массив ставок НДС
* @return $this
- * @throws \AtolOnline\Exceptions\AtolTooManyVatsException Слишком много ставок НДС
- * @throws \Exception
+ * @throws TooManyVatsException Слишком много ставок НДС
+ * @throws Exception
*/
- public function setVats(array $vats)
+ public function setVats(array $vats): Document
{
$this->vats->set($vats);
return $this;
}
-
+
/**
* Добавляет новую оплату в массив оплат
*
- * @param \AtolOnline\Entities\Payment $payment Объект оплаты
+ * @param Payment $payment Объект оплаты
* @return $this
- * @throws \Exception
- * @throws \AtolOnline\Exceptions\AtolTooManyPaymentsException Слишком много оплат
+ * @throws Exception
+ * @throws TooManyPaymentsException Слишком много оплат
*/
- public function addPayment(Payment $payment)
+ public function addPayment(Payment $payment): Document
{
if (count($this->getPayments()) == 0 && !$payment->getSum()) {
$payment->setSum($this->calcTotal());
@@ -137,61 +152,61 @@ class Document extends Entity
$this->payments->add($payment);
return $this;
}
-
+
/**
* Возвращает массив оплат
*
- * @return \AtolOnline\Entities\Payment[]
+ * @return Payment[]
*/
public function getPayments(): array
{
return $this->payments->get();
}
-
+
/**
* Устанавливает массив оплат
*
- * @param \AtolOnline\Entities\Payment[] $payments Массив оплат
+ * @param Payment[] $payments Массив оплат
* @return $this
- * @throws \AtolOnline\Exceptions\AtolTooManyPaymentsException Слишком много оплат
+ * @throws TooManyPaymentsException Слишком много оплат
*/
- public function setPayments(array $payments)
+ public function setPayments(array $payments): Document
{
$this->payments->set($payments);
return $this;
}
-
+
/**
* Добавляет новый предмет расчёта в массив предметов расчёта
*
- * @param \AtolOnline\Entities\Item $item Объект предмета расчёта
+ * @param Item $item Объект предмета расчёта
* @return $this
- * @throws \AtolOnline\Exceptions\AtolTooManyItemsException Слишком много предметов расчёта
+ * @throws TooManyItemsException Слишком много предметов расчёта
*/
- public function addItem(Item $item)
+ public function addItem(Item $item): Document
{
$this->items->add($item);
return $this;
}
-
+
/**
* Возвращает массив предметов расчёта
*
- * @return \AtolOnline\Entities\Item[]
+ * @return Item[]
*/
public function getItems(): array
{
return $this->items->get();
}
-
+
/**
* Устанавливает массив предметов расчёта
*
- * @param \AtolOnline\Entities\Item[] $items Массив предметов расчёта
+ * @param Item[] $items Массив предметов расчёта
* @return $this
- * @throws \AtolOnline\Exceptions\AtolTooManyItemsException Слишком много предметов расчёта
+ * @throws TooManyItemsException Слишком много предметов расчёта
*/
- public function setItems(array $items)
+ public function setItems(array $items): Document
{
$this->items->set($items);
return $this;
@@ -213,7 +228,7 @@ class Document extends Entity
* @param Client|null $client
* @return $this
*/
- public function setClient(?Client $client)
+ public function setClient(?Client $client): Document
{
$this->client = $client;
return $this;
@@ -235,7 +250,7 @@ class Document extends Entity
* @param Company|null $company
* @return $this
*/
- public function setCompany(?Company $company)
+ public function setCompany(?Company $company): Document
{
$this->company = $company;
return $this;
@@ -250,55 +265,55 @@ class Document extends Entity
{
return $this->cashier;
}
-
+
/**
* Устанавливает ФИО кассира. Тег ФФД - 1021.
*
* @param string|null $cashier
* @return $this
- * @throws \AtolOnline\Exceptions\AtolCashierTooLongException
+ * @throws TooLongCashierException
*/
- public function setCashier(?string $cashier)
+ public function setCashier(?string $cashier): Document
{
if ($cashier !== null) {
$cashier = trim($cashier);
- if (valid_strlen($cashier) > Constraints::MAX_LENGTH_CASHIER_NAME) {
- throw new AtolCashierTooLongException($cashier, Constraints::MAX_LENGTH_CASHIER_NAME);
+ if (mb_strlen($cashier) > Constraints::MAX_LENGTH_CASHIER_NAME) {
+ throw new TooLongCashierException($cashier, Constraints::MAX_LENGTH_CASHIER_NAME);
}
}
$this->cashier = $cashier;
return $this;
}
-
+
/**
* Возвращает данные коррекции
*
- * @return \AtolOnline\Entities\CorrectionInfo|null
+ * @return CorrectionInfo|null
*/
public function getCorrectionInfo(): ?CorrectionInfo
{
return $this->correction_info;
}
-
+
/**
* Устанавливает данные коррекции
*
- * @param \AtolOnline\Entities\CorrectionInfo|null $correction_info
+ * @param CorrectionInfo|null $correction_info
* @return $this
*/
- public function setCorrectionInfo(?CorrectionInfo $correction_info)
+ public function setCorrectionInfo(?CorrectionInfo $correction_info): Document
{
$this->correction_info = $correction_info;
return $this;
}
-
+
/**
* Пересчитывает, сохраняет и возвращает итоговую сумму чека по всем позициям (включая НДС). Тег ФФД - 1020.
*
* @return float
- * @throws \Exception
+ * @throws Exception
*/
- public function calcTotal()
+ public function calcTotal(): float
{
$sum = 0;
$this->clearVats();
@@ -318,32 +333,33 @@ class Document extends Entity
{
return $this->total;
}
-
+
/**
* Собирает объект документа из сырой json-строки
*
* @param string $json
- * @return \AtolOnline\Entities\Document
- * @throws \AtolOnline\Exceptions\AtolEmailTooLongException
- * @throws \AtolOnline\Exceptions\AtolEmailValidateException
- * @throws \AtolOnline\Exceptions\AtolException
- * @throws \AtolOnline\Exceptions\AtolInnWrongLengthException
- * @throws \AtolOnline\Exceptions\AtolInvalidJsonException
- * @throws \AtolOnline\Exceptions\AtolNameTooLongException
- * @throws \AtolOnline\Exceptions\AtolPaymentAddressTooLongException
- * @throws \AtolOnline\Exceptions\AtolPhoneTooLongException
- * @throws \AtolOnline\Exceptions\AtolPriceTooHighException
- * @throws \AtolOnline\Exceptions\AtolTooManyException
- * @throws \AtolOnline\Exceptions\AtolTooManyItemsException
- * @throws \AtolOnline\Exceptions\AtolTooManyPaymentsException
- * @throws \AtolOnline\Exceptions\AtolUnitTooLongException
- * @throws \AtolOnline\Exceptions\AtolUserdataTooLongException
+ * @return Document
+ * @throws TooLongEmailException
+ * @throws InvalidEmailException
+ * @throws AtolException
+ * @throws InvalidInnLengthException
+ * @throws InvalidJsonException
+ * @throws TooLongNameException
+ * @throws TooLongPaymentAddressException
+ * @throws TooLongPhoneException
+ * @throws TooHighPriceException
+ * @throws BasicTooManyException
+ * @throws TooManyItemsException
+ * @throws TooManyPaymentsException
+ * @throws TooLongUnitException
+ * @throws TooLongUserdataException
+ * @throws Exception
*/
- public static function fromRaw(string $json)
+ public static function fromRaw(string $json): Document
{
$array = json_decode($json, true);
if (json_last_error() !== JSON_ERROR_NONE) {
- throw new AtolInvalidJsonException();
+ throw new InvalidJsonException();
}
$doc = new self();
if (isset($array['company'])) {
@@ -416,13 +432,13 @@ class Document extends Entity
}
return $doc;
}
-
+
/**
* Возвращает массив для кодирования в json
*
- * @throws \Exception
+ * @throws Exception
*/
- public function jsonSerialize()
+ public function jsonSerialize(): array
{
if ($this->getCompany()) {
$json['company'] = $this->getCompany()->jsonSerialize(); // обязательно
diff --git a/src/AtolOnline/Entities/Entity.php b/src/Entities/Entity.php
similarity index 55%
rename from src/AtolOnline/Entities/Entity.php
rename to src/Entities/Entity.php
index 0a35c9d..0b47b2d 100644
--- a/src/AtolOnline/Entities/Entity.php
+++ b/src/Entities/Entity.php
@@ -1,25 +1,28 @@
name;
}
-
+
/**
* Устаналивает наименование. Тег ФФД - 1030.
*
* @param string $name Наименование
* @return $this
- * @throws AtolNameTooLongException Слишком длинное имя/наименование
+ * @throws TooLongNameException Слишком длинное имя/наименование
*/
- public function setName(string $name)
+ public function setName(string $name): self
{
$name = trim($name);
- if (valid_strlen($name) > Constraints::MAX_LENGTH_ITEM_NAME) {
- throw new AtolNameTooLongException($name, Constraints::MAX_LENGTH_ITEM_NAME);
+ if (mb_strlen($name) > Constraints::MAX_LENGTH_ITEM_NAME) {
+ throw new TooLongNameException($name, Constraints::MAX_LENGTH_ITEM_NAME);
}
$this->name = $name;
return $this;
@@ -151,24 +150,24 @@ class Item extends Entity
*
* @return float
*/
- public function getPrice()
+ public function getPrice(): float
{
- return self::toRub($this->price);
+ return rubles($this->price);
}
-
+
/**
* Устанавливает цену в рублях. Тег ФФД - 1079.
*
* @param float $rubles Цена за одну единицу в рублях
* @return $this
- * @throws AtolPriceTooHighException Слишком высокая цена за одну единицу
+ * @throws TooHighPriceException Слишком высокая цена за одну единицу
*/
- public function setPrice(float $rubles)
+ public function setPrice(float $rubles): Item
{
if ($rubles > 42949672.95) {
- throw new AtolPriceTooHighException($rubles, 42949672.95);
+ throw new TooHighPriceException($rubles, 42949672.95);
}
- $this->price = self::toKop($rubles);
+ $this->price = kopeks($rubles);
$this->calcSum();
return $this;
}
@@ -182,22 +181,22 @@ class Item extends Entity
{
return $this->quantity;
}
-
+
/**
* Устанавливает количество. Тег ФФД - 1023.
*
- * @param float $quantity Количество
+ * @param float $quantity Количество
* @param string|null $measurement_unit Единица измерения количества
* @return $this
- * @throws AtolTooManyException Слишком большое количество
- * @throws AtolPriceTooHighException Слишком высокая общая стоимость
- * @throws AtolUnitTooLongException Слишком длинное название единицы измерения
+ * @throws BasicTooManyException Слишком большое количество
+ * @throws TooHighPriceException Слишком высокая общая стоимость
+ * @throws TooLongUnitException Слишком длинное название единицы измерения
*/
- public function setQuantity(float $quantity, string $measurement_unit = null)
+ public function setQuantity(float $quantity, string $measurement_unit = null): Item
{
$quantity = round($quantity, 3);
if ($quantity > 99999.999) {
- throw new AtolTooManyException($quantity, 99999.999);
+ throw new BasicTooManyException($quantity, 99999.999);
}
$this->quantity = $quantity;
$this->calcSum();
@@ -216,19 +215,19 @@ class Item extends Entity
{
return $this->measurement_unit;
}
-
+
/**
* Устанавливает единицу измерения количества. Тег ФФД - 1197.
*
* @param string $measurement_unit Единица измерения количества
* @return $this
- * @throws AtolUnitTooLongException Слишком длинное название единицы измерения
+ * @throws TooLongUnitException Слишком длинное название единицы измерения
*/
- public function setMeasurementUnit(string $measurement_unit)
+ public function setMeasurementUnit(string $measurement_unit): Item
{
$measurement_unit = trim($measurement_unit);
- if (valid_strlen($measurement_unit) > Constraints::MAX_LENGTH_MEASUREMENT_UNIT) {
- throw new AtolUnitTooLongException($measurement_unit, Constraints::MAX_LENGTH_MEASUREMENT_UNIT);
+ if (mb_strlen($measurement_unit) > Constraints::MAX_LENGTH_MEASUREMENT_UNIT) {
+ throw new TooLongUnitException($measurement_unit, Constraints::MAX_LENGTH_MEASUREMENT_UNIT);
}
$this->measurement_unit = $measurement_unit;
return $this;
@@ -251,7 +250,7 @@ class Item extends Entity
* @return $this
* @todo Проверка допустимых значений
*/
- public function setPaymentMethod(string $payment_method)
+ public function setPaymentMethod(string $payment_method): Item
{
$this->payment_method = trim($payment_method);
return $this;
@@ -274,30 +273,30 @@ class Item extends Entity
* @return $this
* @todo Проверка допустимых значений
*/
- public function setPaymentObject(string $payment_object)
+ public function setPaymentObject(string $payment_object): Item
{
$this->payment_object = trim($payment_object);
return $this;
}
-
+
/**
* Возвращает ставку НДС
*
- * @return \AtolOnline\Entities\Vat|null
+ * @return Vat|null
*/
public function getVat(): ?Vat
{
return $this->vat;
}
-
+
/**
* Устанавливает ставку НДС
*
* @param string|null $vat_type Тип ставки НДС. Передать null, чтобы удалить ставку.
* @return $this
- * @throws \AtolOnline\Exceptions\AtolPriceTooHighException
+ * @throws TooHighPriceException
*/
- public function setVatType(?string $vat_type)
+ public function setVatType(?string $vat_type): Item
{
if ($vat_type) {
$this->vat
@@ -319,19 +318,19 @@ class Item extends Entity
{
return $this->user_data;
}
-
+
/**
* Устанавливает дополнительный реквизит. Тег ФФД - 1191.
*
* @param string $user_data Дополнительный реквизит. Тег ФФД - 1191.
* @return $this
- * @throws AtolUserdataTooLongException Слишком длинный дополнительный реквизит
+ * @throws TooLongUserdataException Слишком длинный дополнительный реквизит
*/
- public function setUserData(string $user_data)
+ public function setUserData(string $user_data): self
{
$user_data = trim($user_data);
- if (valid_strlen($user_data) > Constraints::MAX_LENGTH_USER_DATA) {
- throw new AtolUserdataTooLongException($user_data, Constraints::MAX_LENGTH_USER_DATA);
+ if (mb_strlen($user_data) > Constraints::MAX_LENGTH_USER_DATA) {
+ throw new TooLongUserdataException($user_data, Constraints::MAX_LENGTH_USER_DATA);
}
$this->user_data = $user_data;
return $this;
@@ -344,24 +343,24 @@ class Item extends Entity
*/
public function getSum(): float
{
- return self::toRub($this->sum);
+ return rubles($this->sum);
}
-
+
/**
* Расчитывает стоимость и размер НДС на неё
*
* @return float
- * @throws AtolPriceTooHighException Слишком большая сумма
+ * @throws TooHighPriceException Слишком большая сумма
*/
- public function calcSum()
+ public function calcSum(): float
{
$sum = $this->quantity * $this->price;
- if (self::toRub($sum) > 42949672.95) {
- throw new AtolPriceTooHighException($sum, 42949672.95);
+ if (rubles($sum) > 42949672.95) {
+ throw new TooHighPriceException($sum, 42949672.95);
}
$this->sum = $sum;
if ($this->vat) {
- $this->vat->setSum(self::toRub($sum));
+ $this->vat->setSum(rubles($sum));
}
return $this->getSum();
}
diff --git a/src/AtolOnline/Entities/ItemArray.php b/src/Entities/ItemArray.php
similarity index 78%
rename from src/AtolOnline/Entities/ItemArray.php
rename to src/Entities/ItemArray.php
index 059f243..09ee0dc 100644
--- a/src/AtolOnline/Entities/ItemArray.php
+++ b/src/Entities/ItemArray.php
@@ -1,15 +1,17 @@
set($items);
}
}
-
+
/**
* Устанавливает массив предметов расчёта
*
* @param Item[] $items Массив предметов расчёта
* @return $this
- * @throws AtolTooManyItemsException Слишком много предметов расчёта
+ * @throws TooManyItemsException Слишком много предметов расчёта
*/
- public function set(array $items)
+ public function set(array $items): ItemArray
{
if ($this->validateCount($items)) {
$this->items = $items;
}
return $this;
}
-
+
/**
* Добавляет предмет расчёта в массив
*
* @param Item $item Объект предмета расчёта
* @return $this
- * @throws AtolTooManyItemsException Слишком много предметов расчёта
+ * @throws TooManyItemsException Слишком много предметов расчёта
*/
- public function add(Item $item)
+ public function add(Item $item): ItemArray
{
if ($this->validateCount()) {
$this->items[] = $item;
@@ -78,7 +80,7 @@ class ItemArray extends Entity
*
* @return Item[]
*/
- public function get()
+ public function get(): array
{
return $this->items;
}
@@ -94,19 +96,19 @@ class ItemArray extends Entity
}
return $result;
}
-
+
/**
* Проверяет количество предметов расчёта
*
* @param Item[]|null $items Если передать массив, то проверит количество его элементов.
* Иначе проверит количество уже присвоенных элементов.
* @return bool true если всё хорошо, иначе выбрасывает исключение
- * @throws AtolTooManyItemsException Слишком много предметов расчёта
+ * @throws TooManyItemsException Слишком много предметов расчёта
*/
protected function validateCount(?array $items = null): bool
{
if ((!empty($items) && count($items) >= self::MAX_COUNT) || count($this->items) >= self::MAX_COUNT) {
- throw new AtolTooManyItemsException(count($items), self::MAX_COUNT);
+ throw new TooManyItemsException(count($items), self::MAX_COUNT);
}
return true;
}
diff --git a/src/AtolOnline/Entities/Payment.php b/src/Entities/Payment.php
similarity index 88%
rename from src/AtolOnline/Entities/Payment.php
rename to src/Entities/Payment.php
index 27f8398..0a3d356 100644
--- a/src/AtolOnline/Entities/Payment.php
+++ b/src/Entities/Payment.php
@@ -1,12 +1,14 @@
type = $type;
return $this;
@@ -78,7 +80,7 @@ class Payment extends Entity
* @param float $sum
* @return $this
*/
- public function setSum(float $sum)
+ public function setSum(float $sum): Payment
{
$this->sum = $sum;
return $this;
diff --git a/src/AtolOnline/Entities/PaymentArray.php b/src/Entities/PaymentArray.php
similarity index 77%
rename from src/AtolOnline/Entities/PaymentArray.php
rename to src/Entities/PaymentArray.php
index f30920a..a92997a 100644
--- a/src/AtolOnline/Entities/PaymentArray.php
+++ b/src/Entities/PaymentArray.php
@@ -1,15 +1,17 @@
set($payments);
}
}
-
+
/**
* Устанавливает массив оплат
*
* @param Payment[] $payments
* @return $this
- * @throws AtolTooManyPaymentsException Слишком много оплат
+ * @throws TooManyPaymentsException Слишком много оплат
*/
- public function set(array $payments)
+ public function set(array $payments): PaymentArray
{
if ($this->validateCount($payments)) {
$this->payments = $payments;
}
return $this;
}
-
+
/**
* Добавляет новую оплату к заданным
*
* @param Payment $payment Объект оплаты
* @return $this
- * @throws AtolTooManyPaymentsException Слишком много оплат
+ * @throws TooManyPaymentsException Слишком много оплат
*/
- public function add(Payment $payment)
+ public function add(Payment $payment): PaymentArray
{
if ($this->validateCount()) {
$this->payments[] = $payment;
@@ -76,7 +78,7 @@ class PaymentArray extends Entity
*
* @return Payment[]
*/
- public function get()
+ public function get(): array
{
return $this->payments;
}
@@ -92,19 +94,19 @@ class PaymentArray extends Entity
}
return $result;
}
-
+
/**
* Проверяет количество налоговых ставок
*
* @param Payment[]|null $payments Если передать массив, то проверит количество его элементов.
* Иначе проверит количество уже присвоенных элементов.
* @return bool true если всё хорошо, иначе выбрасывает исключение
- * @throws AtolTooManyPaymentsException Слишком много оплат
+ * @throws TooManyPaymentsException Слишком много оплат
*/
protected function validateCount(?array $payments = null): bool
{
if ((!empty($payments) && count($payments) >= self::MAX_COUNT) || count($this->payments) >= self::MAX_COUNT) {
- throw new AtolTooManyPaymentsException(count($payments), self::MAX_COUNT);
+ throw new TooManyPaymentsException(count($payments), self::MAX_COUNT);
}
return true;
}
diff --git a/src/AtolOnline/Entities/Vat.php b/src/Entities/Vat.php
similarity index 87%
rename from src/AtolOnline/Entities/Vat.php
rename to src/Entities/Vat.php
index bd76ca1..98dd642 100644
--- a/src/AtolOnline/Entities/Vat.php
+++ b/src/Entities/Vat.php
@@ -1,15 +1,17 @@
type = $type;
$this->setFinal();
@@ -111,9 +111,9 @@ class Vat extends Entity
*
* @return float
*/
- public function getFinalSum()
+ public function getFinalSum(): float
{
- return self::toRub($this->sum_final);
+ return rubles($this->sum_final);
}
/**
@@ -123,9 +123,9 @@ class Vat extends Entity
* @param float $rubles Сумма в рублях за предмет расчёта, из которой высчитывается размер НДС
* @return $this
*/
- public function setSum(float $rubles)
+ public function setSum(float $rubles): Vat
{
- $this->sum_original = self::toKop($rubles);
+ $this->sum_original = kopeks($rubles);
$this->setFinal();
return $this;
}
@@ -137,7 +137,7 @@ class Vat extends Entity
*/
public function getSum(): float
{
- return self::toRub($this->sum_original);
+ return rubles($this->sum_original);
}
/**
@@ -147,9 +147,9 @@ class Vat extends Entity
* @param float $rubles
* @return $this
*/
- public function addSum(float $rubles)
+ public function addSum(float $rubles): Vat
{
- $this->sum_original += self::toKop($rubles);
+ $this->sum_original += kopeks($rubles);
$this->setFinal();
return $this;
}
@@ -163,7 +163,7 @@ class Vat extends Entity
*/
public function calc(float $rubles): float
{
- return self::toRub(self::calculator($this->type, self::toKop($rubles)));
+ return rubles(self::calculator($this->type, kopeks($rubles)));
}
/**
@@ -180,7 +180,7 @@ class Vat extends Entity
/**
* Расчитывает и устанавливает итоговый размер ставки от исходной суммы в копейках
*/
- protected function setFinal()
+ protected function setFinal(): Vat
{
$this->sum_final = self::calculator($this->type, $this->sum_original);
return $this;
diff --git a/src/AtolOnline/Entities/VatArray.php b/src/Entities/VatArray.php
similarity index 78%
rename from src/AtolOnline/Entities/VatArray.php
rename to src/Entities/VatArray.php
index c292127..db92ca7 100644
--- a/src/AtolOnline/Entities/VatArray.php
+++ b/src/Entities/VatArray.php
@@ -1,15 +1,17 @@
set($vats);
}
}
-
+
/**
* Устанавливает массив ставок НДС
*
* @param Vat[] $vats Массив ставок НДС
* @return $this
- * @throws AtolTooManyVatsException Слишком много ставок НДС
+ * @throws TooManyVatsException Слишком много ставок НДС
*/
- public function set(array $vats)
+ public function set(array $vats): VatArray
{
if ($this->validateCount($vats)) {
$this->vats = $vats;
}
return $this;
}
-
+
/**
* Добавляет новую ставку НДС в массив
*
* @param Vat $vat Объект ставки НДС
* @return $this
- * @throws AtolTooManyVatsException Слишком много ставок НДС
+ * @throws TooManyVatsException Слишком много ставок НДС
*/
- public function add(Vat $vat)
+ public function add(Vat $vat): VatArray
{
if ($this->validateCount()) {
if (isset($this->vats[$vat->getType()])) {
@@ -80,7 +82,7 @@ class VatArray extends Entity
*
* @return Vat[]
*/
- public function get()
+ public function get(): array
{
return $this->vats;
}
@@ -96,19 +98,19 @@ class VatArray extends Entity
}
return $result;
}
-
+
/**
* Проверяет количество налоговых ставок
*
* @param Vat[]|null $vats Если передать массив, то проверит количество его элементов.
* Иначе проверит количество уже присвоенных элементов.
* @return bool true если всё хорошо, иначе выбрасывает исключение
- * @throws AtolTooManyVatsException Слишком много ставок НДС
+ * @throws TooManyVatsException Слишком много ставок НДС
*/
protected function validateCount(?array $vats = null): bool
{
if ((!empty($vats) && count($vats) >= self::MAX_COUNT) || count($this->vats) >= self::MAX_COUNT) {
- throw new AtolTooManyVatsException(count($vats), self::MAX_COUNT);
+ throw new TooManyVatsException(count($vats), self::MAX_COUNT);
}
return true;
}
diff --git a/src/AtolOnline/Exceptions/AtolException.php b/src/Exceptions/AtolException.php
similarity index 75%
rename from src/AtolOnline/Exceptions/AtolException.php
rename to src/Exceptions/AtolException.php
index dbf4d18..b548ab6 100644
--- a/src/AtolOnline/Exceptions/AtolException.php
+++ b/src/Exceptions/AtolException.php
@@ -1,12 +1,14 @@
ffd_tags;
}
diff --git a/src/AtolOnline/Exceptions/AtolAuthFailedException.php b/src/Exceptions/AuthFailedException.php
similarity index 55%
rename from src/AtolOnline/Exceptions/AtolAuthFailedException.php
rename to src/Exceptions/AuthFailedException.php
index 5cf16b3..9c2c76a 100644
--- a/src/AtolOnline/Exceptions/AtolAuthFailedException.php
+++ b/src/Exceptions/AuthFailedException.php
@@ -1,12 +1,14 @@
isValid()
? $message
- : '['.$last_response->error->code.'] '.$last_response->error->text.
- '. ERROR_ID: '.$last_response->error->error_id.
- '. TYPE: '.$last_response->error->type;
+ : '[' . $last_response->error->code . '] ' . $last_response->error->text .
+ '. ERROR_ID: ' . $last_response->error->error_id .
+ '. TYPE: ' . $last_response->error->type;
$code = $last_response->isValid() ? $code : $last_response->error->code;
parent::__construct($message, $code, $previous);
}
diff --git a/src/AtolOnline/Exceptions/AtolTooLongException.php b/src/Exceptions/BasicTooLongException.php
similarity index 55%
rename from src/AtolOnline/Exceptions/AtolTooLongException.php
rename to src/Exceptions/BasicTooLongException.php
index eb56c53..d27905b 100644
--- a/src/AtolOnline/Exceptions/AtolTooLongException.php
+++ b/src/Exceptions/BasicTooLongException.php
@@ -1,40 +1,40 @@
message.' (max length - '.$max.', actual length - '.
- valid_strlen($string), $code, $previous);
+ parent::__construct($message ?: $this->message . ' (max length - ' . $max . ', actual length - ' .
+ mb_strlen($string), $code, $previous);
}
}
\ No newline at end of file
diff --git a/src/AtolOnline/Exceptions/AtolTooManyException.php b/src/Exceptions/BasicTooManyException.php
similarity index 50%
rename from src/AtolOnline/Exceptions/AtolTooManyException.php
rename to src/Exceptions/BasicTooManyException.php
index 427c96b..7f4dd3e 100644
--- a/src/AtolOnline/Exceptions/AtolTooManyException.php
+++ b/src/Exceptions/BasicTooManyException.php
@@ -1,40 +1,43 @@
message.' (max - '.$max.', actual - '.$quantity.')';
- parent::__construct($message, $code, $previous);
+ parent::__construct(
+ $message ?: $this->message . ' (max - ' . $max . ', actual - ' . $quantity . ')',
+ $code,
+ $previous
+ );
}
}
\ No newline at end of file
diff --git a/src/AtolOnline/Exceptions/AtolCorrectionInfoException.php b/src/Exceptions/EmptyCorrectionInfoException.php
similarity index 76%
rename from src/AtolOnline/Exceptions/AtolCorrectionInfoException.php
rename to src/Exceptions/EmptyCorrectionInfoException.php
index bda765b..f0b2f1f 100644
--- a/src/AtolOnline/Exceptions/AtolCorrectionInfoException.php
+++ b/src/Exceptions/EmptyCorrectionInfoException.php
@@ -1,20 +1,20 @@
'https://testonline.atol.ru/possystem/v4/',
+ 'company_name' => 'АТОЛ',
+ 'inn' => '5544332219',
+ 'payment_address' => 'https://v4.online.atol.ru',
+ 'group' => 'v4-online-atol-ru_4179',
+ 'login' => 'v4-online-atol-ru',
+ 'password' => 'iGFFuihss',
+ 'endpoint_ofd' => 'https://consumer.1-ofd-test.ru/v1',
+ ];
+ }
+
+ /**
+ * Возвращает данные для работы с тестовой средой АТОЛ Онлайн ФФД 1.2
+ *
+ * @return string[]
+ */
+ public static function FFD12(): array
+ {
+ return [
+ 'endpoint' => 'https://testonline.atol.ru/possystem/v5/',
+ 'company_name' => 'АТОЛ',
+ 'inn' => '5544332219',
+ 'payment_address' => 'https://v5.online.atol.ru',
+ 'group' => 'v5-online-atol-ru_5179',
+ 'login' => 'v5-online-atol-ru',
+ 'password' => 'zUr0OxfI',
+ 'endpoint_ofd' => '',
+ ];
+ }
+}
\ No newline at end of file
diff --git a/src/helpers.php b/src/helpers.php
deleted file mode 100644
index c4f0900..0000000
--- a/src/helpers.php
+++ /dev/null
@@ -1,16 +0,0 @@
-assertIsObject($entity);
+ $this->assertIsObject($entity->jsonSerialize());
+ $this->assertIsString((string)$entity);
$this->assertJson((string)$entity);
- return $this;
- }
-
- /**
- *
- */
- public function tearDown(): void
- {
- //parent::tearDown();
- }
-
- /**
- * Возвращает случайную строку указанной длины
- *
- * @param int $length
- * @return string
- */
- protected static function randomString($length = 8)
- {
- $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $string = '';
- for ($i = 0; $i < $length; $i++) {
- $string .= $characters[mt_rand(0, strlen($characters) - 1)];
+ if ($json_structure) {
+ $this->assertEquals(json_encode($json_structure), (string)$entity);
}
- return $string;
+ }
+
+ /**
+ * Провайдер валидных телефонов
+ *
+ * @return array>
+ */
+ public function providerValidPhones(): array
+ {
+ return [
+ ['+79991234567', '+79991234567'],
+ ['79991234567', '+79991234567'],
+ ['89991234567', '+89991234567'],
+ ['+7 999 123 45 67', '+79991234567'],
+ ['+7 (999) 123-45-67', '+79991234567'],
+ ["+7 %(?9:9\"9')abc\r123\n45\t67\0", '+79991234567'],
+ ];
+ }
+
+ /**
+ * Провайдер валидных email-ов
+ *
+ * @return array>
+ */
+ public function providerValidEmails(): array
+ {
+ return [
+ ['abc@mail.com'],
+ ['abc-d@mail.com'],
+ ['abc.def@mail.com'],
+ ['abc.def@mail.org'],
+ ['abc.def@mail-archive.com'],
+ ];
}
}
\ No newline at end of file
diff --git a/tests/ClientTest.php b/tests/ClientTest.php
new file mode 100644
index 0000000..8447c27
--- /dev/null
+++ b/tests/ClientTest.php
@@ -0,0 +1,317 @@
+>
+ */
+ public function providerNullableStrings(): array
+ {
+ return [
+ [''],
+ [' '],
+ [null],
+ ["\n\r\t"],
+ ];
+ }
+
+ /**
+ * Провайдер телефонов, которые приводятся к null
+ *
+ * @return array>
+ */
+ public function providerNullablePhones(): array
+ {
+ return array_merge(
+ $this->providerNullableStrings(),
+ [
+ [Helpers::randomStr(10, false)],
+ ["asdfgvs \n\rtt\t*/(*&%^*$%"],
+ ]
+ );
+ }
+
+ /**
+ * Провайдер невалидных email-ов
+ *
+ * @return array>
+ */
+ public function providerInvalidEmails(): array
+ {
+ return [
+ ['@example'],
+ [Helpers::randomStr(15)],
+ ['@example.com'],
+ ['abc.def@mail'],
+ ['.abc@mail.com'],
+ ['example@example'],
+ ['abc..def@mail.com'],
+ ['abc.def@mail..com'],
+ ['abc.def@mail#archive.com'],
+ ];
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Тестирует приведение покупателя к json
+ *
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::jsonSerialize
+ */
+ public function testAtolable(): void
+ {
+ $this->assertAtolable(new Client());
+ }
+
+ /**
+ * Тестирует конструктор покупателя без передачи значений
+ *
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::jsonSerialize
+ */
+ public function testConstructorWithoutArgs(): void
+ {
+ $this->assertEquals('{}', (string)(new Client()));
+ }
+
+ /**
+ * Тестирует конструктор с передачей значений (внутри работают сеттеры)
+ *
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::jsonSerialize
+ * @covers \AtolOnline\Entities\Client::setName
+ * @covers \AtolOnline\Entities\Client::setPhone
+ * @covers \AtolOnline\Entities\Client::setEmail
+ * @covers \AtolOnline\Entities\Client::setInn
+ */
+ public function testConstructorWithArgs(): void
+ {
+ $customer = new Client(
+ 'John Doe',
+ 'john@example.com',
+ '+1/22/99*73s dsdas654 5s6', // +122997365456
+ '+fasd3\qe3fs_=nac99013928czc' // 3399013928
+ );
+ $this->assertAtolable($customer, [
+ 'name' => 'John Doe',
+ 'email' => 'john@example.com',
+ 'phone' => '+122997365456',
+ 'inn' => '3399013928',
+ ]);
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Тестирует установку имён покупателя, которые приводятся к null
+ *
+ * @param mixed $name
+ * @dataProvider providerNullableStrings
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setName
+ * @covers \AtolOnline\Entities\Client::getName
+ * @throws TooLongNameException
+ */
+ public function testNullableNames(mixed $name): void
+ {
+ $customer = (new Client())->setName($name);
+ $this->assertNull($customer->getName());
+ }
+
+ /**
+ * Тестирует установку валидного имени покупателя
+ *
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setName
+ * @covers \AtolOnline\Entities\Client::getName
+ * @throws TooLongNameException
+ */
+ public function testValidName(): void
+ {
+ $name = Helpers::randomStr();
+ $customer = (new Client())->setName($name);
+ $this->assertEquals($name, $customer->getName());
+ }
+
+ /**
+ * Тестирует установку невалидного имени покупателя
+ *
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setName
+ * @covers \AtolOnline\Exceptions\TooLongNameException
+ * @throws TooLongNameException
+ */
+ public function testInvalidName(): void
+ {
+ $this->expectException(TooLongNameException::class);
+ (new Client())->setName(Helpers::randomStr(400));
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Тестирует установку телефонов покупателя, которые приводятся к null
+ *
+ * @param mixed $phone
+ * @dataProvider providerNullablePhones
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setPhone
+ * @covers \AtolOnline\Entities\Client::getPhone
+ * @throws TooLongPhoneException
+ */
+ public function testNullablePhones(mixed $phone): void
+ {
+ $customer = (new Client())->setPhone($phone);
+ $this->assertNull($customer->getPhone());
+ }
+
+ /**
+ * Тестирует установку валидного телефона покупателя
+ *
+ * @dataProvider providerValidPhones
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setPhone
+ * @covers \AtolOnline\Entities\Client::getPhone
+ * @throws TooLongPhoneException
+ */
+ public function testValidPhone(string $input, string $output): void
+ {
+ $customer = (new Client())->setPhone($input);
+ $this->assertEquals($output, $customer->getPhone());
+ }
+
+ /**
+ * Тестирует установку невалидного телефона покупателя
+ *
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setPhone
+ * @covers \AtolOnline\Exceptions\TooLongPhoneException
+ * @throws TooLongPhoneException
+ */
+ public function testInvalidPhone(): void
+ {
+ $this->expectException(TooLongPhoneException::class);
+ (new Client())->setPhone('99999999999999999999999999999999999999999999999999999999999999999999999999');
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Тестирует установку валидных email-ов покупателя
+ *
+ * @param mixed $email
+ * @dataProvider providerValidEmails
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setEmail
+ * @covers \AtolOnline\Entities\Client::getEmail
+ * @throws TooLongEmailException
+ * @throws InvalidEmailException
+ */
+ public function testValidEmails(mixed $email): void
+ {
+ $customer = (new Client())->setEmail($email);
+ $this->assertEquals($email, $customer->getEmail());
+ }
+
+ /**
+ * Тестирует установку слишком длинного email покупателя
+ *
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setEmail
+ * @covers \AtolOnline\Exceptions\TooLongEmailException
+ * @throws TooLongEmailException
+ * @throws InvalidEmailException
+ */
+ public function testTooLongEmail(): void
+ {
+ $this->expectException(TooLongEmailException::class);
+ (new Client())->setEmail(Helpers::randomStr(65));
+ }
+
+ /**
+ * Тестирует установку невалидного email покупателя
+ *
+ * @param mixed $email
+ * @dataProvider providerInvalidEmails
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setEmail
+ * @covers \AtolOnline\Exceptions\InvalidEmailException
+ * @throws TooLongEmailException
+ * @throws InvalidEmailException
+ */
+ public function testInvalidEmail(mixed $email): void
+ {
+ $this->expectException(InvalidEmailException::class);
+ (new Client())->setEmail($email);
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Тестирует исключение о корректной длине ИНН
+ *
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setInn
+ * @covers \AtolOnline\Entities\Client::getInn
+ * @throws InvalidInnLengthException
+ */
+ public function testValidInn(): void
+ {
+ $customer = (new Client())->setInn('1234567890');
+ $this->assertEquals('1234567890', $customer->getInn());
+ $customer = $customer->setInn('123456789012');
+ $this->assertEquals('123456789012', $customer->getInn());
+ }
+
+ /**
+ * Тестирует исключение о некорректной длине ИНН (10 цифр)
+ *
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setInn
+ * @covers \AtolOnline\Exceptions\InvalidInnLengthException
+ * @throws InvalidInnLengthException
+ */
+ public function testInvalidInn10(): void
+ {
+ $this->expectException(InvalidInnLengthException::class);
+ (new Client())->setInn('12345678901');
+ }
+
+ /**
+ * Тестирует исключение о некорректной длине ИНН (12 цифр)
+ *
+ * @covers \AtolOnline\Entities\Client
+ * @covers \AtolOnline\Entities\Client::setInn
+ * @covers \AtolOnline\Exceptions\InvalidInnLengthException
+ * @throws InvalidInnLengthException
+ */
+ public function testInvalidInn12(): void
+ {
+ $this->expectException(InvalidInnLengthException::class);
+ (new Client())->setInn('1234567890123');
+ }
+}
\ No newline at end of file
diff --git a/tests/CompanyTest.php b/tests/CompanyTest.php
new file mode 100644
index 0000000..cad4c86
--- /dev/null
+++ b/tests/CompanyTest.php
@@ -0,0 +1,134 @@
+assertAtolable(new Company(
+ $email = 'company@example.com',
+ $sno = SnoTypes::OSN,
+ $inn = '1234567890',
+ $payment_address = 'https://example.com',
+ ), [
+ 'email' => $email,
+ 'sno' => $sno,
+ 'inn' => $inn,
+ 'payment_address' => $payment_address,
+ ]);
+ }
+
+ /**
+ * Тестирует исключение о слишком длинном email
+ *
+ * @covers \AtolOnline\Entities\Company
+ * @covers \AtolOnline\Entities\Company::setEmail
+ * @covers \AtolOnline\Exceptions\TooLongEmailException
+ */
+ public function testEmailTooLongException()
+ {
+ $this->expectException(TooLongEmailException::class);
+ new Company(Helpers::randomStr(65), SnoTypes::OSN, '1234567890', 'https://example.com');
+ }
+
+ /**
+ * Тестирует исключение о невалидном email
+ *
+ * @covers \AtolOnline\Entities\Company
+ * @covers \AtolOnline\Entities\Company::setEmail
+ * @covers \AtolOnline\Exceptions\InvalidEmailException
+ */
+ public function testInvalidEmailException()
+ {
+ $this->expectException(InvalidEmailException::class);
+ new Company('company@examas%^*.com', SnoTypes::OSN, '1234567890', 'https://example.com');
+ }
+
+ /**
+ * Тестирует исключение о слишком длинном платёжном адресе
+ *
+ * @covers \AtolOnline\Entities\Company
+ * @covers \AtolOnline\Entities\Company::setSno
+ * @covers \AtolOnline\Exceptions\InvalidSnoException
+ */
+ public function testInvalidSnoException()
+ {
+ $this->expectException(InvalidSnoException::class);
+ new Company('company@example.com', 'test', '1234567890', 'https://example.com');
+ }
+
+ /**
+ * Тестирует исключение о слишком длинном платёжном адресе
+ *
+ * @covers \AtolOnline\Entities\Company
+ * @covers \AtolOnline\Entities\Company::setInn
+ * @covers \AtolOnline\Exceptions\InvalidInnLengthException
+ */
+ public function testInvalidInnLengthException()
+ {
+ $this->expectException(InvalidInnLengthException::class);
+ new Company('company@example.com', SnoTypes::OSN, Helpers::randomStr(13), 'https://example.com');
+ }
+
+ /**
+ * Тестирует исключение о слишком длинном платёжном адресе
+ *
+ * @covers \AtolOnline\Entities\Company
+ * @covers \AtolOnline\Entities\Company::setPaymentAddress
+ * @covers \AtolOnline\Exceptions\TooLongPaymentAddressException
+ */
+ public function testTooLongPaymentAddressException()
+ {
+ $this->expectException(TooLongPaymentAddressException::class);
+ new Company('company@example.com', SnoTypes::OSN, '1234567890', Helpers::randomStr(257));
+ }
+
+ /**
+ * Тестирует исключение о невалидном платёжном адресе
+ *
+ * @covers \AtolOnline\Entities\Company
+ * @covers \AtolOnline\Entities\Company::setPaymentAddress
+ * @covers \AtolOnline\Exceptions\InvalidPaymentAddressException
+ */
+ public function testInvalidPaymentAddressException()
+ {
+ $this->expectException(InvalidPaymentAddressException::class);
+ new Company('company@example.com', SnoTypes::OSN, '1234567890', '');
+ }
+}
\ No newline at end of file
diff --git a/tests/HelpersTest.php b/tests/HelpersTest.php
new file mode 100644
index 0000000..1259886
--- /dev/null
+++ b/tests/HelpersTest.php
@@ -0,0 +1,123 @@
+>
+ */
+ public function providerKopeksToRubles(): array
+ {
+ return [
+ [null, 0],
+ [0, 0],
+ [1, 0.01],
+ [12, 0.12],
+ [123, 1.23],
+ [1234, 12.34],
+ [12345, 123.45],
+ [-1, 0.01],
+ [-12, 0.12],
+ [-123, 1.23],
+ [-1234, 12.34],
+ [-12345, 123.45],
+ ];
+ }
+
+ /**
+ * Провайдер рублей для перевода в копейки
+ *
+ * @return array>
+ */
+ public function providerRublesToKopeks(): array
+ {
+ return [
+ [null, 0],
+ [0, 0],
+ [0.01, 1],
+ [0.12, 12],
+ [1.23, 123],
+ [12.34, 1234],
+ [123.45, 12345],
+ [-0.01, 1],
+ [-0.12, 12],
+ [-1.23, 123],
+ [-12.34, 1234],
+ [-123.45, 12345],
+ ];
+ }
+
+ /**
+ * Провайдер для тестирования генерации рандомной строки
+ *
+ * @return array>
+ */
+ public function providerRandomStr(): array
+ {
+ return [
+ [0, 0],
+ [1, 1],
+ [5, 5],
+ [-1, 1],
+ [-5, 5],
+ ];
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Тестирует перевод копеек в рубли
+ *
+ * @dataProvider providerKopeksToRubles
+ * @covers \AtolOnline\Helpers::KopToRub
+ */
+ public function testKopeksToRubles(?int $kopeks, float $rubles): void
+ {
+ $result = Helpers::KopToRub($kopeks);
+ $this->assertIsFloat($result);
+ $this->assertEquals($result, $rubles);
+ }
+
+ /**
+ * Тестирует перевод копеек в рубли
+ *
+ * @dataProvider providerRublesToKopeks
+ * @covers \AtolOnline\Helpers::RubToKop
+ */
+ public function testRublesToKopeks(?float $rubles, int $kopeks): void
+ {
+ $result = Helpers::RubToKop($rubles);
+ $this->assertIsInt($result);
+ $this->assertEquals($result, $kopeks);
+ }
+
+ /**
+ * Тестирует длину рандомной строки
+ *
+ * @param int $input
+ * @param int $output
+ * @dataProvider providerRandomStr
+ */
+ public function testRandomString(int $input, int $output): void
+ {
+ $result = Helpers::randomStr($input);
+ $this->assertIsString($result);
+ $this->assertEquals($output, strlen($result));
+ // тестировать на наличие цифр быссмысленно
+ }
+}
\ No newline at end of file
diff --git a/tests/Feature/ItemTest.php b/tests/ItemTest_todo.php
similarity index 68%
rename from tests/Feature/ItemTest.php
rename to tests/ItemTest_todo.php
index 0971910..59a8288 100644
--- a/tests/Feature/ItemTest.php
+++ b/tests/ItemTest_todo.php
@@ -1,34 +1,37 @@
checkAtolEntity($item);
+ $this->assertAtolable($item);
$this->assertEquals('Банан', $item->getName());
$this->assertEquals(65.99, $item->getPrice());
$this->assertEquals(2.74, $item->getQuantity());
@@ -50,15 +53,15 @@ class ItemTest extends BasicTestCase
$this->assertEquals(PaymentObjects::COMMODITY, $item->getPaymentObject());
$this->assertEquals(PaymentMethods::FULL_PAYMENT, $item->getPaymentMethod());
}
-
+
/**
* Тестирует установку параметров через сеттеры
*
- * @throws AtolOnline\Exceptions\AtolNameTooLongException
- * @throws AtolOnline\Exceptions\AtolPriceTooHighException
- * @throws AtolOnline\Exceptions\AtolTooManyException
- * @throws AtolOnline\Exceptions\AtolUnitTooLongException
- * @throws AtolOnline\Exceptions\AtolUserdataTooLongException
+ * @throws AtolOnline\Exceptions\TooLongNameException
+ * @throws AtolOnline\Exceptions\TooHighPriceException
+ * @throws AtolOnline\Exceptions\BasicTooManyException
+ * @throws AtolOnline\Exceptions\TooLongUnitException
+ * @throws AtolOnline\Exceptions\TooLongUserdataException
*/
public function testSetters()
{
@@ -71,7 +74,7 @@ class ItemTest extends BasicTestCase
$item->setPaymentObject(PaymentObjects::COMMODITY);
$item->setPaymentMethod(PaymentMethods::FULL_PAYMENT);
$item->setUserData('Some user data');
- $this->checkAtolEntity($item);
+ $this->assertAtolable($item);
$this->assertEquals('Банан', $item->getName());
$this->assertEquals(65.99, $item->getPrice());
$this->assertEquals(2.74, $item->getQuantity());
@@ -81,11 +84,11 @@ class ItemTest extends BasicTestCase
$this->assertEquals(PaymentMethods::FULL_PAYMENT, $item->getPaymentMethod());
$this->assertEquals('Some user data', $item->getUserData());
}
-
+
/**
* Тестирует установку ставки НДС разными путями
*
- * @throws \AtolOnline\Exceptions\AtolPriceTooHighException
+ * @throws TooHighPriceException
*/
public function testSetVat()
{
@@ -95,66 +98,66 @@ class ItemTest extends BasicTestCase
$item->setVatType(VatTypes::VAT20);
$this->assertEquals(VatTypes::VAT20, $item->getVat()->getType());
}
-
+
/**
* Тестирует исключение о слишком длинном наименовании
*
- * @throws \AtolOnline\Exceptions\AtolNameTooLongException
+ * @throws TooLongNameException
*/
public function testAtolNameTooLongException()
{
$item = new Item();
- $this->expectException(AtolNameTooLongException::class);
- $item->setName(self::randomString(130));
+ $this->expectException(TooLongNameException::class);
+ $item->setName(Helpers::randomStr(130));
}
-
+
/**
* Тестирует исключение о слишком высоком количестве
*
- * @throws \AtolOnline\Exceptions\AtolPriceTooHighException
- * @throws \AtolOnline\Exceptions\AtolTooManyException
- * @throws \AtolOnline\Exceptions\AtolUnitTooLongException
+ * @throws TooHighPriceException
+ * @throws BasicTooManyException
+ * @throws TooLongUnitException
*/
public function testAtolQuantityTooHighException()
{
$item = new Item();
- $this->expectException(AtolTooManyException::class);
+ $this->expectException(BasicTooManyException::class);
$item->setQuantity(100000.1);
}
-
+
/**
* Тестирует исключение о слишком высокой цене
*
- * @throws \AtolOnline\Exceptions\AtolPriceTooHighException
+ * @throws TooHighPriceException
*/
public function testAtolPriceTooHighException()
{
$item = new Item();
- $this->expectException(AtolPriceTooHighException::class);
+ $this->expectException(TooHighPriceException::class);
$item->setPrice(42949673.1);
}
-
+
/**
* Тестирует исключение о слишком длинных польз. данных
*
- * @throws \AtolOnline\Exceptions\AtolUserdataTooLongException
+ * @throws TooLongUserdataException
*/
public function testAtolUserdataTooLongException()
{
$item = new Item();
- $this->expectException(AtolUserdataTooLongException::class);
+ $this->expectException(TooLongUserdataException::class);
$item->setUserData('User data User data User data User data User data User data User data');
}
-
+
/**
* Тестирует исключение о слишком длинной единице измерения
*
- * @throws \AtolOnline\Exceptions\AtolUnitTooLongException
+ * @throws TooLongUnitException
*/
public function testAtolUnitTooLongException()
{
$item = new Item();
- $this->expectException(AtolUnitTooLongException::class);
+ $this->expectException(TooLongUnitException::class);
$item->setMeasurementUnit('кг кг кг кг кг кг кг кг кг ');
}
}
\ No newline at end of file
diff --git a/tests/Unit/ClientTest.php b/tests/Unit/ClientTest.php
deleted file mode 100644
index 0df1a53..0000000
--- a/tests/Unit/ClientTest.php
+++ /dev/null
@@ -1,103 +0,0 @@
-checkAtolEntity($customer);
- $this->assertEquals('John Doe', $customer->getName());
- $this->assertEquals('+122997365456', $customer->getPhone());
- $this->assertEquals('john@example.com', $customer->getEmail());
- $this->assertEquals('3399013928', $customer->getInn());
- }
-
- /**
- * Тестирует исключение о слишком длинном имени
- *
- * @throws \AtolOnline\Exceptions\AtolNameTooLongException
- */
- public function testAtolNameTooLongException()
- {
- $customer = new Client();
- $this->expectException(AtolNameTooLongException::class);
- $customer->setName(self::randomString(257));
- }
-
- /**
- * Тестирует исключение о слишком длинном телефоне
- *
- * @throws \AtolOnline\Exceptions\AtolPhoneTooLongException
- */
- public function testAtolPhoneTooLongException()
- {
- $customer = new Client();
- $this->expectException(AtolPhoneTooLongException::class);
- $customer->setPhone('99999999999999999999999999999999999999999999999999999999999999999999999999');
- }
-
- /**
- * Тестирует исключение о слишком длинной почте
- *
- * @throws \AtolOnline\Exceptions\AtolEmailTooLongException
- * @throws \AtolOnline\Exceptions\AtolEmailValidateException
- */
- public function testAtolEmailTooLongException()
- {
- $customer = new Client();
- $this->expectException(AtolEmailTooLongException::class);
- $customer->setEmail(self::randomString(65));
- }
-
- /**
- * Тестирует исключение о некорректной почте
- *
- * @throws \AtolOnline\Exceptions\AtolEmailTooLongException
- * @throws \AtolOnline\Exceptions\AtolEmailValidateException
- */
- public function testAtolEmailValidateException()
- {
- $customer = new Client();
- $this->expectException(AtolEmailValidateException::class);
- $customer->setEmail(self::randomString(15));
- }
-
- /**
- * Тестирует исключение о некорректной длине ИНН
- *
- * @throws \AtolOnline\Exceptions\AtolInnWrongLengthException
- */
- public function testAtolInnWrongLengthException()
- {
- $company = new Client();
- $this->expectException(AtolInnWrongLengthException::class);
- $company->setInn('123456789');
- $company->setInn('1234567890123');
- }
-}
\ No newline at end of file
diff --git a/tests/Unit/CompanyTest.php b/tests/Unit/CompanyTest.php
deleted file mode 100644
index 4211303..0000000
--- a/tests/Unit/CompanyTest.php
+++ /dev/null
@@ -1,91 +0,0 @@
-checkAtolEntity($company);
- $this->assertEquals(SnoTypes::OSN, $company->getSno());
- $this->assertEquals('5544332219', $company->getInn());
- $this->assertEquals('https://v4.online.atol.ru', $company->getPaymentAddress());
- $this->assertEquals('company@example.com', $company->getEmail());
- }
-
- /**
- * Тестирует исключение о некорректной длине ИНН
- *
- * @throws \AtolOnline\Exceptions\AtolInnWrongLengthException
- */
- public function testAtolInnWrongLengthException()
- {
- $company = new Company();
- $this->expectException(AtolInnWrongLengthException::class);
- $company->setInn('321');
- $company->setInn('1234567890123');
- }
-
- /**
- * Тестирует исключение о слишком длинном платёжном адресе
- *
- * @throws \AtolOnline\Exceptions\AtolPaymentAddressTooLongException
- */
- public function testAtolPaymentAddressTooLongException()
- {
- $company = new Company();
- $this->expectException(AtolPaymentAddressTooLongException::class);
- $company->setPaymentAddress(self::randomString(257));
- }
-
- /**
- * Тестирует исключение о слишком длинной почте
- *
- * @throws \AtolOnline\Exceptions\AtolEmailTooLongException
- * @throws \AtolOnline\Exceptions\AtolEmailValidateException
- */
- public function testAtolEmailTooLongException()
- {
- $company = new Company();
- $this->expectException(AtolEmailTooLongException::class);
- $company->setEmail(self::randomString(65));
- }
-
- /**
- * Тестирует исключение о некорректной почте
- *
- * @throws \AtolOnline\Exceptions\AtolEmailTooLongException
- * @throws \AtolOnline\Exceptions\AtolEmailValidateException
- */
- public function testAtolEmailValidateException()
- {
- $company = new Company();
- $this->expectException(AtolEmailValidateException::class);
- $company->setEmail(self::randomString(15));
- }
-}
\ No newline at end of file
diff --git a/tests/Unit/VatTest.php b/tests/VatTest_todo.php
similarity index 61%
rename from tests/Unit/VatTest.php
rename to tests/VatTest_todo.php
index 57f15d3..5810438 100644
--- a/tests/Unit/VatTest.php
+++ b/tests/VatTest_todo.php
@@ -1,39 +1,43 @@
assertEquals(0, $vat->getFinalSum(), 'Test '.$vat_type.' | 1 step');
+ $this->assertEquals(0, $vat->getFinalSum(), 'Test ' . $vat_type . ' | 1 step');
$vat->setSum($sum);
- $this->assertEquals($expected_set, $vat->getFinalSum(), 'Test '.$vat_type.' | 2 step');
+ $this->assertEquals($expected_set, $vat->getFinalSum(), 'Test ' . $vat_type . ' | 2 step');
$vat->addSum(20);
- $this->assertEquals($expected_add, $vat->getFinalSum(), 'Test '.$vat_type.' | 3 step');
+ $this->assertEquals($expected_add, $vat->getFinalSum(), 'Test ' . $vat_type . ' | 3 step');
$vat->addSum(-20);
}
-
+
/**
* Провайдер данных для тестирования разных типов ставок НДС
*