diff --git a/.env.dist b/.env.dist index 15e3584..4602e26 100644 --- a/.env.dist +++ b/.env.dist @@ -1,3 +1,3 @@ -MG_BOT_URL="https://mg-test.retailcrm.pro/" +MG_BOT_URL="https://mg-s1.retailcrm.pro/" MG_BOT_KEY="" MG_BOT_DBG="" diff --git a/.gitignore b/.gitignore index 5ac2b6c..1c6217f 100644 --- a/.gitignore +++ b/.gitignore @@ -196,4 +196,4 @@ build/* test-report.xml # GraphViz Dot -dot/* \ No newline at end of file +dot/* diff --git a/.travis.yml b/.travis.yml index 94e53ab..c360499 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ cache: - $HOME/.composer/cache php: - - '7.0' - '7.1' - '7.2' - '7.3' @@ -14,4 +13,7 @@ before_script: - flags="-o" - composer install $flags -script: make travis \ No newline at end of file +script: make travis + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/Makefile b/Makefile index 1cb760a..68e40d2 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) SRC_DIR=$(ROOT_DIR)/src -BIN_DIR=$(ROOT_DIR)/bin +BIN_DIR=$(ROOT_DIR)/vendor/bin test: @echo "==> Running tests" @@ -11,7 +11,7 @@ test: stan: @echo "==> Running analysis" - @php $(BIN_DIR)/phpstan analyse -a $(ROOT_DIR)/extra/autoloader.php -l 4 src + @php $(BIN_DIR)/phpstan analyse @echo "==> Analysis complete" travis: test stan diff --git a/README.md b/README.md index 1cd0b0f..f5bae4a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ [![Build Status](https://img.shields.io/travis/retailcrm/mg-bot-api-client-php/master.svg?style=flat-square)](https://travis-ci.org/retailcrm/mg-bot-api-client-php) +[![Covarage](https://img.shields.io/codecov/c/gh/retailcrm/mg-bot-api-client-php/master.svg?style=flat-square)](https://codecov.io/gh/retailcrm/mg-bot-api-client-php) [![Latest stable](https://img.shields.io/packagist/v/retailcrm/mg-bot-api-client-php.svg?style=flat-square)](https://packagist.org/packages/retailcrm/mg-bot-api-client-php) -[![PHP from Packagist](https://img.shields.io/packagist/php-v/mg-bot-retailcrm/api-client-php.svg?style=flat-square)](https://packagist.org/packages/retailcrm/mg-bot-api-client-php) +[![PHP from Packagist](https://img.shields.io/packagist/php-v/retailcrm/mg-bot-api-client-php.svg?style=flat-square)](https://packagist.org/packages/retailcrm/mg-bot-api-client-php) # retailCRM API PHP client @@ -9,7 +10,7 @@ This is php retailCRM MG Bot API client. ## Requirements -* PHP 7.0 and above +* PHP 7.1 and above * PHP's cURL support * PHP's JSON support diff --git a/composer.json b/composer.json index a42e510..8476209 100644 --- a/composer.json +++ b/composer.json @@ -12,40 +12,21 @@ } ], "require": { - "php": ">=7.0", + "php": ">=7.1", "ext-curl": "*", "ext-json": "*", "jms/serializer": "1.14.*", - "symfony/validator": "3.*", - "doctrine/annotations": "1.4.*", + "symfony/validator": "4.3.*", + "doctrine/annotations": "1.6.*", "doctrine/cache": "1.6.*", - "guzzlehttp/guzzle": "6.*", - "doctrine/instantiator": "1.0.*", - "symfony/translation": "3.*", - "symfony/dependency-injection": "3.*", - "symfony/config": "3.*", - "symfony/finder": "3.4.*", - "symfony/filesystem": "3.*" + "guzzlehttp/guzzle": "6.*" }, "require-dev": { "phpmd/phpmd": "2.*", "squizlabs/php_codesniffer": "3.4.*", - "symfony/dotenv": "3.*", - "friendsofphp/php-cs-fixer": "2.*", - "phpunit/phpunit": "6.*", - "nette/bootstrap": "2.*", - "nette/neon": "2.*", - "nette/php-generator": "3.0.*", - "phpstan/phpstan": "0.9.*", - "ocramius/package-versions": "1.2.*", - "nette/finder": "2.4.*", - "symfony/console": "3.*", - "symfony/debug": "3.*", - "symfony/event-dispatcher": "3.*", - "symfony/options-resolver": "3.4.*", - "symfony/process": "3.4.*", - "symfony/stopwatch": "3.4.*", - "myclabs/deep-copy": "1.6.*" + "symfony/dotenv": "4.3.*", + "phpunit/phpunit": "7.*", + "phpstan/phpstan": "0.11.*" }, "support": { "email": "support@retailcrm.ru" @@ -63,7 +44,7 @@ } }, "config": { - "bin-dir": "bin", + "bin-dir": "vendor/bin", "process-timeout": 600 } } diff --git a/composer.lock b/composer.lock index f064c7a..d2c8d25 100644 --- a/composer.lock +++ b/composer.lock @@ -1,37 +1,37 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "eb2db3a82485e57635ef21c116770aa8", + "content-hash": "6e3c14ec41fb380210d5ef5869a9fda3", "packages": [ { "name": "doctrine/annotations", - "version": "v1.4.0", + "version": "v1.6.1", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" + "reference": "53120e0eb10355388d6ccbe462f1fea34ddadb24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/53120e0eb10355388d6ccbe462f1fea34ddadb24", + "reference": "53120e0eb10355388d6ccbe462f1fea34ddadb24", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": "^5.6 || ^7.0" + "php": "^7.1" }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -72,7 +72,7 @@ "docblock", "parser" ], - "time": "2017-02-24T16:22:25+00:00" + "time": "2019-03-25T19:12:02+00:00" }, { "name": "doctrine/cache", @@ -146,32 +146,34 @@ }, { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "a2c590166b2133a4633738648b6b064edae0814a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", + "reference": "a2c590166b2133a4633738648b6b064edae0814a", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -191,12 +193,12 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2019-03-17T17:37:11+00:00" }, { "name": "doctrine/lexer", @@ -713,55 +715,6 @@ ], "time": "2015-07-25T16:39:46+00:00" }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://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": "2017-02-14T16:28:37+00:00" - }, { "name": "psr/http-message", "version": "1.0.1", @@ -852,240 +805,6 @@ "description": "A polyfill for getallheaders.", "time": "2016-02-11T07:05:27+00:00" }, - { - "name": "symfony/config", - "version": "v3.4.28", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "177a276c01575253c95cefe0866e3d1b57637fe0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/177a276c01575253c95cefe0866e3d1b57637fe0", - "reference": "177a276c01575253c95cefe0866e3d1b57637fe0", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" - }, - "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2019-02-23T15:06:07+00:00" - }, - { - "name": "symfony/dependency-injection", - "version": "v3.4.28", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "8f2a0452f086a66f6d6cf53a432867b575887768" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/8f2a0452f086a66f6d6cf53a432867b575887768", - "reference": "8f2a0452f086a66f6d6cf53a432867b575887768", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/container": "^1.0" - }, - "conflict": { - "symfony/config": "<3.3.7", - "symfony/finder": "<3.3", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "psr/container-implementation": "1.0" - }, - "require-dev": { - "symfony/config": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2019-05-19T14:11:39+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v3.4.28", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "acf99758b1df8e9295e6b85aa69f294565c9fedb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/acf99758b1df8e9295e6b85aa69f294565c9fedb", - "reference": "acf99758b1df8e9295e6b85aa69f294565c9fedb", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2019-02-04T21:34:32+00:00" - }, - { - "name": "symfony/finder", - "version": "v3.4.28", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "fa5d962a71f2169dfe1cbae217fa5a2799859f6c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/fa5d962a71f2169dfe1cbae217fa5a2799859f6c", - "reference": "fa5d962a71f2169dfe1cbae217fa5a2799859f6c", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2019-05-24T12:25:55+00:00" - }, { "name": "symfony/polyfill-ctype", "version": "v1.11.0", @@ -1131,7 +850,7 @@ }, { "name": "Gert de Pagter", - "email": "backendtea@gmail.com" + "email": "BackEndTea@gmail.com" } ], "description": "Symfony polyfill for ctype functions", @@ -1204,56 +923,35 @@ "time": "2019-02-06T07:57:58+00:00" }, { - "name": "symfony/translation", - "version": "v3.4.28", + "name": "symfony/translation-contracts", + "version": "v1.1.5", "source": { "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "301a5d627220a1c4ee522813b0028653af6c4f54" + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "cb4b18ad7b92a26e83b65dde940fab78339e6f3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/301a5d627220a1c4ee522813b0028653af6c4f54", - "reference": "301a5d627220a1c4ee522813b0028653af6c4f54", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/cb4b18ad7b92a26e83b65dde940fab78339e6f3c", + "reference": "cb4b18ad7b92a26e83b65dde940fab78339e6f3c", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "~3.4|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", - "symfony/var-dumper": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" + "php": "^7.1.3" }, "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" + "symfony/translation-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "1.1-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Symfony\\Contracts\\Translation\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1261,57 +959,70 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Translation Component", + "description": "Generic abstractions related to translation", "homepage": "https://symfony.com", - "time": "2019-05-01T11:10:09+00:00" + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-06-13T11:15:36+00:00" }, { "name": "symfony/validator", - "version": "v3.4.28", + "version": "v4.3.2", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "23cf394faaffb6257f5764fbfc2db12ec30956f1" + "reference": "ba2cb2ba24344e56a32b5284be988bc1faeac209" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/23cf394faaffb6257f5764fbfc2db12ec30956f1", - "reference": "23cf394faaffb6257f5764fbfc2db12ec30956f1", + "url": "https://api.github.com/repos/symfony/validator/zipball/ba2cb2ba24344e56a32b5284be988bc1faeac209", + "reference": "ba2cb2ba24344e56a32b5284be988bc1faeac209", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", + "php": "^7.1.3", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation": "~2.8|~3.0|~4.0" + "symfony/translation-contracts": "^1.1" }, "conflict": { "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/dependency-injection": "<3.3", - "symfony/http-kernel": "<3.3.5", + "symfony/dependency-injection": "<3.4", + "symfony/http-kernel": "<3.4", + "symfony/intl": "<4.3", + "symfony/translation": "<4.2", "symfony/yaml": "<3.4" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0", "egulias/email-validator": "^1.2.8|~2.0", - "symfony/cache": "~3.1|~4.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/http-foundation": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "^3.3.5|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", - "symfony/property-access": "~2.8|~3.0|~4.0", - "symfony/var-dumper": "~3.3|~4.0", + "symfony/cache": "~3.4|~4.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/http-client": "^4.3", + "symfony/http-foundation": "~4.1", + "symfony/http-kernel": "~3.4|~4.0", + "symfony/intl": "^4.3", + "symfony/property-access": "~3.4|~4.0", + "symfony/property-info": "~3.4|~4.0", + "symfony/translation": "~4.2", + "symfony/var-dumper": "~3.4|~4.0", "symfony/yaml": "~3.4|~4.0" }, "suggest": { @@ -1324,12 +1035,14 @@ "symfony/http-foundation": "", "symfony/intl": "", "symfony/property-access": "For accessing properties within comparison constraints", + "symfony/property-info": "To automatically add NotNull and Type constraints", + "symfony/translation": "For translating validation errors.", "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -1356,72 +1069,10 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2019-05-05T16:11:06+00:00" + "time": "2019-06-22T08:39:44+00:00" } ], "packages-dev": [ - { - "name": "composer/semver", - "version": "1.5.0", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "time": "2019-03-19T17:25:45+00:00" - }, { "name": "composer/xdebug-handler", "version": "1.3.3", @@ -1466,94 +1117,6 @@ ], "time": "2019-05-27T17:52:04+00:00" }, - { - "name": "friendsofphp/php-cs-fixer", - "version": "v2.15.1", - "source": { - "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "20064511ab796593a3990669eff5f5b535001f7c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/20064511ab796593a3990669eff5f5b535001f7c", - "reference": "20064511ab796593a3990669eff5f5b535001f7c", - "shasum": "" - }, - "require": { - "composer/semver": "^1.4", - "composer/xdebug-handler": "^1.2", - "doctrine/annotations": "^1.2", - "ext-json": "*", - "ext-tokenizer": "*", - "php": "^5.6 || ^7.0", - "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6", - "symfony/event-dispatcher": "^3.0 || ^4.0", - "symfony/filesystem": "^3.0 || ^4.0", - "symfony/finder": "^3.0 || ^4.0", - "symfony/options-resolver": "^3.0 || ^4.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0", - "symfony/stopwatch": "^3.0 || ^4.0" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", - "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.2", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.1", - "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", - "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^4.3" - }, - "suggest": { - "ext-mbstring": "For handling non-UTF8 characters in cache signature.", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." - }, - "bin": [ - "php-cs-fixer" - ], - "type": "application", - "autoload": { - "psr-4": { - "PhpCsFixer\\": "src/" - }, - "classmap": [ - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationCaseFactory.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php", - "tests/Test/IntegrationCaseFactoryInterface.php", - "tests/Test/InternalIntegrationCaseFactory.php", - "tests/TestCase.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "A tool to automatically fix PHP code style", - "time": "2019-06-01T10:32:12+00:00" - }, { "name": "jean85/pretty-package-versions", "version": "1.2", @@ -1607,37 +1170,43 @@ }, { "name": "myclabs/deep-copy", - "version": "1.6.1", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { "psr-4": { "DeepCopy\\": "src/DeepCopy/" - } + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", "keywords": [ "clone", "copy", @@ -1645,43 +1214,40 @@ "object", "object graph" ], - "time": "2017-04-12T18:52:22+00:00" + "time": "2019-04-07T13:18:21+00:00" }, { "name": "nette/bootstrap", - "version": "v2.4.6", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/nette/bootstrap.git", - "reference": "268816e3f1bb7426c3a4ceec2bd38a036b532543" + "reference": "e1075af05c211915e03e0c86542f3ba5433df4a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/bootstrap/zipball/268816e3f1bb7426c3a4ceec2bd38a036b532543", - "reference": "268816e3f1bb7426c3a4ceec2bd38a036b532543", + "url": "https://api.github.com/repos/nette/bootstrap/zipball/e1075af05c211915e03e0c86542f3ba5433df4a3", + "reference": "e1075af05c211915e03e0c86542f3ba5433df4a3", "shasum": "" }, "require": { - "nette/di": "~2.4.7", - "nette/utils": "~2.4", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" + "nette/di": "^3.0", + "nette/utils": "^3.0", + "php": ">=7.1" }, "require-dev": { - "latte/latte": "~2.2", - "nette/application": "~2.3", - "nette/caching": "~2.3", - "nette/database": "~2.3", - "nette/forms": "~2.3", - "nette/http": "~2.4.0", - "nette/mail": "~2.3", - "nette/robot-loader": "^2.4.2 || ^3.0", - "nette/safe-stream": "~2.2", - "nette/security": "~2.3", - "nette/tester": "~2.0", - "tracy/tracy": "^2.4.1" + "latte/latte": "^2.2", + "nette/application": "^3.0", + "nette/caching": "^3.0", + "nette/database": "^3.0", + "nette/forms": "^3.0", + "nette/http": "^3.0", + "nette/mail": "^3.0", + "nette/robot-loader": "^3.0", + "nette/safe-stream": "^2.2", + "nette/security": "^3.0", + "nette/tester": "^2.0", + "tracy/tracy": "^2.6" }, "suggest": { "nette/robot-loader": "to use Configurator::createRobotLoader()", @@ -1690,7 +1256,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1714,53 +1280,57 @@ "homepage": "https://nette.org/contributors" } ], - "description": "? Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", + "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", "homepage": "https://nette.org", "keywords": [ "bootstrapping", "configurator", "nette" ], - "time": "2018-05-17T12:52:20+00:00" + "time": "2019-03-26T12:59:07+00:00" }, { "name": "nette/di", - "version": "v2.4.15", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/nette/di.git", - "reference": "d0561b8f77e8ef2ed6d83328860e16c81a5a8649" + "reference": "19d83539245aaacb59470828919182411061841f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/di/zipball/d0561b8f77e8ef2ed6d83328860e16c81a5a8649", - "reference": "d0561b8f77e8ef2ed6d83328860e16c81a5a8649", + "url": "https://api.github.com/repos/nette/di/zipball/19d83539245aaacb59470828919182411061841f", + "reference": "19d83539245aaacb59470828919182411061841f", "shasum": "" }, "require": { "ext-tokenizer": "*", - "nette/neon": "^2.3.3 || ~3.0.0", - "nette/php-generator": "^2.6.1 || ^3.0.0", - "nette/utils": "^2.5.0 || ~3.0.0", - "php": ">=5.6.0" + "nette/neon": "^3.0", + "nette/php-generator": "^3.2.2", + "nette/robot-loader": "^3.2", + "nette/schema": "^1.0", + "nette/utils": "^3.0", + "php": ">=7.1" }, "conflict": { - "nette/bootstrap": "<2.4", - "nette/nette": "<2.2" + "nette/bootstrap": "<3.0" }, "require-dev": { - "nette/tester": "^2.0", + "nette/tester": "^2.2", "tracy/tracy": "^2.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/compatibility.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1779,7 +1349,7 @@ "homepage": "https://nette.org/contributors" } ], - "description": "? Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", + "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", "homepage": "https://nette.org", "keywords": [ "compiled", @@ -1790,37 +1360,37 @@ "nette", "static" ], - "time": "2019-01-30T13:26:05+00:00" + "time": "2019-04-03T19:35:46+00:00" }, { "name": "nette/finder", - "version": "v2.4.2", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/nette/finder.git", - "reference": "ee951a656cb8ac622e5dd33474a01fd2470505a0" + "reference": "6be1b83ea68ac558aff189d640abe242e0306fe2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/finder/zipball/ee951a656cb8ac622e5dd33474a01fd2470505a0", - "reference": "ee951a656cb8ac622e5dd33474a01fd2470505a0", + "url": "https://api.github.com/repos/nette/finder/zipball/6be1b83ea68ac558aff189d640abe242e0306fe2", + "reference": "6be1b83ea68ac558aff189d640abe242e0306fe2", "shasum": "" }, "require": { - "nette/utils": "~2.4", - "php": ">=5.6.0" + "nette/utils": "^2.4 || ~3.0.0", + "php": ">=7.1" }, "conflict": { "nette/nette": "<2.2" }, "require-dev": { - "nette/tester": "~2.0", + "nette/tester": "^2.0", "tracy/tracy": "^2.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -1852,35 +1422,35 @@ "iterator", "nette" ], - "time": "2018-06-28T11:49:23+00:00" + "time": "2019-02-28T18:13:25+00:00" }, { "name": "nette/neon", - "version": "v2.4.3", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/nette/neon.git", - "reference": "5e72b1dd3e2d34f0863c5561139a19df6a1ef398" + "reference": "cbff32059cbdd8720deccf9e9eace6ee516f02eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/neon/zipball/5e72b1dd3e2d34f0863c5561139a19df6a1ef398", - "reference": "5e72b1dd3e2d34f0863c5561139a19df6a1ef398", + "url": "https://api.github.com/repos/nette/neon/zipball/cbff32059cbdd8720deccf9e9eace6ee516f02eb", + "reference": "cbff32059cbdd8720deccf9e9eace6ee516f02eb", "shasum": "" }, "require": { "ext-iconv": "*", "ext-json": "*", - "php": ">=5.6.0" + "php": ">=7.0" }, "require-dev": { - "nette/tester": "~2.0", + "nette/tester": "^2.0", "tracy/tracy": "^2.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1913,28 +1483,25 @@ "nette", "yaml" ], - "time": "2018-03-21T12:12:21+00:00" + "time": "2019-02-05T21:30:40+00:00" }, { "name": "nette/php-generator", - "version": "v3.0.5", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/nette/php-generator.git", - "reference": "ea90209c2e8a7cd087b2742ca553c047a8df5eff" + "reference": "acff8b136fad84b860a626d133e791f95781f9f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/php-generator/zipball/ea90209c2e8a7cd087b2742ca553c047a8df5eff", - "reference": "ea90209c2e8a7cd087b2742ca553c047a8df5eff", + "url": "https://api.github.com/repos/nette/php-generator/zipball/acff8b136fad84b860a626d133e791f95781f9f5", + "reference": "acff8b136fad84b860a626d133e791f95781f9f5", "shasum": "" }, "require": { "nette/utils": "^2.4.2 || ~3.0.0", - "php": ">=7.0" - }, - "conflict": { - "nette/nette": "<2.2" + "php": ">=7.1" }, "require-dev": { "nette/tester": "^2.0", @@ -1943,7 +1510,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1967,7 +1534,7 @@ "homepage": "https://nette.org/contributors" } ], - "description": "? Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.2 features.", + "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.3 features.", "homepage": "https://nette.org", "keywords": [ "code", @@ -1975,30 +1542,27 @@ "php", "scaffolding" ], - "time": "2018-08-09T14:32:27+00:00" + "time": "2019-03-15T03:41:13+00:00" }, { "name": "nette/robot-loader", - "version": "v3.1.1", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/nette/robot-loader.git", - "reference": "3e8d75d6d976e191bdf46752ca40a286671219d2" + "reference": "0712a0e39ae7956d6a94c0ab6ad41aa842544b5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/robot-loader/zipball/3e8d75d6d976e191bdf46752ca40a286671219d2", - "reference": "3e8d75d6d976e191bdf46752ca40a286671219d2", + "url": "https://api.github.com/repos/nette/robot-loader/zipball/0712a0e39ae7956d6a94c0ab6ad41aa842544b5c", + "reference": "0712a0e39ae7956d6a94c0ab6ad41aa842544b5c", "shasum": "" }, "require": { "ext-tokenizer": "*", - "nette/finder": "^2.3 || ^3.0", - "nette/utils": "^2.4 || ^3.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" + "nette/finder": "^2.5", + "nette/utils": "^3.0", + "php": ">=7.1" }, "require-dev": { "nette/tester": "^2.0", @@ -2007,7 +1571,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2040,52 +1604,39 @@ "nette", "trait" ], - "time": "2019-03-01T20:23:02+00:00" + "time": "2019-03-08T21:57:24+00:00" }, { - "name": "nette/utils", - "version": "v2.5.3", + "name": "nette/schema", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/nette/utils.git", - "reference": "17b9f76f2abd0c943adfb556e56f2165460b15ce" + "url": "https://github.com/nette/schema.git", + "reference": "6241d8d4da39e825dd6cb5bfbe4242912f4d7e4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/17b9f76f2abd0c943adfb556e56f2165460b15ce", - "reference": "17b9f76f2abd0c943adfb556e56f2165460b15ce", + "url": "https://api.github.com/repos/nette/schema/zipball/6241d8d4da39e825dd6cb5bfbe4242912f4d7e4d", + "reference": "6241d8d4da39e825dd6cb5bfbe4242912f4d7e4d", "shasum": "" }, "require": { - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" + "nette/utils": "^3.0.1", + "php": ">=7.1" }, "require-dev": { - "nette/tester": "~2.0", + "nette/tester": "^2.2", "tracy/tracy": "^2.3" }, - "suggest": { - "ext-gd": "to use Image", - "ext-iconv": "to use Strings::webalize() and toAscii()", - "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", - "ext-json": "to use Nette\\Utils\\Json", - "ext-mbstring": "to use Strings::lower() etc...", - "ext-xml": "to use Strings::length() etc. when mbstring is not available" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "1.0-dev" } }, "autoload": { "classmap": [ "src/" - ], - "files": [ - "src/loader.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2104,7 +1655,71 @@ "homepage": "https://nette.org/contributors" } ], - "description": "? Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "description": "📐 Nette Schema: validating data structures against a given Schema.", + "homepage": "https://nette.org", + "keywords": [ + "config", + "nette" + ], + "time": "2019-04-03T15:53:25+00:00" + }, + { + "name": "nette/utils", + "version": "v3.0.1", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "bd961f49b211997202bda1d0fbc410905be370d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/bd961f49b211997202bda1d0fbc410905be370d4", + "reference": "bd961f49b211997202bda1d0fbc410905be370d4", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize() and toAscii()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", "homepage": "https://nette.org", "keywords": [ "array", @@ -2122,28 +1737,28 @@ "utility", "validation" ], - "time": "2018-09-18T10:22:16+00:00" + "time": "2019-03-22T01:00:30+00:00" }, { "name": "nikic/php-parser", - "version": "v3.1.5", + "version": "v4.2.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" + "reference": "1bd73cc04c3843ad8d6b0bfc0956026a151fc420" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bd73cc04c3843ad8d6b0bfc0956026a151fc420", + "reference": "1bd73cc04c3843ad8d6b0bfc0956026a151fc420", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.5" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "phpunit/phpunit": "^6.5 || ^7.0" }, "bin": [ "bin/php-parse" @@ -2151,7 +1766,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -2173,31 +1788,32 @@ "parser", "php" ], - "time": "2018-02-28T20:30:58+00:00" + "time": "2019-05-25T20:07:01+00:00" }, { "name": "ocramius/package-versions", - "version": "1.2.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "ad8a245decad4897cc6b432743913dad0d69753c" + "reference": "a4d4b60d0e60da2487bd21a2c6ac089f85570dbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/ad8a245decad4897cc6b432743913dad0d69753c", - "reference": "ad8a245decad4897cc6b432743913dad0d69753c", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/a4d4b60d0e60da2487bd21a2c6ac089f85570dbb", + "reference": "a4d4b60d0e60da2487bd21a2c6ac089f85570dbb", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0", - "php": "~7.0" + "composer-plugin-api": "^1.0.0", + "php": "^7.1.0" }, "require-dev": { - "composer/composer": "^1.3", + "composer/composer": "^1.6.3", + "doctrine/coding-standard": "^5.0.1", "ext-zip": "*", - "humbug/humbug": "dev-master", - "phpunit/phpunit": "^6.4" + "infection/infection": "^0.7.1", + "phpunit/phpunit": "^7.0.0" }, "type": "composer-plugin", "extra": { @@ -2222,52 +1838,7 @@ } ], "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2017-11-24T11:07:03+00:00" - }, - { - "name": "paragonie/random_compat", - "version": "v9.99.99", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "shasum": "" - }, - "require": { - "php": "^7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "time": "2018-07-02T15:55:56+00:00" + "time": "2019-02-21T12:16:21+00:00" }, { "name": "pdepend/pdepend", @@ -2311,22 +1882,22 @@ }, { "name": "phar-io/manifest", - "version": "1.0.1", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", - "phar-io/version": "^1.0.1", + "phar-io/version": "^2.0", "php": "^5.6 || ^7.0" }, "type": "library", @@ -2362,20 +1933,20 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05T18:14:27+00:00" + "time": "2018-07-08T19:23:20+00:00" }, { "name": "phar-io/version", - "version": "1.0.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", "shasum": "" }, "require": { @@ -2409,58 +1980,7 @@ } ], "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+00:00" - }, - { - "name": "php-cs-fixer/diff", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3", - "symfony/process": "^3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "SpacePossum" - } - ], - "description": "sebastian/diff v2 backport support for PHP5.6", - "homepage": "https://github.com/PHP-CS-Fixer", - "keywords": [ - "diff" - ], - "time": "2018-02-15T16:58:55+00:00" + "time": "2018-07-08T19:19:57+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2745,33 +2265,35 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "0.2", + "version": "0.3.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "02f909f134fe06f0cd4790d8627ee24efbe84d6a" + "reference": "8c4ef2aefd9788238897b678a985e1d5c8df6db4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/02f909f134fe06f0cd4790d8627ee24efbe84d6a", - "reference": "02f909f134fe06f0cd4790d8627ee24efbe84d6a", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/8c4ef2aefd9788238897b678a985e1d5c8df6db4", + "reference": "8c4ef2aefd9788238897b678a985e1d5c8df6db4", "shasum": "" }, "require": { - "php": "~7.0" + "php": "~7.1" }, "require-dev": { - "consistence/coding-standard": "^2.0.0", + "consistence/coding-standard": "^3.5", "jakub-onderka/php-parallel-lint": "^0.9.2", "phing/phing": "^2.16.0", - "phpstan/phpstan": "^0.9", + "phpstan/phpstan": "^0.10", "phpunit/phpunit": "^6.3", - "slevomat/coding-standard": "^3.3.0" + "slevomat/coding-standard": "^4.7.2", + "squizlabs/php_codesniffer": "^3.3.2", + "symfony/process": "^3.4 || ^4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.1-dev" + "dev-master": "0.3-dev" } }, "autoload": { @@ -2786,46 +2308,57 @@ "MIT" ], "description": "PHPDoc parser with support for nullable, intersection and generic types", - "time": "2018-01-13T18:19:41+00:00" + "time": "2019-06-07T19:13:52+00:00" }, { "name": "phpstan/phpstan", - "version": "0.9.2", + "version": "0.11.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e59541bcc7cac9b35ca54db6365bf377baf4a488" + "reference": "fcf0081bf3a254ddacffa03e78be87842d0c09c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e59541bcc7cac9b35ca54db6365bf377baf4a488", - "reference": "e59541bcc7cac9b35ca54db6365bf377baf4a488", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fcf0081bf3a254ddacffa03e78be87842d0c09c9", + "reference": "fcf0081bf3a254ddacffa03e78be87842d0c09c9", "shasum": "" }, "require": { + "composer/xdebug-handler": "^1.3.0", "jean85/pretty-package-versions": "^1.0.3", "nette/bootstrap": "^2.4 || ^3.0", "nette/di": "^2.4.7 || ^3.0", "nette/robot-loader": "^3.0.1", + "nette/schema": "^1.0", "nette/utils": "^2.4.5 || ^3.0", - "nikic/php-parser": "^3.1", - "php": "~7.0", - "phpstan/phpdoc-parser": "^0.2", + "nikic/php-parser": "^4.0.2", + "php": "~7.1", + "phpstan/phpdoc-parser": "^0.3.4", "symfony/console": "~3.2 || ~4.0", "symfony/finder": "~3.2 || ~4.0" }, + "conflict": { + "symfony/console": "3.4.16 || 4.1.5" + }, "require-dev": { - "consistence/coding-standard": "2.2.1", - "ext-gd": "*", + "brianium/paratest": "^2.0", + "consistence/coding-standard": "^3.5", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", "ext-intl": "*", "ext-mysqli": "*", - "jakub-onderka/php-parallel-lint": "^0.9.2", + "ext-soap": "*", + "ext-zip": "*", + "jakub-onderka/php-parallel-lint": "^1.0", + "localheinz/composer-normalize": "^1.1.0", "phing/phing": "^2.16.0", - "phpstan/phpstan-php-parser": "^0.9", - "phpstan/phpstan-phpunit": "^0.9.3", - "phpstan/phpstan-strict-rules": "^0.9", - "phpunit/phpunit": "^6.5.4", - "slevomat/coding-standard": "4.0.0" + "phpstan/phpstan-deprecation-rules": "^0.11", + "phpstan/phpstan-php-parser": "^0.11", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-strict-rules": "^0.11", + "phpunit/phpunit": "^7.0", + "slevomat/coding-standard": "^4.7.2", + "squizlabs/php_codesniffer": "^3.3.2" }, "bin": [ "bin/phpstan" @@ -2833,7 +2366,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.9-dev" + "dev-master": "0.11-dev" } }, "autoload": { @@ -2849,44 +2382,44 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2018-01-28T13:22:19+00:00" + "time": "2019-05-28T19:58:33+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "5.3.2", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac" + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.0", - "phpunit/php-file-iterator": "^1.4.2", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0.1", + "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^7.0" }, "suggest": { - "ext-xdebug": "^2.5.5" + "ext-xdebug": "^2.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.3.x-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -2912,29 +2445,32 @@ "testing", "xunit" ], - "time": "2018-04-06T15:36:58+00:00" + "time": "2018-10-31T16:06:48+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -2949,7 +2485,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -2959,7 +2495,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -3004,28 +2540,28 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -3040,7 +2576,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -3049,33 +2585,33 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2019-06-07T04:22:29+00:00" }, { "name": "phpunit/php-token-stream", - "version": "2.0.2", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.2.4" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -3098,57 +2634,57 @@ "keywords": [ "tokenizer" ], - "time": "2017-11-27T05:48:46+00:00" + "time": "2018-10-30T05:52:18+00:00" }, { "name": "phpunit/phpunit", - "version": "6.5.14", + "version": "7.5.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7" + "reference": "b9278591caa8630127f96c63b598712b699e671c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bac23fe7ff13dbdb461481f706f0e9fe746334b7", - "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b9278591caa8630127f96c63b598712b699e671c", + "reference": "b9278591caa8630127f96c63b598712b699e671c", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", - "phar-io/manifest": "^1.0.1", - "phar-io/version": "^1.0", - "php": "^7.0", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.3", - "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.9", - "sebastian/comparator": "^2.1", - "sebastian/diff": "^2.0", - "sebastian/environment": "^3.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", "sebastian/exporter": "^3.1", "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", + "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" + "phpunit/phpunit-mock-objects": "*" }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" + "phpunit/php-invoker": "^2.0" }, "bin": [ "phpunit" @@ -3156,7 +2692,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.5.x-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -3182,67 +2718,56 @@ "testing", "xunit" ], - "time": "2019-02-01T05:22:47+00:00" + "time": "2019-06-19T12:01:51+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "5.0.10", + "name": "psr/container", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", - "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.0", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" - }, - "conflict": { - "phpunit/phpunit": "<6.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.5.11" - }, - "suggest": { - "ext-soap": "*" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\Container\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", "keywords": [ - "mock", - "xunit" + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" ], - "abandoned": true, - "time": "2018-08-09T05:50:03+00:00" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/log", @@ -3338,30 +2863,30 @@ }, { "name": "sebastian/comparator", - "version": "2.1.3", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/diff": "^2.0 || ^3.0", + "php": "^7.1", + "sebastian/diff": "^3.0", "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -3398,32 +2923,33 @@ "compare", "equality" ], - "time": "2018-02-01T13:46:46+00:00" + "time": "2018-07-12T15:12:46+00:00" }, { "name": "sebastian/diff", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.2" + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -3448,34 +2974,40 @@ "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2017-08-03T08:09:46+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "3.1.0", + "version": "4.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404", + "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.1" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -3500,7 +3032,7 @@ "environment", "hhvm" ], - "time": "2017-07-01T08:51:00+00:00" + "time": "2019-05-05T09:05:15+00:00" }, { "name": "sebastian/exporter", @@ -3767,25 +3299,25 @@ }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -3805,7 +3337,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2018-10-04T04:07:39+00:00" }, { "name": "sebastian/version", @@ -3902,26 +3434,92 @@ "time": "2019-04-10T23:49:02+00:00" }, { - "name": "symfony/console", - "version": "v3.4.28", + "name": "symfony/config", + "version": "v4.3.2", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6" + "url": "https://github.com/symfony/config.git", + "reference": "9198eea354be75794a7b1064de00d9ae9ae5090f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6", - "reference": "8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6", + "url": "https://api.github.com/repos/symfony/config/zipball/9198eea354be75794a7b1064de00d9ae9ae5090f", + "reference": "9198eea354be75794a7b1064de00d9ae9ae5090f", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" + "php": "^7.1.3", + "symfony/filesystem": "~3.4|~4.0", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/finder": "<3.4" + }, + "require-dev": { + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/finder": "~3.4|~4.0", + "symfony/messenger": "~4.1", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2019-06-08T06:33:08+00:00" + }, + { + "name": "symfony/console", + "version": "v4.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "b592b26a24265a35172d8a2094d8b10f22b7cc39" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/b592b26a24265a35172d8a2094d8b10f22b7cc39", + "reference": "b592b26a24265a35172d8a2094d8b10f22b7cc39", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/service-contracts": "^1.1" }, "conflict": { "symfony/dependency-injection": "<3.4", + "symfony/event-dispatcher": "<4.3", "symfony/process": "<3.3" }, "provide": { @@ -3929,11 +3527,12 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", + "symfony/config": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "^4.3", "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" + "symfony/process": "~3.4|~4.0", + "symfony/var-dumper": "^4.3" }, "suggest": { "psr/log": "For using the console logger", @@ -3944,7 +3543,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -3971,41 +3570,58 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-05-09T08:42:51+00:00" + "time": "2019-06-13T11:03:18+00:00" }, { - "name": "symfony/debug", - "version": "v3.4.28", + "name": "symfony/dependency-injection", + "version": "v4.3.2", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "671fc55bd14800668b1d0a3708c3714940e30a8c" + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "b851928be349c065197fdc0832f78d85139e3903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/671fc55bd14800668b1d0a3708c3714940e30a8c", - "reference": "671fc55bd14800668b1d0a3708c3714940e30a8c", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b851928be349c065197fdc0832f78d85139e3903", + "reference": "b851928be349c065197fdc0832f78d85139e3903", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" + "php": "^7.1.3", + "psr/container": "^1.0", + "symfony/service-contracts": "^1.1.2" }, "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "symfony/config": "<4.3", + "symfony/finder": "<3.4", + "symfony/proxy-manager-bridge": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "psr/container-implementation": "1.0", + "symfony/service-implementation": "1.0" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" + "symfony/config": "^4.3", + "symfony/expression-language": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Component\\DependencyInjection\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -4025,34 +3641,34 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Debug Component", + "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2019-05-18T13:32:47+00:00" + "time": "2019-06-15T04:08:07+00:00" }, { "name": "symfony/dotenv", - "version": "v3.4.28", + "version": "v4.3.2", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "7b33c7b6f497898a173e4b9d6a7698cd789d54ce" + "reference": "c9ea2a1c60e7db08c1d1379cd4448fd14bda11eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/7b33c7b6f497898a173e4b9d6a7698cd789d54ce", - "reference": "7b33c7b6f497898a173e4b9d6a7698cd789d54ce", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/c9ea2a1c60e7db08c1d1379cd4448fd14bda11eb", + "reference": "c9ea2a1c60e7db08c1d1379cd4448fd14bda11eb", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "require-dev": { - "symfony/process": "~3.2|~4.0" + "symfony/process": "~3.4|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -4084,48 +3700,35 @@ "env", "environment" ], - "time": "2019-04-01T07:08:40+00:00" + "time": "2019-06-26T06:50:02+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v3.4.28", + "name": "symfony/filesystem", + "version": "v4.3.2", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a088aafcefb4eef2520a290ed82e4374092a6dff" + "url": "https://github.com/symfony/filesystem.git", + "reference": "b9896d034463ad6fd2bf17e2bf9418caecd6313d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a088aafcefb4eef2520a290ed82e4374092a6dff", - "reference": "a088aafcefb4eef2520a290ed82e4374092a6dff", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b9896d034463ad6fd2bf17e2bf9418caecd6313d", + "reference": "b9896d034463ad6fd2bf17e2bf9418caecd6313d", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" + "Symfony\\Component\\Filesystem\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -4145,36 +3748,36 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-04-02T08:51:52+00:00" + "time": "2019-06-23T08:51:25+00:00" }, { - "name": "symfony/options-resolver", - "version": "v3.4.28", + "name": "symfony/finder", + "version": "v4.3.2", "source": { "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "ed3b397f9c07c8ca388b2a1ef744403b4d4ecc44" + "url": "https://github.com/symfony/finder.git", + "reference": "33c21f7d5d3dc8a140c282854a7e13aeb5d0f91a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/ed3b397f9c07c8ca388b2a1ef744403b4d4ecc44", - "reference": "ed3b397f9c07c8ca388b2a1ef744403b4d4ecc44", + "url": "https://api.github.com/repos/symfony/finder/zipball/33c21f7d5d3dc8a140c282854a7e13aeb5d0f91a", + "reference": "33c21f7d5d3dc8a140c282854a7e13aeb5d0f91a", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" + "Symfony\\Component\\Finder\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -4194,128 +3797,9 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony OptionsResolver Component", + "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "keywords": [ - "config", - "configuration", - "options" - ], - "time": "2019-04-10T16:00:48+00:00" - }, - { - "name": "symfony/polyfill-php70", - "version": "v1.11.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "bc4858fb611bda58719124ca079baff854149c89" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/bc4858fb611bda58719124ca079baff854149c89", - "reference": "bc4858fb611bda58719124ca079baff854149c89", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "~1.0|~2.0|~9.99", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "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.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2019-02-06T07:57:58+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.11.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/ab50dcf166d5f577978419edd37aa2bb8eabce0c", - "reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11-dev" - } - }, - "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" - ], - "time": "2019-02-06T07:57:58+00:00" + "time": "2019-06-13T11:03:18+00:00" }, { "name": "symfony/polyfill-php73", @@ -4376,35 +3860,36 @@ "time": "2019-02-06T07:57:58+00:00" }, { - "name": "symfony/process", - "version": "v3.4.28", + "name": "symfony/service-contracts", + "version": "v1.1.5", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "afe411c2a6084f25cff55a01d0d4e1474c97ff13" + "url": "https://github.com/symfony/service-contracts.git", + "reference": "f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/afe411c2a6084f25cff55a01d0d4e1474c97ff13", - "reference": "afe411c2a6084f25cff55a01d0d4e1474c97ff13", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d", + "reference": "f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "1.1-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Symfony\\Contracts\\Service\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4412,66 +3897,25 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Generic abstractions related to writing services", "homepage": "https://symfony.com", - "time": "2019-05-22T12:54:11+00:00" - }, - { - "name": "symfony/stopwatch", - "version": "v3.4.28", - "source": { - "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "2a651c2645c10bbedd21170771f122d935e0dd58" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/2a651c2645c10bbedd21170771f122d935e0dd58", - "reference": "2a651c2645c10bbedd21170771f122d935e0dd58", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Stopwatch Component", - "homepage": "https://symfony.com", - "time": "2019-01-16T09:39:14+00:00" + "time": "2019-06-13T11:15:36+00:00" }, { "name": "theseer/tokenizer", @@ -4571,7 +4015,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.0", + "php": ">=7.1", "ext-curl": "*", "ext-json": "*" }, diff --git a/extra/autoloader.php b/extra/autoloader.php index 8fc5a70..2852f72 100644 --- a/extra/autoloader.php +++ b/extra/autoloader.php @@ -11,7 +11,7 @@ use Composer\Autoload\ClassLoader; $autoloadFile = file_exists(__DIR__ . '/../vendor/autoload.php') ? __DIR__ . '/../vendor/autoload.php' : __DIR__ . '/../../../autoload.php'; - + $loader = require $autoloadFile; AnnotationRegistry::registerLoader('class_exists'); diff --git a/phpstan.neon b/phpstan.neon index 8bf1d16..83bf90b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,6 @@ parameters: autoload_files: - %currentWorkingDirectory%/vendor/autoload.php - level: 4 + level: 7 paths: - %currentWorkingDirectory%/src diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6d8dd5a..699b6c8 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,36 @@ - + + - - tests/Bot/Tests + + tests - ./src/Bot + src + + + + + diff --git a/src/Bot/Adapter/ModelAdapter.php b/src/Bot/Adapter/ModelAdapter.php new file mode 100644 index 0000000..e0b7acf --- /dev/null +++ b/src/Bot/Adapter/ModelAdapter.php @@ -0,0 +1,87 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Adapter; + +use RetailCrm\Common\Exception\InvalidJsonException; +use RetailCrm\Common\Serializer; +use RetailCrm\Mg\Bot\Model\Response; + +/** + * Class ModelAdapter + * + * @package RetailCrm\Mg\Bot\Adapter + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class ModelAdapter +{ + /** + * @var mixed $model + */ + private $model; + + /** + * @var string $classname + */ + private $classname; + + /** + * ModelAdapter constructor. + * + * @param string $classname + * + */ + public function __construct(string $classname) + { + $this->model = new $classname; + $this->classname = $classname; + } + + /** + * Get Response Model + * + * @param \RetailCrm\Mg\Bot\Model\Response $response + * + * @return \RetailCrm\Mg\Bot\Model\ModelInterface + */ + public function getResponseModel(Response $response) + { + return Serializer::deserialize($response->getBody(), $this->model); + } + + /** + * Get Response List + * + * @param \RetailCrm\Mg\Bot\Model\Response $response + * + * @return array + */ + public function getResponseList(Response $response) + { + $array = json_decode($response->getBody(), true); + + if (json_last_error() != JSON_ERROR_NONE) { + throw new InvalidJsonException('Received invalid JSON', 1); + } + + $result = []; + + foreach ($array as $item) { + $result[] = Serializer::deserialize($item, $this->classname, Serializer::S_ARRAY); + } + + return $result; + } +} diff --git a/src/Bot/Adapter/ResponseAdapter.php b/src/Bot/Adapter/ResponseAdapter.php new file mode 100644 index 0000000..850af07 --- /dev/null +++ b/src/Bot/Adapter/ResponseAdapter.php @@ -0,0 +1,61 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Adapter; + +use Psr\Http\Message\ResponseInterface; +use RetailCrm\Mg\Bot\Model\Response; + +/** + * Class ResponseAdapter + * + * @package RetailCrm\Mg\Bot + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class ResponseAdapter +{ + /** + * @var \RetailCrm\Mg\Bot\Model\Response $model + */ + private $model; + /** + * @var \Psr\Http\Message\ResponseInterface $interface + */ + private $interface; + + /** + * ResponseAdapter constructor. + * + * @param \Psr\Http\Message\ResponseInterface $interface + */ + public function __construct(ResponseInterface $interface) + { + $this->interface = $interface; + $this->model = new Response(); + } + + /** + * Build response + * + * @return \RetailCrm\Mg\Bot\Model\Response + */ + public function build(): Response + { + $this->model->setStatus($this->interface->getStatusCode()); + $this->model->setBody((string) $this->interface->getBody()); + + return $this->model; + } +} diff --git a/src/Bot/Client.php b/src/Bot/Client.php index cf21e89..73f647e 100644 --- a/src/Bot/Client.php +++ b/src/Bot/Client.php @@ -1,36 +1,44 @@ - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers + * @package RetailCrm\Mg\Bot + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers */ namespace RetailCrm\Mg\Bot; use Psr\Http\Message\ResponseInterface; -use RetailCrm\Common\Exception\InvalidJsonException; use RetailCrm\Common\Url; use RetailCrm\Common\Serializer; +use RetailCrm\Mg\Bot\Adapter\ModelAdapter; +use RetailCrm\Mg\Bot\Model\Entity\Bot; +use RetailCrm\Mg\Bot\Model\Entity\Channel\Channel; +use RetailCrm\Mg\Bot\Model\Entity\Chat\Chat; +use RetailCrm\Mg\Bot\Model\Entity\Chat\ChatMember; +use RetailCrm\Mg\Bot\Model\Entity\Command; +use RetailCrm\Mg\Bot\Model\Entity\Customer; +use RetailCrm\Mg\Bot\Model\Entity\Dialog; +use RetailCrm\Mg\Bot\Model\Entity\Message\Message; +use RetailCrm\Mg\Bot\Model\Entity\User; use RetailCrm\Mg\Bot\Model\Request\UploadFileByUrlRequest; +use RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse; use RetailCrm\Mg\Bot\Model\Response\FullFileResponse; -use RetailCrm\Mg\Bot\Model\Response\ListResponse; +use RetailCrm\Mg\Bot\Model\Response\MessageSendResponse; use RetailCrm\Mg\Bot\Model\Response\UploadFileResponse; /** - * PHP version 7.0 + * Class Client * - * Client class - * - * @package RetailCrm\Mg\Bot - * @author retailCRM - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers + * @package RetailCrm\Mg\Bot + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers */ class Client { @@ -39,11 +47,6 @@ class Client */ const VERSION = 'v1'; - /** - * @internal - */ - const ERROR_ONLY_RESPONSE = 'ErrorOnlyResponse'; - /** * @var HttpClient */ @@ -52,9 +55,9 @@ class Client /** * Init * - * @param string $url MG API URL - * @param string $token MG API Key - * @param bool $debug Enable or disable debug mode - will log all requests to STDOUT (default: false) + * @param string $url MG API URL + * @param string $token MG API Key + * @param bool $debug Enable or disable debug mode - will log all requests to STDOUT (default: false) * @param \GuzzleHttp\HandlerStack $handler GuzzleHttp::HandlerStack instance (default: null) */ public function __construct($url, $token, $debug = false, $handler = null) @@ -63,115 +66,25 @@ class Client $this->client = new HttpClient($url, $token, $debug ? STDOUT : null, $handler); } - /** - * @param string $path - * @param string $method - * @param object|null $request Request parameters - * @param string $responseType - * @param bool $arrayOfObjects - * - * @return object|null - * @throws \Exception - */ - private function submitRequest( - $path, - $method, - $request, - $responseType, - $arrayOfObjects = false - ) { - $response = $this->client->makeRequest( - $path, - $method, - $request - ); - - $statusCode = $response->getStatusCode(); - $data = json_decode((string) $response->getBody(), true); - - if (json_last_error() == JSON_ERROR_NONE) { - if ($arrayOfObjects) { - return new ListResponse($responseType, $data, $statusCode); - } else { - $obj = Serializer::deserialize($data, $responseType, Serializer::S_ARRAY); - - if ($statusCode >= 400 - && method_exists($obj, 'setErrors') - && method_exists($obj, 'getErrors') - && count(call_user_func([$obj, 'getErrors'])) == 0 - ) { - call_user_func_array([$obj, 'setErrors'], [['Status Code ' . $response->getStatusCode()]]); - } - - if (method_exists($obj, 'setStatusCode')) { - call_user_func_array([$obj, 'setStatusCode'], [$statusCode]); - } - - return $obj; - } - } else { - throw new InvalidJsonException('Received invalid JSON', 1); - } - } - - /** - * @param bool $fromRoot - * @param string ...$classes - * - * @return string - */ - private static function concatClasspath($fromRoot, ...$classes) - { - $path = ''; - - foreach ($classes as $class) { - if (empty($path) && !$fromRoot) { - $path .= $class; - } else { - $path .= '\\' . $class; - } - } - - return $path; - } - - /** - * @param string ...$classes - * - * @return string - */ - private static function getEntityClass(...$classes) - { - return static::concatClasspath(true, 'RetailCrm', 'Mg', 'Bot', 'Model', 'Entity', ...$classes); - } - - /** - * @param string ...$classes - * - * @return string - */ - private static function getResponseClass(...$classes) - { - return static::concatClasspath(true, 'RetailCrm', 'Mg', 'Bot', 'Model', 'Response', ...$classes); - } - /** * Returns filtered bots list * * @param Model\Request\BotsRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object + * @return array * @throws \Exception */ - public function bots(Model\Request\BotsRequest $request) + public function bots(Model\Request\BotsRequest $request): array { - return $this->submitRequest( + $response = $this->client->makeRequest( '/bots', HttpClient::METHOD_GET, - $request, - static::getEntityClass('Bot'), - true + $request ); + + $adapter = new ModelAdapter(Bot::class); + + return $adapter->getResponseList($response); } /** @@ -179,17 +92,20 @@ class Client * * @param Model\Request\InfoRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse|object + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * @throws \Exception */ public function info(Model\Request\InfoRequest $request) { - return $this->submitRequest( + $response = $this->client->makeRequest( '/my/info', HttpClient::METHOD_PATCH, - $request, - static::getResponseClass(self::ERROR_ONLY_RESPONSE) + $request ); + + $adapter = new ModelAdapter(ErrorOnlyResponse::class); + + return $adapter->getResponseModel($response); } /** @@ -197,18 +113,20 @@ class Client * * @param Model\Request\ChannelsRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object + * @return array * @throws \Exception */ - public function channels(Model\Request\ChannelsRequest $request) + public function channels(Model\Request\ChannelsRequest $request): array { - return $this->submitRequest( + $response = $this->client->makeRequest( '/channels', HttpClient::METHOD_GET, - $request, - static::getEntityClass('Channel', 'Channel'), - true + $request ); + + $adapter = new ModelAdapter(Channel::class); + + return $adapter->getResponseList($response); } /** @@ -216,18 +134,20 @@ class Client * * @param Model\Request\ChatsRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object + * @return array * @throws \Exception */ - public function chats(Model\Request\ChatsRequest $request) + public function chats(Model\Request\ChatsRequest $request): array { - return $this->submitRequest( + $response = $this->client->makeRequest( '/chats', HttpClient::METHOD_GET, - $request, - static::getEntityClass('Chat', 'Chat'), - true + $request ); + + $adapter = new ModelAdapter(Chat::class); + + return $adapter->getResponseList($response); } /** @@ -235,18 +155,20 @@ class Client * * @param Model\Request\CommandsRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object + * @return array * @throws \Exception */ - public function commands(Model\Request\CommandsRequest $request) + public function commands(Model\Request\CommandsRequest $request): array { - return $this->submitRequest( + $response = $this->client->makeRequest( '/my/commands', HttpClient::METHOD_GET, - $request, - static::getEntityClass('Command'), - true + $request ); + + $adapter = new ModelAdapter(Command::class); + + return $adapter->getResponseList($response); } /** @@ -254,17 +176,20 @@ class Client * * @param Model\Request\CommandEditRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse|object + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * @throws \Exception */ public function commandEdit(Model\Request\CommandEditRequest $request) { - return $this->submitRequest( + $response = $this->client->makeRequest( sprintf("/my/commands/%s", $request->getName()), HttpClient::METHOD_PUT, - $request, - static::getResponseClass(self::ERROR_ONLY_RESPONSE) + $request ); + + $adapter = new ModelAdapter(ErrorOnlyResponse::class); + + return $adapter->getResponseModel($response); } /** @@ -272,17 +197,19 @@ class Client * * @param string $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse|object + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * @throws \Exception */ public function commandDelete(string $request) { - return $this->submitRequest( + $response = $this->client->makeRequest( sprintf("/my/commands/%s", $request), - HttpClient::METHOD_DELETE, - null, - static::getResponseClass(self::ERROR_ONLY_RESPONSE) + HttpClient::METHOD_DELETE ); + + $adapter = new ModelAdapter(ErrorOnlyResponse::class); + + return $adapter->getResponseModel($response); } /** @@ -290,18 +217,20 @@ class Client * * @param Model\Request\CustomersRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object + * @return array * @throws \Exception */ - public function customers(Model\Request\CustomersRequest $request) + public function customers(Model\Request\CustomersRequest $request): array { - return $this->submitRequest( + $response = $this->client->makeRequest( '/customers', HttpClient::METHOD_GET, - $request, - static::getEntityClass('Customer'), - true + $request ); + + $adapter = new ModelAdapter(Customer::class); + + return $adapter->getResponseList($response); } /** @@ -309,18 +238,20 @@ class Client * * @param Model\Request\DialogsRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object + * @return array * @throws \Exception */ - public function dialogs(Model\Request\DialogsRequest $request) + public function dialogs(Model\Request\DialogsRequest $request): array { - return $this->submitRequest( + $response = $this->client->makeRequest( '/dialogs', HttpClient::METHOD_GET, - $request, - static::getEntityClass('Dialog'), - true + $request ); + + $adapter = new ModelAdapter(Dialog::class); + + return $adapter->getResponseList($response); } /** @@ -328,17 +259,20 @@ class Client * * @param Model\Request\DialogAssignRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\AssignResponse|object + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * @throws \Exception */ public function dialogAssign(Model\Request\DialogAssignRequest $request) { - return $this->submitRequest( + $response = $this->client->makeRequest( sprintf("/dialogs/%d/assign", $request->getDialogId()), HttpClient::METHOD_PATCH, - $request, - static::getResponseClass('AssignResponse') + $request ); + + $adapter = new ModelAdapter(ErrorOnlyResponse::class); + + return $adapter->getResponseModel($response); } /** @@ -346,17 +280,20 @@ class Client * * @param string $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse|object + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * @throws \Exception */ public function dialogClose(string $request) { - return $this->submitRequest( + $response = $this->client->makeRequest( sprintf("/dialogs/%d/close", $request), HttpClient::METHOD_DELETE, - null, - static::getResponseClass(self::ERROR_ONLY_RESPONSE) + null ); + + $adapter = new ModelAdapter(ErrorOnlyResponse::class); + + return $adapter->getResponseModel($response); } /** @@ -364,18 +301,20 @@ class Client * * @param Model\Request\MembersRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object + * @return array * @throws \Exception */ - public function members(Model\Request\MembersRequest $request) + public function members(Model\Request\MembersRequest $request): array { - return $this->submitRequest( + $response = $this->client->makeRequest( '/members', HttpClient::METHOD_GET, - $request, - static::getEntityClass('Chat', 'ChatMember'), - true + $request ); + + $adapter = new ModelAdapter(ChatMember::class); + + return $adapter->getResponseList($response); } /** @@ -383,18 +322,20 @@ class Client * * @param Model\Request\MessagesRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object + * @return array * @throws \Exception */ - public function messages(Model\Request\MessagesRequest $request) + public function messages(Model\Request\MessagesRequest $request): array { - return $this->submitRequest( + $response = $this->client->makeRequest( '/messages', HttpClient::METHOD_GET, - $request, - self::getEntityClass('Message', 'Message'), - true + $request ); + + $adapter = new ModelAdapter(Message::class); + + return $adapter->getResponseList($response); } /** @@ -402,17 +343,20 @@ class Client * * @param Model\Request\MessageSendRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\MessageSendResponse|object + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * @throws \Exception */ public function messageSend(Model\Request\MessageSendRequest $request) { - return $this->submitRequest( + $response = $this->client->makeRequest( '/messages', HttpClient::METHOD_POST, - $request, - static::getResponseClass('MessageSendResponse') + $request ); + + $adapter = new ModelAdapter(MessageSendResponse::class); + + return $adapter->getResponseModel($response); } /** @@ -420,17 +364,20 @@ class Client * * @param Model\Request\MessageEditRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\MessageSendResponse|object + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * @throws \Exception */ public function messageEdit(Model\Request\MessageEditRequest $request) { - return $this->submitRequest( + $response = $this->client->makeRequest( sprintf("/messages/%d", $request->getId()), HttpClient::METHOD_PATCH, - $request, - static::getResponseClass('MessageSendResponse') + $request ); + + $adapter = new ModelAdapter(MessageSendResponse::class); + + return $adapter->getResponseModel($response); } /** @@ -438,17 +385,20 @@ class Client * * @param string $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse|object + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * @throws \Exception */ public function messageDelete(string $request) { - return $this->submitRequest( + $response = $this->client->makeRequest( sprintf("/messages/%d", $request), HttpClient::METHOD_DELETE, - null, - static::getResponseClass(self::ERROR_ONLY_RESPONSE) + null ); + + $adapter = new ModelAdapter(ErrorOnlyResponse::class); + + return $adapter->getResponseModel($response); } /** @@ -456,18 +406,20 @@ class Client * * @param Model\Request\UsersRequest $request Request parameters * - * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object + * @return array * @throws \Exception */ - public function users(Model\Request\UsersRequest $request) + public function users(Model\Request\UsersRequest $request): array { - return $this->submitRequest( + $response = $this->client->makeRequest( '/users', HttpClient::METHOD_GET, - $request, - self::getEntityClass('User'), - true + $request ); + + $adapter = new ModelAdapter(User::class); + + return $adapter->getResponseList($response); } /** @@ -475,7 +427,7 @@ class Client * * @param string $url File URL * - * @return \RetailCrm\Mg\Bot\Model\Response\UploadFileResponse|object + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * @throws \Exception */ public function uploadFileByUrl(string $url) @@ -483,51 +435,54 @@ class Client $request = new UploadFileByUrlRequest(); $request->setUrl($url); - return $this->submitRequest( + $response = $this->client->makeRequest( '/files/upload_by_url', HttpClient::METHOD_POST, - $request, - self::getResponseClass('UploadFileResponse') + $request ); + + $adapter = new ModelAdapter(UploadFileResponse::class); + + return $adapter->getResponseModel($response); } /** * @param string $filename - * @return Model\Response\UploadFileResponse|null + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * * @throws \Exception */ public function uploadFile(string $filename) { + $obj = new ErrorOnlyResponse(); $response = $this->client->postFile($filename); if ($response instanceof ResponseInterface) { $obj = Serializer::deserialize( (string) $response->getBody(), - self::getResponseClass('UploadFileResponse') + UploadFileResponse::class ); - - return $obj instanceof UploadFileResponse ? $obj : null; } - return null; + return $obj; } /** * @param string $fileId - * @return Model\Response\FullFileResponse|null + * @return \RetailCrm\Mg\Bot\Model\ModelInterface * * @throws \Exception */ public function getFileById(string $fileId) { - $obj = $this->submitRequest( - \sprintf('/files/%s', $fileId), + $response = $this->client->makeRequest( + sprintf('/files/%s', $fileId), HttpClient::METHOD_GET, - null, - self::getResponseClass('FullFileResponse') + null ); - return ($obj instanceof FullFileResponse) ? $obj : null; + $adapter = new ModelAdapter(FullFileResponse::class); + + return $adapter->getResponseModel($response); } } diff --git a/src/Bot/HttpClient.php b/src/Bot/HttpClient.php index 83fd8e3..5cf2c47 100644 --- a/src/Bot/HttpClient.php +++ b/src/Bot/HttpClient.php @@ -1,7 +1,7 @@ @@ -107,7 +112,7 @@ class HttpClient * @param string $method Request method (default: 'GET') * @param mixed $request Request model (default: null) * - * @return ResponseInterface + * @return \RetailCrm\Mg\Bot\Model\Response * @throws \Exception */ public function makeRequest($path, $method, $request = null) @@ -121,20 +126,20 @@ class HttpClient } if ($method == self::METHOD_GET && !is_null($request)) { - $getParameters = Url::buildGetParameters(Serializer::serialize($request, Serializer::S_ARRAY)); + $getParameters = Url::buildGetParameters((array)Serializer::serialize($request, Serializer::S_ARRAY)); } - $requestBody = is_null($request) ? null : Serializer::serialize($request, Serializer::S_JSON); + $requestBody = is_null($request) ? '' : Serializer::serialize($request, Serializer::S_JSON); $request = new Request( $method, - \sprintf("%s%s%s", $this->basePath, $path, $getParameters), + sprintf("%s%s%s", $this->basePath, $path, $getParameters), [ 'Content-Type' => 'application/json', 'X-Bot-Token' => $this->token ] ); - if (in_array($method, [self::METHOD_POST, self::METHOD_PUT, self::METHOD_PATCH, self::METHOD_DELETE])) { + if (in_array($method, [self::METHOD_POST, self::METHOD_PUT, self::METHOD_PATCH, self::METHOD_DELETE]) && is_string($requestBody)) { $request = $request->withBody(stream_for($requestBody)); } @@ -151,27 +156,14 @@ class HttpClient ] ); } catch (GuzzleException $exception) { - throw new \Exception($exception->getMessage(), $exception->getCode(), $exception); + throw new Exception($exception->getMessage(), $exception->getCode(), $exception); } - $statusCode = $responseObject->getStatusCode(); - $response = self::parseJSON((string) $responseObject->getBody()); - $errorMessage = !empty($response['errorMsg']) ? $response['errorMsg'] : ''; - $errorMessage = !empty($response['errors']) ? $this->getErrors($response['errors']) : $errorMessage; + $this->validateResponse($responseObject); - /** - * responses with 400 & 460 http codes contains extended error data - * therefore they are not handled as exceptions - */ - if (in_array($statusCode, [403, 404, 500])) { - throw new \InvalidArgumentException($errorMessage); - } + $adapter = new ResponseAdapter($responseObject); - if ($statusCode == 503) { - throw new LimitException($errorMessage); - } - - return $responseObject; + return $adapter->build(); } /** @@ -183,17 +175,17 @@ class HttpClient public function postFile(string $filename) { if (!file_exists($filename)) { - throw new \InvalidArgumentException("File doesn't exist"); + throw new InvalidArgumentException("File doesn't exist"); } if (filesize($filename) == 0) { - throw new \InvalidArgumentException("Empty file provided"); + throw new InvalidArgumentException("Empty file provided"); } try { $responseData = $this->client->request( self::METHOD_POST, - \sprintf("%s/files/upload", $this->basePath), + sprintf("%s/files/upload", $this->basePath), [ 'headers' => [ 'X-Bot-Token' => $this->token @@ -202,7 +194,7 @@ class HttpClient ] ); } catch (GuzzleException $exception) { - throw new \Exception($exception->getMessage(), $exception->getCode(), $exception); + throw new Exception($exception->getMessage(), $exception->getCode(), $exception); } return isset($responseData) ? $responseData : null; @@ -235,19 +227,62 @@ class HttpClient */ private function validateRequest($class) { - if (!is_string($class) && method_exists($class, 'validate')) { - $errors = $class->validate(); - } else { - $validator = Validation::createValidatorBuilder() - ->enableAnnotationMapping() - ->getValidator(); + $validator = Validation::createValidatorBuilder() + ->enableAnnotationMapping() + ->getValidator(); - $errors = $validator->validate($class); + $errors = $validator->validate($class); + + if ($errors->count() > 0) { + $message = ''; + + foreach ($errors as $error) { + $message .= (string)$error; + } + + throw new InvalidArgumentException($message); + } + } + + /** + * @param \Psr\Http\Message\ResponseInterface $responseObject + * + * @throws \ErrorException + */ + private function validateResponse(ResponseInterface $responseObject) + { + $statusCode = $responseObject->getStatusCode(); + $response = self::parseJSON((string)$responseObject->getBody()); + + $errorMessage = !empty($response['errorMsg']) ? $response['errorMsg'] : ''; + $errorMessage = !empty($response['errors']) ? $this->getErrors($response['errors']) : $errorMessage; + + /** + * responses with 400 & 460 http codes contains extended error data + * therefore they are not handled as exceptions + */ + if ($statusCode == 400) { + throw new RuntimeException($errorMessage); } - if ((is_object($errors) && call_user_func([$errors, 'count']) > 0) || is_string($errors)) { - $message = (string) $errors; - throw new InvalidArgumentException($message); + if (in_array($statusCode, [401, 403])) { + throw new UnauthorizedException($errorMessage); + } + + if ($statusCode == 404) { + throw new NotFoundException($errorMessage); + } + + if (in_array($statusCode, [405, 501])) { + throw new BadMethodCallException($errorMessage); + } + + if (in_array($statusCode, [500, 502])) { + throw new ErrorException($errorMessage); + } + + if ($statusCode == 503) { + throw new LimitException($errorMessage); } } diff --git a/src/Bot/Model/Constants.php b/src/Bot/Model/Constants.php index 7571533..281e0b8 100644 --- a/src/Bot/Model/Constants.php +++ b/src/Bot/Model/Constants.php @@ -1,7 +1,7 @@ - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers + * @package RetailCrm\Mg\Bot\Model\Entity\Channel + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers */ namespace RetailCrm\Mg\Bot\Model\Entity\Channel; -use JMS\Serializer\Annotation\SkipWhenEmpty; +use DateTime; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; /** - * PHP version 7.0 + * Class Channel * - * Channel class - * - * @package RetailCrm\Mg\Bot\Model\Entity\Channel - * @author retailCRM - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers + * @package RetailCrm\Mg\Bot\Model\Entity\Channel + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers */ -class Channel +class Channel implements ModelInterface { /** * @var string $id @@ -120,7 +119,7 @@ class Channel /** * @return \DateTime */ - public function getCreatedAt(): \DateTime + public function getCreatedAt(): DateTime { return $this->createdAt; } @@ -128,7 +127,7 @@ class Channel /** * @param \DateTime $createdAt */ - public function setCreatedAt(\DateTime $createdAt) + public function setCreatedAt(DateTime $createdAt) { $this->createdAt = $createdAt; } @@ -136,7 +135,7 @@ class Channel /** * @return \DateTime */ - public function getUpdatedAt(): \DateTime + public function getUpdatedAt(): DateTime { return $this->updatedAt; } @@ -144,7 +143,7 @@ class Channel /** * @param \DateTime $updatedAt */ - public function setUpdatedAt(\DateTime $updatedAt) + public function setUpdatedAt(DateTime $updatedAt) { $this->updatedAt = $updatedAt; } @@ -152,7 +151,7 @@ class Channel /** * @return \DateTime */ - public function getActivatedAt(): \DateTime + public function getActivatedAt(): DateTime { return $this->activatedAt; } @@ -160,7 +159,7 @@ class Channel /** * @param \DateTime $activatedAt */ - public function setActivatedAt(\DateTime $activatedAt) + public function setActivatedAt(DateTime $activatedAt) { $this->activatedAt = $activatedAt; } @@ -168,7 +167,7 @@ class Channel /** * @return \DateTime */ - public function getDeactivatedAt(): \DateTime + public function getDeactivatedAt(): DateTime { return $this->deactivatedAt; } @@ -176,7 +175,7 @@ class Channel /** * @param \DateTime $deactivatedAt */ - public function setDeactivatedAt(\DateTime $deactivatedAt) + public function setDeactivatedAt(DateTime $deactivatedAt) { $this->deactivatedAt = $deactivatedAt; } diff --git a/src/Bot/Model/Entity/Channel/ChannelSettings.php b/src/Bot/Model/Entity/Channel/ChannelSettings.php index 591fe17..306824c 100644 --- a/src/Bot/Model/Entity/Channel/ChannelSettings.php +++ b/src/Bot/Model/Entity/Channel/ChannelSettings.php @@ -1,7 +1,7 @@ * @license https://opensource.org/licenses/MIT MIT License * @link http://help.retailcrm.pro/docs/Developers */ -class ChannelSettings +class ChannelSettings implements ModelInterface { /** * @var ChannelSettingsStatus $status diff --git a/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php b/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php index 7176c04..2581ec7 100644 --- a/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php +++ b/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php @@ -1,7 +1,7 @@ + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Entity; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\SkipWhenEmpty; +use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; + +/** + * Cost class + * + * @package RetailCrm\Mg\Bot\Model\Entity + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class Cost implements ModelInterface +{ + /** + * @var float $value + * + * @Type("float") + * @Accessor(getter="getValue",setter="setValue") + * @SkipWhenEmpty() + */ + private $value; + + /** + * @var string $currency + * + * @Type("string") + * @Accessor(getter="getCurrency",setter="setCurrency") + * + * @Assert\Currency + */ + private $currency; + + /** + * @return float + */ + public function getValue() + { + return $this->value; + } + + /** + * @param float $value + */ + public function setValue(float $value) + { + $this->value = $value; + } + + /** + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * @param string $currency + */ + public function setCurrency(string $currency) + { + $this->currency = $currency; + } +} diff --git a/src/Bot/Model/Entity/Customer.php b/src/Bot/Model/Entity/Customer.php index 66d72bb..9151a06 100644 --- a/src/Bot/Model/Entity/Customer.php +++ b/src/Bot/Model/Entity/Customer.php @@ -1,7 +1,7 @@ * @license https://opensource.org/licenses/MIT MIT License * @link http://help.retailcrm.pro/docs/Developers */ -class Customer +class Customer implements ModelInterface { /** * @var string $id diff --git a/src/Bot/Model/Entity/Delivery.php b/src/Bot/Model/Entity/Delivery.php new file mode 100644 index 0000000..75474d3 --- /dev/null +++ b/src/Bot/Model/Entity/Delivery.php @@ -0,0 +1,132 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Entity; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\SkipWhenEmpty; +use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; + +/** + * Delivery class + * + * @package RetailCrm\Mg\Bot\Model\Entity + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class Delivery implements ModelInterface +{ + /** + * @var string $name + * + * @Type("string") + * @Accessor(getter="getName",setter="setName") + * + * @Assert\NotBlank + */ + private $name; + + /** + * @var Cost $price + * + * @Type("Cost") + * @Accessor(getter="getPrice",setter="setPrice") + * + * @Assert\Currency + */ + private $price; + + /** + * @var string $address + * + * @Type("string") + * @Accessor(getter="getAddress",setter="setAddress") + * @SkipWhenEmpty() + */ + private $address; + + /** + * @var string $comment + * + * @Type("string") + * @Accessor(getter="getComment",setter="setComment") + * @SkipWhenEmpty() + */ + private $comment; + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + */ + public function setName(string $name) + { + $this->name = $name; + } + + /** + * @return Cost + */ + public function getPrice() + { + return $this->price; + } + + /** + * @param Cost $price + */ + public function setPrice(Cost $price) + { + $this->price = $price; + } + + /** + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * @param string $address + */ + public function setAddress(string $address) + { + $this->address = $address; + } + + /** + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * @param string $comment + */ + public function setComment(string $comment) + { + $this->comment = $comment; + } +} diff --git a/src/Bot/Model/Entity/Dialog.php b/src/Bot/Model/Entity/Dialog.php index b155404..679e518 100644 --- a/src/Bot/Model/Entity/Dialog.php +++ b/src/Bot/Model/Entity/Dialog.php @@ -1,7 +1,7 @@ + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Entity; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\SkipWhenEmpty; +use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; + +/** + * Item class + * + * @package RetailCrm\Mg\Bot\Model\Entity + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class Item implements ModelInterface +{ + /** + * @var string $id + * + * @Type("string") + * @Accessor(getter="getId",setter="setId") + * @SkipWhenEmpty() + */ + private $id; + + /** + * @var string $caption + * + * @Type("string") + * @Accessor(getter="getCaption",setter="setCaption") + * @SkipWhenEmpty() + */ + private $caption; + + /** + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id) + { + $this->id = $id; + } + + /** + * @return string + */ + public function getCaption() + { + return $this->caption; + } + + /** + * @param string $caption + */ + public function setCaption(string $caption) + { + $this->caption = $caption; + } +} diff --git a/src/Bot/Model/Entity/Message/Item.php b/src/Bot/Model/Entity/Message/Item.php index 65fc1cb..1859410 100644 --- a/src/Bot/Model/Entity/Message/Item.php +++ b/src/Bot/Model/Entity/Message/Item.php @@ -1,7 +1,7 @@ @@ -27,7 +26,7 @@ use JMS\Serializer\Annotation\Type; * * @see http://help.retailcrm.pro/docs/Developers */ -class MessageOrderItem +class MessageOrderItem implements ModelInterface { /** * @var string diff --git a/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php b/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php index 9316da6..2efcb4d 100644 --- a/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php +++ b/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php @@ -1,7 +1,7 @@ + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Entity; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\SkipWhenEmpty; +use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; + +/** + * Order class + * + * @package RetailCrm\Mg\Bot\Model\Entity + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class Order implements ModelInterface +{ + /** + * @var string $number + * + * @Type("string") + * @Accessor(getter="getNumber",setter="setNumber") + * @SkipWhenEmpty() + */ + private $number; + + /** + * @var string $url + * + * @Type("string") + * @Accessor(getter="getUrl",setter="setUrl") + * @SkipWhenEmpty() + */ + private $url; + + /** + * @var string $date + * + * @Type("string") + * @Accessor(getter="getDate",setter="setDate") + * @SkipWhenEmpty() + */ + private $date; + + /** + * @var Cost $cost + * + * @Type("Cost") + * @Accessor(getter="getCost",setter="setCost") + * @SkipWhenEmpty() + */ + private $cost; + + /** + * @var Status $status + * + * @Type("Status") + * @Accessor(getter="getStatus",setter="setStatus") + * @SkipWhenEmpty() + */ + private $status; + + /** + * @var Delivery $delivery + * + * @Type("Delivery") + * @Accessor(getter="getDelivery",setter="setDelivery") + * @SkipWhenEmpty() + */ + private $delivery; + + /** + * @var array $items + * + * @Type("array") + * @Accessor(getter="getItems",setter="setItems") + * @SkipWhenEmpty() + */ + private $items; + + /** + * @var array $payments + * + * @Type("array") + * @Accessor(getter="getPayments",setter="setPayments") + * @SkipWhenEmpty() + */ + private $payments; + + /** + * @return string + */ + public function getNumber() + { + return $this->number; + } + + /** + * @param string $number + */ + public function setNumber(string $number) + { + $this->number = $number; + } + + /** + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * @param string $url + */ + public function setUrl(string $url) + { + $this->url = $url; + } + + /** + * @return string + */ + public function getDate() + { + return $this->date; + } + + /** + * @param string $date + */ + public function setDate(string $date) + { + $this->date = $date; + } + + /** + * @return Cost + */ + public function getCost() + { + return $this->cost; + } + + /** + * @param Cost $cost + */ + public function setCost(Cost $cost) + { + $this->cost = $cost; + } + + /** + * @return Status + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param Status $status + */ + public function setStatus(Status $status) + { + $this->status = $status; + } + + /** + * @return Delivery + */ + public function getDelivery() + { + return $this->delivery; + } + + /** + * @param Delivery $delivery + */ + public function setDelivery(Delivery $delivery) + { + $this->delivery = $delivery; + } + + /** + * @return array + */ + public function getItems() + { + return $this->items; + } + + /** + * @param array $items + */ + public function setItems(array $items) + { + $this->items = $items; + } + + /** + * @return array + */ + public function getPayments() + { + return $this->payments; + } + + /** + * @param array $payments + */ + public function setPayments(array $payments) + { + $this->payments = $payments; + } +} diff --git a/src/Bot/Model/Entity/OrderItem.php b/src/Bot/Model/Entity/OrderItem.php new file mode 100644 index 0000000..2729070 --- /dev/null +++ b/src/Bot/Model/Entity/OrderItem.php @@ -0,0 +1,155 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Entity; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\SkipWhenEmpty; +use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; + +/** + * OrderItem class + * + * @package RetailCrm\Mg\Bot\Model\Entity + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class OrderItem implements ModelInterface +{ + /** + * @var string $name + * + * @Type("string") + * @Accessor(getter="getName",setter="setName") + * @SkipWhenEmpty() + */ + private $name; + + /** + * @var string $url + * + * @Type("string") + * @Accessor(getter="getUrl",setter="setUrl") + * @SkipWhenEmpty() + */ + private $url; + + /** + * @var string $img + * + * @Type("string") + * @Accessor(getter="getImg",setter="setImg") + * @SkipWhenEmpty() + */ + private $img; + + /** + * @var Cost $price + * + * @Type("Cost") + * @Accessor(getter="getPrice",setter="setPrice") + * @SkipWhenEmpty() + */ + private $price; + + /** + * @var Quantity $quantity + * + * @Type("Quantity") + * @Accessor(getter="getQuantity",setter="setQuantity) + * @SkipWhenEmpty() + */ + private $quantity; + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + */ + public function setName(string $name) + { + $this->name = $name; + } + + /** + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * @param string $url + */ + public function setUrl(string $url) + { + $this->url = $url; + } + + /** + * @return string + */ + public function getImg() + { + return $this->img; + } + + /** + * @param string $img + */ + public function setImg(string $img) + { + $this->img = $img; + } + + /** + * @return Cost + */ + public function getPrice() + { + return $this->price; + } + + /** + * @param Cost $price + */ + public function setPrice(Cost $price) + { + $this->price = $price; + } + + /** + * @return Quantity + */ + public function getQuantity() + { + return $this->quantity; + } + + /** + * @param Quantity $quantity + */ + public function setQuantity(Quantity $quantity) + { + $this->quantity = $quantity; + } +} diff --git a/src/Bot/Model/Entity/Payment.php b/src/Bot/Model/Entity/Payment.php new file mode 100644 index 0000000..fa89da3 --- /dev/null +++ b/src/Bot/Model/Entity/Payment.php @@ -0,0 +1,105 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Entity; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\SkipWhenEmpty; +use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; + +/** + * Payment class + * + * @package RetailCrm\Mg\Bot\Model\Entity + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class Payment implements ModelInterface +{ + /** + * @var string $name + * + * @Type("string") + * @Accessor(getter="getName",setter="setName") + * @SkipWhenEmpty() + */ + private $name; + + /** + * @var PaymentStatus $status + * + * @Type("PaymentStatus") + * @Accessor(getter="getStatus",setter="setStatus") + * @SkipWhenEmpty() + */ + private $status; + + /** + * @var Cost $amount + * + * @Type("Cost") + * @Accessor(getter="getAmount",setter="setAmount") + * @SkipWhenEmpty() + */ + private $amount; + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + */ + public function setName(string $name) + { + $this->name = $name; + } + + /** + * @return PaymentStatus + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param PaymentStatus $status + */ + public function setStatus(PaymentStatus $status) + { + $this->status = $status; + } + + /** + * @return Cost + */ + public function getAmount() + { + return $this->amount; + } + + /** + * @param Cost $amount + */ + public function setAmount(Cost $amount) + { + $this->amount = $amount; + } +} diff --git a/src/Bot/Model/Entity/PaymentStatus.php b/src/Bot/Model/Entity/PaymentStatus.php new file mode 100644 index 0000000..7bf487f --- /dev/null +++ b/src/Bot/Model/Entity/PaymentStatus.php @@ -0,0 +1,80 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Entity; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\SkipWhenEmpty; +use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; + +/** + * PaymentStatus class + * + * @package RetailCrm\Mg\Bot\Model\Entity + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class PaymentStatus implements ModelInterface +{ + /** + * @var string $name + * + * @Type("string") + * @Accessor(getter="getName",setter="setName") + * @SkipWhenEmpty() + */ + private $name; + + /** + * @var bool $payed + * + * @Type("bool") + * @Accessor(getter="getPayed",setter="setPayed") + * @SkipWhenEmpty() + */ + private $payed; + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + */ + public function setName(string $name) + { + $this->name = $name; + } + + /** + * @return bool + */ + public function isPayed() + { + return $this->payed; + } + + /** + * @param bool $payed + */ + public function setPayed(bool $payed) + { + $this->payed = $payed; + } +} diff --git a/src/Bot/Model/Entity/Product.php b/src/Bot/Model/Entity/Product.php new file mode 100644 index 0000000..606bbbf --- /dev/null +++ b/src/Bot/Model/Entity/Product.php @@ -0,0 +1,205 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Entity; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\SkipWhenEmpty; +use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; + +/** + * Product class + * + * @package RetailCrm\Mg\Bot\Model\Entity + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class Product implements ModelInterface +{ + /** + * @var int $id + * + * @Type("int") + * @Accessor(getter="getId",setter="setId") + * @SkipWhenEmpty() + */ + private $id; + + /** + * @var string $name + * + * @Type("string") + * @Accessor(getter="getName",setter="setName") + * @SkipWhenEmpty() + */ + private $name; + + /** + * @var string $article + * + * @Type("string") + * @Accessor(getter="getArticle",setter="setArticle") + * @SkipWhenEmpty() + */ + private $article; + + /** + * @var string $url + * + * @Type("string") + * @Accessor(getter="getUrl",setter="setUrl") + * @SkipWhenEmpty() + */ + private $url; + + /** + * @var string $img + * + * @Type("string") + * @Accessor(getter="getImg",setter="setImg") + * @SkipWhenEmpty() + */ + private $img; + + /** + * @var Cost $cost + * + * @Type("Cost") + * @Accessor(getter="getCost",setter="setCost") + * @SkipWhenEmpty() + */ + private $cost; + + /** + * @var Quantity $quantity + * + * @Type("Quantity") + * @Accessor(getter="getQuantity",setter="setQuantity) + * @SkipWhenEmpty() + */ + private $quantity; + + /** + * @return int + */ + public function getId(): int + { + return $this->id; + } + + /** + * @param int $id + */ + public function setId(int $id) + { + $this->id = $id; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + */ + public function setName(string $name) + { + $this->name = $name; + } + + /** + * @return string + */ + public function getArticle() + { + return $this->article; + } + + /** + * @param string $article + */ + public function setArticle(string $article) + { + $this->article = $article; + } + + /** + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * @param string $url + */ + public function setUrl(string $url) + { + $this->url = $url; + } + + /** + * @return string + */ + public function getImg() + { + return $this->img; + } + + /** + * @param string $img + */ + public function setImg(string $img) + { + $this->img = $img; + } + + /** + * @return Cost + */ + public function getCost() + { + return $this->cost; + } + + /** + * @param Cost $cost + */ + public function setCost(Cost $cost) + { + $this->cost = $cost; + } + + /** + * @return Quantity + */ + public function getQuantity() + { + return $this->quantity; + } + + /** + * @param Quantity $quantity + */ + public function setQuantity(Quantity $quantity) + { + $this->quantity = $quantity; + } +} diff --git a/src/Bot/Model/Entity/Quantity.php b/src/Bot/Model/Entity/Quantity.php new file mode 100644 index 0000000..09fdedd --- /dev/null +++ b/src/Bot/Model/Entity/Quantity.php @@ -0,0 +1,81 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Entity; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\SkipWhenEmpty; +use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; + +/** + * Quantity class + * + * @package RetailCrm\Mg\Bot\Model\Entity + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class Quantity implements ModelInterface +{ + /** + * @var float $value + * + * @Type("float") + * @Accessor(getter="getValue",setter="setValue") + * @SkipWhenEmpty() + */ + private $value; + + /** + * @var string $unit + * + * @Type("string") + * @Accessor(getter="getUnit",setter="setUnit") + * + * @Assert\Currency + */ + private $unit; + + /** + * @return float + */ + public function getValue() + { + return $this->value; + } + + /** + * @param float $value + */ + public function setValue(float $value) + { + $this->value = $value; + } + + /** + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * @param string $unit + */ + public function setUnit(string $unit) + { + $this->unit = $unit; + } +} diff --git a/src/Bot/Model/Entity/Responsible.php b/src/Bot/Model/Entity/Responsible.php index c39a189..4069368 100644 --- a/src/Bot/Model/Entity/Responsible.php +++ b/src/Bot/Model/Entity/Responsible.php @@ -1,7 +1,7 @@ + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Entity; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\SkipWhenEmpty; +use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\ModelInterface; + +/** + * Status class + * + * @package RetailCrm\Mg\Bot\Model\Entity + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class Status implements ModelInterface +{ + /** + * @var string $code + * + * @Type("string") + * @Accessor(getter="getCode",setter="setCode") + * @SkipWhenEmpty() + */ + private $code; + + /** + * @var string $name + * + * @Type("string") + * @Accessor(getter="getName",setter="setName") + * @SkipWhenEmpty() + */ + private $name; + + /** + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * @param string $code + */ + public function setCode(string $code) + { + $this->code = $code; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + */ + public function setName(string $name) + { + $this->name = $name; + } +} diff --git a/src/Bot/Model/Entity/User.php b/src/Bot/Model/Entity/User.php index af8809c..f80d8ba 100644 --- a/src/Bot/Model/Entity/User.php +++ b/src/Bot/Model/Entity/User.php @@ -1,7 +1,7 @@ + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model; + + +interface ModelInterface +{ +} diff --git a/src/Bot/Model/Request/BotsRequest.php b/src/Bot/Model/Request/BotsRequest.php index 6625f1a..9a85f2c 100644 --- a/src/Bot/Model/Request/BotsRequest.php +++ b/src/Bot/Model/Request/BotsRequest.php @@ -1,7 +1,7 @@ + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model; + +/** + * Class Response + * + * @package RetailCrm\Mg\Bot\Model + */ +class Response +{ + private $status; + + private $body; + + /** + * @return mixed + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param mixed $status + */ + public function setStatus($status) + { + $this->status = $status; + } + + /** + * @return mixed + */ + public function getBody() + { + return $this->body; + } + + /** + * @param mixed $body + */ + public function setBody($body) + { + $this->body = $body; + } +} diff --git a/src/Bot/Model/Response/AssignResponse.php b/src/Bot/Model/Response/AssignResponse.php index 73ac86f..ebaa040 100644 --- a/src/Bot/Model/Response/AssignResponse.php +++ b/src/Bot/Model/Response/AssignResponse.php @@ -1,7 +1,7 @@ errors) ? [] : $this->errors; + return empty($this->errors) ? [] : $this->errors; } /** diff --git a/src/Bot/Model/Response/ErrorOnlyResponse.php b/src/Bot/Model/Response/ErrorOnlyResponse.php index dfe5a38..da6f6da 100644 --- a/src/Bot/Model/Response/ErrorOnlyResponse.php +++ b/src/Bot/Model/Response/ErrorOnlyResponse.php @@ -1,7 +1,7 @@ - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers - */ - -namespace RetailCrm\Mg\Bot\Model\Response; - -use RetailCrm\Common\Serializer; - -/** - * PHP version 7.0 - * - * ListResponse class. Used to store multiple objects at once. - * Implements `Iterator`, `ArrayAccess` and `Countable`. - * - * @package RetailCrm\Mg\Bot\Model\Response - * @author retailCRM - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers - */ -class ListResponse implements \Iterator, \ArrayAccess, \Countable -{ - use CommonFields; - - /** - * @var array - */ - private $items = []; - - /** - * @var int - */ - private $position = 0; - - /** - * ListResponse constructor. - * - * @param string $responseType - * @param array $data - * @param int $statusCode - */ - public function __construct($responseType, $data, $statusCode) - { - $this->setStatusCode($statusCode); - - if (isset($data['errors'])) { - $this->setErrors($data['errors']); - } else { - foreach ($data as $item) { - $this->items[] = - Serializer::deserialize($item, $responseType, Serializer::S_ARRAY); - } - } - } - - /** - * @return bool - */ - public function isSuccessful() - { - return empty($this->errors); - } - - /** - * \Countable implementation - * - * @return int - */ - public function count(): int - { - return count($this->items ?: []); - } - - /** - * Set offset - * - * @param mixed $offset offset value - * @param mixed $value value - * - * @return void - * @internal - */ - public function offsetSet($offset, $value) - { - throw new \BadMethodCallException( - "This call not allowed: offsetSet [$offset] [$value]" - ); - } - - /** - * Unset offset - * - * @param mixed $offset offset value - * - * @return void - * @internal - */ - public function offsetUnset($offset) - { - throw new \BadMethodCallException( - "This call not allowed: offsetSet [$offset]" - ); - } - /** - * Check offset - * - * @param mixed $offset offset value - * - * @return bool - * @internal - */ - public function offsetExists($offset) - { - return isset($this->items[$offset]); - } - /** - * Get offset - * - * @param mixed $offset offset value - * - * @return mixed - * @internal - */ - public function offsetGet($offset) - { - if (!isset($this->items[$offset])) { - throw new \InvalidArgumentException("Item \"$offset\" not found"); - } - - return $this->items[$offset]; - } - - /** - * @param mixed $name - * - * @return mixed - * @internal - */ - public function __get($name) - { - return $this->items[$name]; - } - - /** - * Implements rewind() for Iterable - * @internal - */ - public function rewind() - { - $this->position = 0; - } - - /** - * Implements current() for Iterable - * - * @internal - * @return mixed - */ - public function current() - { - return $this->items[$this->position]; - } - - /** - * Implements key() for Iterable - * - * @internal - * @return int|mixed - */ - public function key() - { - return $this->position; - } - - /** - * Implements next() for Iterable - * @internal - */ - public function next() - { - ++$this->position; - } - - /** - * Implements valid() for Iterable - * - * @internal - * @return bool - */ - public function valid() - { - return isset($this->items[$this->position]); - } -} diff --git a/src/Bot/Model/Response/MessageSendResponse.php b/src/Bot/Model/Response/MessageSendResponse.php index ea8c5e0..2e361db 100644 --- a/src/Bot/Model/Response/MessageSendResponse.php +++ b/src/Bot/Model/Response/MessageSendResponse.php @@ -1,7 +1,7 @@ + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Common\Exception; + +use RuntimeException; +use Throwable; + +/** + * Class CurlException + * + * @package RetailCrm\Common\Exception + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class CurlException extends RuntimeException implements Throwable +{ +} diff --git a/src/Exception/InvalidJsonException.php b/src/Exception/InvalidJsonException.php index dc43f3f..8fdd34e 100644 --- a/src/Exception/InvalidJsonException.php +++ b/src/Exception/InvalidJsonException.php @@ -1,9 +1,9 @@ @@ -14,10 +14,9 @@ namespace RetailCrm\Common\Exception; use DomainException; +use Throwable; /** - * PHP version 7.0 - * * Class InvalidJsonException * * @package RetailCrm\Common\Exception @@ -25,6 +24,6 @@ use DomainException; * @license https://opensource.org/licenses/MIT MIT License * @link http://help.retailcrm.pro/docs/Developers */ -class InvalidJsonException extends DomainException +class InvalidJsonException extends DomainException implements Throwable { } diff --git a/src/Exception/LimitException.php b/src/Exception/LimitException.php index 9e65c70..1e8e8f5 100644 --- a/src/Exception/LimitException.php +++ b/src/Exception/LimitException.php @@ -1,9 +1,9 @@ @@ -14,10 +14,9 @@ namespace RetailCrm\Common\Exception; use DomainException; +use Throwable; /** - * PHP version 7.0 - * * Class LimitException * * @package RetailCrm\Common\Exception @@ -25,6 +24,6 @@ use DomainException; * @license https://opensource.org/licenses/MIT MIT License * @link http://help.retailcrm.pro/docs/Developers */ -class LimitException extends DomainException +class LimitException extends DomainException implements Throwable { } diff --git a/src/Exception/NotFoundException.php b/src/Exception/NotFoundException.php new file mode 100644 index 0000000..3d5edf0 --- /dev/null +++ b/src/Exception/NotFoundException.php @@ -0,0 +1,28 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Common\Exception; + +use DomainException; +use Throwable; + +/** + * Class NotFoundException + * + * @package RetailCrm\Common\Exception + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class NotFoundException extends DomainException implements Throwable +{ +} diff --git a/src/Exception/UnauthorizedException.php b/src/Exception/UnauthorizedException.php new file mode 100644 index 0000000..93c257c --- /dev/null +++ b/src/Exception/UnauthorizedException.php @@ -0,0 +1,20 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Common\Exception; + +use DomainException; +use Throwable; + +class UnauthorizedException extends DomainException implements Throwable +{ +} diff --git a/src/Register.php b/src/Register.php index 27d36a1..cc2801f 100644 --- a/src/Register.php +++ b/src/Register.php @@ -1,9 +1,9 @@ @@ -19,9 +19,7 @@ use JMS\Serializer\Annotation\Type; use Symfony\Component\Validator\Constraints as Assert; /** - * PHP version 7.0 - * - * RequestHelper class + * Class Register * * @package RetailCrm\Common * @author retailCRM @@ -328,6 +326,7 @@ class Register * Get configuration as JSON * * @return array|string + * @todo make exact type */ public function getJsonConfiguration() { @@ -338,6 +337,7 @@ class Register * Get configuration as array * * @return array|string + * @todo make exact type */ public function getArrayConfiguration() { diff --git a/src/Serializer.php b/src/Serializer.php index 190fac3..bda71e7 100644 --- a/src/Serializer.php +++ b/src/Serializer.php @@ -1,14 +1,14 @@ - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers + * @package RetailCrm\Common + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers */ namespace RetailCrm\Common; @@ -16,16 +16,16 @@ namespace RetailCrm\Common; use JMS\Serializer\DeserializationContext; use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializerBuilder; +use RetailCrm\Mg\Bot\Model\ModelInterface; +use RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse; /** - * PHP version 7.0 + * Class Serializer * - * Serializer class - * - * @package RetailCrm\Common - * @author retailCRM - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers + * @package RetailCrm\Common + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers */ class Serializer { @@ -62,11 +62,11 @@ class Serializer /** * Deserialize given array or JSON to object * - * @param mixed $data + * @param mixed $data * @param string $entityType * @param string $from * - * @return object|null + * @return \RetailCrm\Mg\Bot\Model\ModelInterface */ public static function deserialize($data, $entityType, $from = self::S_JSON) { @@ -76,16 +76,16 @@ class Serializer switch ($from) { case self::S_ARRAY: - $deserialized = - $serializer->fromArray(array_filter($data), self::normalizeNamespace($entityType), $context); + $deserialized = $serializer + ->fromArray(array_filter($data), self::normalizeNamespace($entityType), $context); break; case self::S_JSON: - $deserialized = - $serializer->deserialize($data, self::normalizeNamespace($entityType), $from, $context); + $deserialized = $serializer + ->deserialize($data, self::normalizeNamespace($entityType), $from, $context); break; } - return is_object($deserialized) ? $deserialized : null; + return $deserialized instanceof ModelInterface ? $deserialized : new ErrorOnlyResponse(); } /** diff --git a/src/Url.php b/src/Url.php index 9b0aef3..a43824f 100644 --- a/src/Url.php +++ b/src/Url.php @@ -1,9 +1,9 @@ @@ -14,9 +14,7 @@ namespace RetailCrm\Common; /** - * PHP version 7.0 - * - * Url class + * Class Url * * @package RetailCrm\Common * @author retailCRM @@ -25,13 +23,6 @@ namespace RetailCrm\Common; */ class Url { - /** - * This class is used to store normalizeUrl method - * which is used in Client and HttpClient to check - * trailing slash. - */ - private function __construct() {} - /** * Check trailing slash into url * diff --git a/tests/Bot/Test/TestCase.php b/tests/Bot/Test/TestCase.php index 6722555..e30637c 100644 --- a/tests/Bot/Test/TestCase.php +++ b/tests/Bot/Test/TestCase.php @@ -1,7 +1,7 @@ * @license https://opensource.org/licenses/MIT MIT License @@ -33,10 +32,10 @@ class TestCase extends BaseCase /** * Return bot api client object * - * @param string $url (default: null) - * @param string $key (default: null) - * @param bool $debug (default: false) - * @param array $response (default: null) + * @param string $url (default: null) + * @param string $key (default: null) + * @param bool $debug (default: false) + * @param array ...$response (default: null) * * @return Client */ @@ -62,8 +61,8 @@ class TestCase extends BaseCase /** * Returns mocked GuzzleHttp response * - * @param string|null $body - * @param int $statusCode + * @param string|null $body HTTP Body + * @param int $statusCode HTTP status code * * @return Response */ @@ -93,8 +92,8 @@ class TestCase extends BaseCase * Only file name (without extension or any other data) should be provided, * e.g. `getJsonResponse('bots', 200)` * - * @param string $jsonFile - * @param int $statusCode + * @param string $jsonFile mocked body + * @param int $statusCode mocked status code * * @return Response|null */ @@ -120,8 +119,8 @@ class TestCase extends BaseCase } /** - * @param int $statusCode - * @param array ...$errors + * @param int $statusCode response code + * @param array ...$errors response errors * * @return Response */ @@ -139,7 +138,7 @@ class TestCase extends BaseCase /** * Generate and return empty response * - * @param int $statusCode + * @param int $statusCode HTTP status code * * @return Response|null */ diff --git a/tests/Bot/Tests/ClientListTest.php b/tests/Bot/Tests/ClientListTest.php index d2d6129..0d29d64 100644 --- a/tests/Bot/Tests/ClientListTest.php +++ b/tests/Bot/Tests/ClientListTest.php @@ -1,7 +1,7 @@ * @license https://opensource.org/licenses/MIT MIT License * @link http://help.retailcrm.pro/docs/Developers @@ -25,9 +26,9 @@ use RetailCrm\Mg\Bot\Test\TestCase; * Class DialogsTest * * @package RetailCrm\Mg\Bot\Tests - * @author retailCRM - * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers */ class DialogsTest extends TestCase {