From 004b27f62c08a340eb5efeee415352366a45cb9f Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 21 Jun 2019 16:42:04 +0300 Subject: [PATCH] File operations, code cleanup, tests --- .travis.yml | 2 +- Makefile | 5 +- composer.json | 2 +- composer.lock | 874 ++++++++++-------- src/Bot/Client.php | 98 +- src/Bot/HttpClient.php | 47 +- src/Bot/Model/Entity/Bot.php | 2 +- src/Bot/Model/Entity/Channel/Channel.php | 2 +- .../Model/Entity/Channel/ChannelSettings.php | 2 +- src/Bot/Model/Entity/CommonFields.php | 2 +- src/Bot/Model/Entity/Message/Item.php | 2 +- src/Bot/Model/Entity/Message/Message.php | 2 +- src/Bot/Model/Entity/Message/MessageCost.php | 2 +- .../Model/Entity/Message/MessageDelivery.php | 2 +- src/Bot/Model/Entity/Message/MessageOrder.php | 15 +- .../Model/Entity/Message/MessageOrderItem.php | 24 +- .../Message/MessageOrderPaymentStatus.php | 2 +- .../Model/Entity/Message/MessagePayment.php | 2 +- .../Model/Entity/Message/MessageProduct.php | 2 +- .../Model/Entity/Message/MessageQuantity.php | 2 +- .../Model/Entity/Message/MessageStatus.php | 2 +- src/Bot/Model/Request/CommonFields.php | 22 +- .../Model/Request/UploadFileByUrlRequest.php | 57 ++ src/Bot/Model/Response/ErrorOnlyResponse.php | 3 +- src/Serializer.php | 8 +- tests/Bot/Tests/ClientListTest.php | 2 - tests/Bot/Tests/FileTest.php | 113 +++ tests/Resources/getFile.json | 1 + 28 files changed, 844 insertions(+), 455 deletions(-) create mode 100644 src/Bot/Model/Request/UploadFileByUrlRequest.php create mode 100644 tests/Bot/Tests/FileTest.php create mode 100644 tests/Resources/getFile.json diff --git a/.travis.yml b/.travis.yml index 17a7351..28353ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,4 @@ before_script: - flags="-o" - composer install $flags -script: make test \ No newline at end of file +script: make travis \ No newline at end of file diff --git a/Makefile b/Makefile index 75c11c8..5862033 100644 --- a/Makefile +++ b/Makefile @@ -21,4 +21,7 @@ endif stan: @echo "==> Running analysis" @php $(BIN_DIR)/phpstan analyse -l 4 -c $(ROOT_DIR)/phpstan.neon $(SRC_DIR) - @echo "==> Analysis complete" \ No newline at end of file + @echo "==> Analysis complete" + +travis: test stan + @echo "==> Completed" \ No newline at end of file diff --git a/composer.json b/composer.json index 307408e..322426a 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "guzzlehttp/guzzle": "6.3.*" }, "require-dev": { - "phpunit/phpunit": "6.5.*", + "phpunit/phpunit": "7.4.*", "phpmd/phpmd": "2.6.*", "phpstan/phpstan": "0.9.*", "squizlabs/php_codesniffer": "3.4.*", diff --git a/composer.lock b/composer.lock index 00c2b6f..3c8ef68 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "881d5b814546ed880206e10657ac877b", + "content-hash": "6e487d13ef2738e0a6f027927b51b34e", "packages": [ { "name": "doctrine/annotations", @@ -207,21 +207,24 @@ }, { "name": "doctrine/lexer", - "version": "v1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/1febd6c3ef84253d7c815bed85fc622ad207a9f8", + "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8", "shasum": "" }, "require": { "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "^4.5" + }, "type": "library", "extra": { "branch-alias": { @@ -229,8 +232,8 @@ } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" } }, "notification-url": "https://packagist.org/downloads/", @@ -251,13 +254,16 @@ "email": "schmittjoh@gmail.com" } ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", "keywords": [ + "annotations", + "docblock", "lexer", - "parser" + "parser", + "php" ], - "time": "2014-09-09T13:34:57+00:00" + "time": "2019-06-08T11:03:04+00:00" }, { "name": "guzzlehttp/guzzle", @@ -804,74 +810,6 @@ "description": "A polyfill for getallheaders.", "time": "2016-02-11T07:05:27+00:00" }, - { - "name": "symfony/contracts", - "version": "v1.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/contracts.git", - "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", - "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "require-dev": { - "psr/cache": "^1.0", - "psr/container": "^1.0" - }, - "suggest": { - "psr/cache": "When using the Cache contracts", - "psr/container": "When using the Service contracts", - "symfony/cache-contracts-implementation": "", - "symfony/service-contracts-implementation": "", - "symfony/translation-contracts-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\": "" - }, - "exclude-from-classmap": [ - "**/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A set of abstractions extracted out of the Symfony components", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2018-12-05T08:06:11+00:00" - }, { "name": "symfony/polyfill-ctype", "version": "v1.11.0", @@ -990,30 +928,87 @@ "time": "2019-02-06T07:57:58+00:00" }, { - "name": "symfony/validator", - "version": "v4.2.5", + "name": "symfony/translation-contracts", + "version": "v1.1.5", "source": { "type": "git", - "url": "https://github.com/symfony/validator.git", - "reference": "db5457ed88aacc1a040d4961ee52cddad3e5a4aa" + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "cb4b18ad7b92a26e83b65dde940fab78339e6f3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/db5457ed88aacc1a040d4961ee52cddad3e5a4aa", - "reference": "db5457ed88aacc1a040d4961ee52cddad3e5a4aa", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/cb4b18ad7b92a26e83b65dde940fab78339e6f3c", + "reference": "cb4b18ad7b92a26e83b65dde940fab78339e6f3c", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + } + }, + "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": "Generic abstractions related to translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-06-13T11:15:36+00:00" + }, + { + "name": "symfony/validator", + "version": "v4.3.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/validator.git", + "reference": "ea74d2843fd8a9f2d4800136c985d13da586a405" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/validator/zipball/ea74d2843fd8a9f2d4800136c985d13da586a405", + "reference": "ea74d2843fd8a9f2d4800136c985d13da586a405", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/contracts": "^1.0.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.0" + "symfony/polyfill-mbstring": "~1.0", + "symfony/translation-contracts": "^1.1" }, "conflict": { "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", "symfony/dependency-injection": "<3.4", "symfony/http-kernel": "<3.4", - "symfony/intl": "<4.1", + "symfony/intl": "<4.3", "symfony/translation": "<4.2", "symfony/yaml": "<3.4" }, @@ -1025,10 +1020,12 @@ "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.1", + "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" @@ -1043,13 +1040,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": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -1076,7 +1074,7 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2019-03-30T15:58:42+00:00" + "time": "2019-06-03T20:27:40+00:00" } ], "packages-dev": [ @@ -1144,16 +1142,16 @@ }, { "name": "composer/xdebug-handler", - "version": "1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "d17708133b6c276d6e42ef887a877866b909d892" + "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/d17708133b6c276d6e42ef887a877866b909d892", - "reference": "d17708133b6c276d6e42ef887a877866b909d892", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/46867cbf8ca9fb8d60c506895449eb799db1184f", + "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f", "shasum": "" }, "require": { @@ -1184,20 +1182,20 @@ "Xdebug", "performance" ], - "time": "2019-01-28T20:25:53+00:00" + "time": "2019-05-27T17:52:04+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.14.2", + "version": "v2.15.1", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "ff401e58261ffc5934a58f795b3f95b355e276cb" + "reference": "20064511ab796593a3990669eff5f5b535001f7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/ff401e58261ffc5934a58f795b3f95b355e276cb", - "reference": "ff401e58261ffc5934a58f795b3f95b355e276cb", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/20064511ab796593a3990669eff5f5b535001f7c", + "reference": "20064511ab796593a3990669eff5f5b535001f7c", "shasum": "" }, "require": { @@ -1225,11 +1223,11 @@ "mikey179/vfsstream": "^1.6", "php-coveralls/php-coveralls": "^2.1", "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.0.1", + "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.5.1", - "symfony/phpunit-bridge": "^4.0" + "phpunitgoodpractices/traits": "^1.8", + "symfony/phpunit-bridge": "^4.3" }, "suggest": { "ext-mbstring": "For handling non-UTF8 characters in cache signature.", @@ -1272,7 +1270,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2019-02-17T17:44:13+00:00" + "time": "2019-06-01T10:32:12+00:00" }, { "name": "jean85/pretty-package-versions", @@ -1327,16 +1325,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.8.1", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", "shasum": "" }, "require": { @@ -1371,7 +1369,7 @@ "object", "object graph" ], - "time": "2018-06-11T23:09:50+00:00" + "time": "2019-04-07T13:18:21+00:00" }, { "name": "nette/bootstrap", @@ -2084,22 +2082,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", @@ -2135,20 +2133,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": { @@ -2182,7 +2180,7 @@ } ], "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+00:00" + "time": "2018-07-08T19:19:57+00:00" }, { "name": "php-cs-fixer/diff", @@ -2291,16 +2289,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", + "version": "4.3.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", "shasum": "" }, "require": { @@ -2338,7 +2336,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30T07:14:17+00:00" + "time": "2019-04-30T17:48:53+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -2455,16 +2453,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.8.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", "shasum": "" }, "require": { @@ -2485,8 +2483,8 @@ } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -2514,7 +2512,7 @@ "spy", "stub" ], - "time": "2018-08-05T17:53:17+00:00" + "time": "2019-06-13T12:50:23+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -2626,40 +2624,40 @@ }, { "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": { @@ -2685,29 +2683,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": { @@ -2722,7 +2723,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -2732,7 +2733,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -2777,28 +2778,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": { @@ -2813,7 +2814,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -2822,33 +2823,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": { @@ -2871,57 +2872,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.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7" + "reference": "61d34e8dd6eb3555900f0f2a2fa9e7e570730102" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bac23fe7ff13dbdb461481f706f0e9fe746334b7", - "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/61d34e8dd6eb3555900f0f2a2fa9e7e570730102", + "reference": "61d34e8dd6eb3555900f0f2a2fa9e7e570730102", "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.0", + "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" @@ -2929,7 +2930,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.5.x-dev" + "dev-master": "7.4-dev" } }, "autoload": { @@ -2955,67 +2956,7 @@ "testing", "xunit" ], - "time": "2019-02-01T05:22:47+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "5.0.10", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", - "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", - "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": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "abandoned": true, - "time": "2018-08-09T05:50:03+00:00" + "time": "2018-12-03T05:01:24+00:00" }, { "name": "psr/container", @@ -3160,30 +3101,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": { @@ -3220,32 +3161,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": { @@ -3270,34 +3212,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": { @@ -3322,7 +3270,7 @@ "environment", "hhvm" ], - "time": "2017-07-01T08:51:00+00:00" + "time": "2019-05-05T09:05:15+00:00" }, { "name": "sebastian/exporter", @@ -3589,25 +3537,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": { @@ -3627,7 +3575,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", @@ -3674,16 +3622,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.4.1", + "version": "3.4.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5b4333b4010625d29580eb4a41f1e53251be6baa" + "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5b4333b4010625d29580eb4a41f1e53251be6baa", - "reference": "5b4333b4010625d29580eb4a41f1e53251be6baa", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", + "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", "shasum": "" }, "require": { @@ -3721,20 +3669,20 @@ "phpcs", "standards" ], - "time": "2019-03-19T03:22:27+00:00" + "time": "2019-04-10T23:49:02+00:00" }, { "name": "symfony/config", - "version": "v4.2.5", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "0e745ead307d5dcd4e163e94a47ec04b1428943f" + "reference": "6379ee07398643e09e6ed1e87d9c62dfcad7f4eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/0e745ead307d5dcd4e163e94a47ec04b1428943f", - "reference": "0e745ead307d5dcd4e163e94a47ec04b1428943f", + "url": "https://api.github.com/repos/symfony/config/zipball/6379ee07398643e09e6ed1e87d9c62dfcad7f4eb", + "reference": "6379ee07398643e09e6ed1e87d9c62dfcad7f4eb", "shasum": "" }, "require": { @@ -3749,6 +3697,7 @@ "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": { @@ -3757,7 +3706,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -3784,29 +3733,31 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2019-04-01T14:03:25+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/console", - "version": "v4.2.5", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "24206aff3efe6962593297e57ef697ebb220e384" + "reference": "d50bbeeb0e17e6dd4124ea391eff235e932cbf64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/24206aff3efe6962593297e57ef697ebb220e384", - "reference": "24206aff3efe6962593297e57ef697ebb220e384", + "url": "https://api.github.com/repos/symfony/console/zipball/d50bbeeb0e17e6dd4124ea391eff235e932cbf64", + "reference": "d50bbeeb0e17e6dd4124ea391eff235e932cbf64", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/contracts": "^1.0", - "symfony/polyfill-mbstring": "~1.0" + "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": { @@ -3816,9 +3767,10 @@ "psr/log": "~1.0", "symfony/config": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/event-dispatcher": "^4.3", "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" + "symfony/process": "~3.4|~4.0", + "symfony/var-dumper": "^4.3" }, "suggest": { "psr/log": "For using the console logger", @@ -3829,7 +3781,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -3856,39 +3808,39 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-04-01T07:32:59+00:00" + "time": "2019-06-05T13:25:51+00:00" }, { "name": "symfony/dependency-injection", - "version": "v4.2.5", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "1806e43ff6bff57398d33b326cd753a12d9f434f" + "reference": "fea7f73e278ee0337349a5a68b867fc656bb33f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1806e43ff6bff57398d33b326cd753a12d9f434f", - "reference": "1806e43ff6bff57398d33b326cd753a12d9f434f", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/fea7f73e278ee0337349a5a68b867fc656bb33f3", + "reference": "fea7f73e278ee0337349a5a68b867fc656bb33f3", "shasum": "" }, "require": { "php": "^7.1.3", "psr/container": "^1.0", - "symfony/contracts": "^1.0" + "symfony/service-contracts": "^1.1.2" }, "conflict": { - "symfony/config": "<4.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-contracts-implementation": "1.0" + "symfony/service-implementation": "1.0" }, "require-dev": { - "symfony/config": "~4.2", + "symfony/config": "^4.3", "symfony/expression-language": "~3.4|~4.0", "symfony/yaml": "~3.4|~4.0" }, @@ -3902,7 +3854,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -3929,20 +3881,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2019-03-30T15:58:42+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/dotenv", - "version": "v4.2.5", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "b541d63b83532be55a020db8ed2e50598385a583" + "reference": "efd677abff68ea6fcfd9c60dbdacb96d0d97b382" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/b541d63b83532be55a020db8ed2e50598385a583", - "reference": "b541d63b83532be55a020db8ed2e50598385a583", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/efd677abff68ea6fcfd9c60dbdacb96d0d97b382", + "reference": "efd677abff68ea6fcfd9c60dbdacb96d0d97b382", "shasum": "" }, "require": { @@ -3954,7 +3906,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -3986,34 +3938,40 @@ "env", "environment" ], - "time": "2019-04-01T07:32:59+00:00" + "time": "2019-05-07T09:02:05+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.2.5", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "ca5af306fbc37f3cf597e91bc9cfa0c7d3f33544" + "reference": "4e6c670af81c4fb0b6c08b035530a9915d0b691f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ca5af306fbc37f3cf597e91bc9cfa0c7d3f33544", - "reference": "ca5af306fbc37f3cf597e91bc9cfa0c7d3f33544", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4e6c670af81c4fb0b6c08b035530a9915d0b691f", + "reference": "4e6c670af81c4fb0b6c08b035530a9915d0b691f", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/contracts": "^1.0" + "symfony/event-dispatcher-contracts": "^1.1" }, "conflict": { "symfony/dependency-injection": "<3.4" }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "1.1" + }, "require-dev": { "psr/log": "~1.0", "symfony/config": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", "symfony/expression-language": "~3.4|~4.0", + "symfony/http-foundation": "^3.4|^4.0", + "symfony/service-contracts": "^1.1", "symfony/stopwatch": "~3.4|~4.0" }, "suggest": { @@ -4023,7 +3981,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -4050,20 +4008,78 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-03-30T15:58:42+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { - "name": "symfony/filesystem", - "version": "v4.2.5", + "name": "symfony/event-dispatcher-contracts", + "version": "v1.1.5", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "e16b9e471703b2c60b95f14d31c1239f68f11601" + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "c61766f4440ca687de1084a5c00b08e167a2575c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e16b9e471703b2c60b95f14d31c1239f68f11601", - "reference": "e16b9e471703b2c60b95f14d31c1239f68f11601", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/c61766f4440ca687de1084a5c00b08e167a2575c", + "reference": "c61766f4440ca687de1084a5c00b08e167a2575c", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "suggest": { + "psr/event-dispatcher": "", + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "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": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-06-20T06:46:26+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v4.3.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "bf2af40d738dec5e433faea7b00daa4431d0a4cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/bf2af40d738dec5e433faea7b00daa4431d0a4cf", + "reference": "bf2af40d738dec5e433faea7b00daa4431d0a4cf", "shasum": "" }, "require": { @@ -4073,7 +4089,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -4100,20 +4116,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-02-07T11:40:08+00:00" + "time": "2019-06-03T20:27:40+00:00" }, { "name": "symfony/finder", - "version": "v4.2.5", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "267b7002c1b70ea80db0833c3afe05f0fbde580a" + "reference": "b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/267b7002c1b70ea80db0833c3afe05f0fbde580a", - "reference": "267b7002c1b70ea80db0833c3afe05f0fbde580a", + "url": "https://api.github.com/repos/symfony/finder/zipball/b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176", + "reference": "b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176", "shasum": "" }, "require": { @@ -4122,7 +4138,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -4149,20 +4165,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-02-23T15:42:05+00:00" + "time": "2019-05-26T20:47:49+00:00" }, { "name": "symfony/options-resolver", - "version": "v4.2.5", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "3896e5a7d06fd15fa4947694c8dcdd371ff147d1" + "reference": "914e0edcb7cd0c9f494bc023b1d47534f4542332" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3896e5a7d06fd15fa4947694c8dcdd371ff147d1", - "reference": "3896e5a7d06fd15fa4947694c8dcdd371ff147d1", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/914e0edcb7cd0c9f494bc023b1d47534f4542332", + "reference": "914e0edcb7cd0c9f494bc023b1d47534f4542332", "shasum": "" }, "require": { @@ -4171,7 +4187,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -4203,7 +4219,7 @@ "configuration", "options" ], - "time": "2019-02-23T15:17:42+00:00" + "time": "2019-05-10T05:38:46+00:00" }, { "name": "symfony/polyfill-php70", @@ -4320,17 +4336,75 @@ "time": "2019-02-06T07:57:58+00:00" }, { - "name": "symfony/process", - "version": "v4.2.5", + "name": "symfony/polyfill-php73", + "version": "v1.11.0", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "1e6cbb41dadcaf29e0db034d6ad0d039a9df06e6" + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "d1fb4abcc0c47be136208ad9d68bf59f1ee17abd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/1e6cbb41dadcaf29e0db034d6ad0d039a9df06e6", - "reference": "1e6cbb41dadcaf29e0db034d6ad0d039a9df06e6", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/d1fb4abcc0c47be136208ad9d68bf59f1ee17abd", + "reference": "d1fb4abcc0c47be136208ad9d68bf59f1ee17abd", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "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.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/process", + "version": "v4.3.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "856d35814cf287480465bb7a6c413bb7f5f5e69c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/856d35814cf287480465bb7a6c413bb7f5f5e69c", + "reference": "856d35814cf287480465bb7a6c413bb7f5f5e69c", "shasum": "" }, "require": { @@ -4339,7 +4413,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -4366,30 +4440,88 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-03-10T20:07:02+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { - "name": "symfony/stopwatch", - "version": "v4.2.5", + "name": "symfony/service-contracts", + "version": "v1.1.5", "source": { "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "b1a5f646d56a3290230dbc8edf2a0d62cda23f67" + "url": "https://github.com/symfony/service-contracts.git", + "reference": "f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/b1a5f646d56a3290230dbc8edf2a0d62cda23f67", - "reference": "b1a5f646d56a3290230dbc8edf2a0d62cda23f67", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d", + "reference": "f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/contracts": "^1.0" + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "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": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-06-13T11:15:36+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v4.3.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "6b100e9309e8979cf1978ac1778eb155c1f7d93b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/6b100e9309e8979cf1978ac1778eb155c1f7d93b", + "reference": "6b100e9309e8979cf1978ac1778eb155c1f7d93b", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/service-contracts": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" } }, "autoload": { @@ -4416,20 +4548,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2019-01-16T20:31:39+00:00" + "time": "2019-05-27T08:16:38+00:00" }, { "name": "theseer/tokenizer", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8" + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/1c42705be2b6c1de5904f8afacef5895cab44bf8", - "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", "shasum": "" }, "require": { @@ -4456,7 +4588,7 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-04-04T09:56:43+00:00" + "time": "2019-06-13T22:48:21+00:00" }, { "name": "webmozart/assert", @@ -4516,7 +4648,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.0", + "php": ">=7.1", "ext-curl": "*", "ext-json": "*" }, diff --git a/src/Bot/Client.php b/src/Bot/Client.php index 579894e..47f0ab4 100644 --- a/src/Bot/Client.php +++ b/src/Bot/Client.php @@ -16,10 +16,10 @@ namespace RetailCrm\Mg\Bot; use RetailCrm\Common\Exception\InvalidJsonException; use RetailCrm\Common\Url; use RetailCrm\Common\Serializer; -use RetailCrm\Mg\Bot\Model\Response\AssignResponse; -use RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse; +use RetailCrm\Mg\Bot\Model\Request\GetFileRequest; +use RetailCrm\Mg\Bot\Model\Request\UploadFileByUrlRequest; +use RetailCrm\Mg\Bot\Model\Response\FullFileResponse; use RetailCrm\Mg\Bot\Model\Response\ListResponse; -use RetailCrm\Mg\Bot\Model\Response\MessageSendResponse; /** * PHP version 7.0 @@ -67,13 +67,13 @@ class Client * @param string $method * @param object $request Request parameters * @param string $responseType - * @param int $serializeTo + * @param string $serializeTo * @param bool $arrayOfObjects * - * @return object + * @return object|null * @throws \Exception */ - private function getData( + private function submitRequest( $path, $method, $request, @@ -121,7 +121,7 @@ class Client { $path = $fromRoot ? '\\' : ''; - foreach($classes as $class) { + foreach ($classes as $class) { $path .= '\\' . $class; } @@ -158,7 +158,7 @@ class Client */ public function bots(Model\Request\BotsRequest $request) { - return $this->getData( + return $this->submitRequest( '/bots', HttpClient::METHOD_GET, $request, @@ -178,7 +178,7 @@ class Client */ public function info(Model\Request\InfoRequest $request) { - return $this->getData( + return $this->submitRequest( '/my/info', HttpClient::METHOD_PATCH, $request, @@ -196,7 +196,7 @@ class Client */ public function channels(Model\Request\ChannelsRequest $request) { - return $this->getData( + return $this->submitRequest( '/channels', HttpClient::METHOD_GET, $request, @@ -216,7 +216,7 @@ class Client */ public function chats(Model\Request\ChatsRequest $request) { - return $this->getData( + return $this->submitRequest( '/chats', HttpClient::METHOD_GET, $request, @@ -236,7 +236,7 @@ class Client */ public function commands(Model\Request\CommandsRequest $request) { - return $this->getData( + return $this->submitRequest( '/my/commands', HttpClient::METHOD_GET, $request, @@ -256,7 +256,7 @@ class Client */ public function commandEdit(Model\Request\CommandEditRequest $request) { - return $this->getData( + return $this->submitRequest( sprintf("/my/commands/%s", $request->getName()), HttpClient::METHOD_PUT, $request, @@ -275,7 +275,7 @@ class Client */ public function commandDelete(string $request) { - return $this->getData( + return $this->submitRequest( sprintf("/my/commands/%s", $request), HttpClient::METHOD_DELETE, null, @@ -294,7 +294,7 @@ class Client */ public function customers(Model\Request\CustomersRequest $request) { - return $this->getData( + return $this->submitRequest( '/customers', HttpClient::METHOD_GET, $request, @@ -314,7 +314,7 @@ class Client */ public function dialogs(Model\Request\DialogsRequest $request) { - return $this->getData( + return $this->submitRequest( '/dialogs', HttpClient::METHOD_GET, $request, @@ -334,7 +334,7 @@ class Client */ public function dialogAssign(Model\Request\DialogAssignRequest $request) { - return $this->getData( + return $this->submitRequest( sprintf("/dialogs/%d/assign", $request->getDialogId()), HttpClient::METHOD_PATCH, $request, @@ -353,7 +353,7 @@ class Client */ public function dialogClose(string $request) { - return $this->getData( + return $this->submitRequest( sprintf("/dialogs/%d/close", $request), HttpClient::METHOD_DELETE, null, @@ -371,7 +371,7 @@ class Client */ public function members(Model\Request\MembersRequest $request) { - return $this->getData( + return $this->submitRequest( '/members', HttpClient::METHOD_GET, $request, @@ -391,7 +391,7 @@ class Client */ public function messages(Model\Request\MessagesRequest $request) { - return $this->getData( + return $this->submitRequest( '/messages', HttpClient::METHOD_GET, $request, @@ -411,7 +411,7 @@ class Client */ public function messageSend(Model\Request\MessageSendRequest $request) { - return $this->getData( + return $this->submitRequest( '/messages', HttpClient::METHOD_POST, $request, @@ -429,7 +429,7 @@ class Client */ public function messageEdit(Model\Request\MessageEditRequest $request) { - return $this->getData( + return $this->submitRequest( sprintf("/messages/%d", $request->getId()), HttpClient::METHOD_PATCH, $request, @@ -447,7 +447,7 @@ class Client */ public function messageDelete(string $request) { - return $this->getData( + return $this->submitRequest( sprintf("/messages/%d", $request), HttpClient::METHOD_DELETE, null, @@ -465,7 +465,7 @@ class Client */ public function users(Model\Request\UsersRequest $request) { - return $this->getData( + return $this->submitRequest( '/users', HttpClient::METHOD_GET, $request, @@ -474,4 +474,54 @@ class Client true ); } + + /** + * Returns filtered users list + * + * @param string $url File URL + * + * @return \RetailCrm\Mg\Bot\Model\Response\UploadFileResponse|object + * @throws \Exception + */ + public function uploadFileByUrl(string $url) + { + $request = new UploadFileByUrlRequest(); + $request->setUrl($url); + + return $this->submitRequest( + '/files/upload_by_url', + HttpClient::METHOD_POST, + $request, + self::getResponseClass('UploadFileResponse') + ); + } + + /** + * @param string $filename + * @return Model\Response\UploadFileResponse + * + * @throws \Exception + */ + public function uploadFile(string $filename) + { + return $this->client->uploadFileViaForm($filename); + } + + /** + * @param string $fileId + * @return Model\Response\FullFileResponse|null + * + * @throws \Exception + */ + public function getFileById(string $fileId) + { + $obj = $this->submitRequest( + \sprintf('/files/%s', $fileId), + HttpClient::METHOD_GET, + null, + self::getResponseClass('FullFileResponse') + ); + + return ($obj instanceof FullFileResponse) ? $obj : null; + } } diff --git a/src/Bot/HttpClient.php b/src/Bot/HttpClient.php index 8b3deac..6eda64a 100644 --- a/src/Bot/HttpClient.php +++ b/src/Bot/HttpClient.php @@ -18,9 +18,9 @@ use RetailCrm\Common\Exception\LimitException; use InvalidArgumentException; use RetailCrm\Common\Serializer; use RetailCrm\Common\Url; +use RetailCrm\Mg\Bot\Model\Response\UploadFileResponse; use Symfony\Component\Validator\Validation; use GuzzleHttp\Client; -use GuzzleHttp\HandlerStack; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Exception\GuzzleException; use Psr\Http\Message\ResponseInterface; @@ -107,7 +107,7 @@ class HttpClient * @param string $path Request URL * @param string $method Request method (default: 'GET') * @param mixed $request Request model (default: null) - * @param int $serializeTo Serializer::S_JSON or Serializer::S_ARRAY + * @param string $serializeTo Serializer::S_JSON or Serializer::S_ARRAY * * @return ResponseInterface * @throws \Exception @@ -122,7 +122,7 @@ class HttpClient $this->validateRequest($request); } - if ($method == self::METHOD_GET) { + if ($method == self::METHOD_GET && !is_null($request)) { $getParameters = Url::buildGetParameters(Serializer::serialize($request, Serializer::S_ARRAY)); } @@ -176,6 +176,47 @@ class HttpClient return $responseObject; } + /** + * @param string $filename + * @return UploadFileResponse + * + * @throws \Exception + */ + public function uploadFileViaForm(string $filename): UploadFileResponse + { + if (!file_exists($filename)) { + throw new \InvalidArgumentException("File doesn't exist"); + } + + try { + $responseData = $this->client->request( + self::METHOD_POST, + \sprintf("%s/files/upload", $this->basePath), + [ + 'headers' => [ + 'X-Bot-Token' => $this->token + ], + 'multipart' => [ + [ + 'name' => basename($filename), + 'filename' => basename($filename), + 'contents' => fopen($filename, 'r') + ] + ] + ] + ); + } catch (GuzzleException $exception) { + throw new \Exception($exception->getMessage(), $exception->getCode(), $exception); + } + + $obj = Serializer::deserialize( + (string) $responseData->getBody(), + 'RetailCrm\Mg\Bot\Model\Response\UploadFileResponse' + ); + + return $obj instanceof UploadFileResponse ? $obj : null; + } + /** * Validate HTTP method * diff --git a/src/Bot/Model/Entity/Bot.php b/src/Bot/Model/Entity/Bot.php index 6880a33..54b205c 100644 --- a/src/Bot/Model/Entity/Bot.php +++ b/src/Bot/Model/Entity/Bot.php @@ -255,4 +255,4 @@ class Bot { $this->isSystem = $isSystem; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Channel/Channel.php b/src/Bot/Model/Entity/Channel/Channel.php index 1c88d8f..22ec381 100644 --- a/src/Bot/Model/Entity/Channel/Channel.php +++ b/src/Bot/Model/Entity/Channel/Channel.php @@ -174,4 +174,4 @@ class Channel { $this->name = $name; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Channel/ChannelSettings.php b/src/Bot/Model/Entity/Channel/ChannelSettings.php index a858518..57bd31c 100644 --- a/src/Bot/Model/Entity/Channel/ChannelSettings.php +++ b/src/Bot/Model/Entity/Channel/ChannelSettings.php @@ -201,4 +201,4 @@ class ChannelSettings { $this->file = $file; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/CommonFields.php b/src/Bot/Model/Entity/CommonFields.php index 7636fa1..49736c9 100644 --- a/src/Bot/Model/Entity/CommonFields.php +++ b/src/Bot/Model/Entity/CommonFields.php @@ -104,4 +104,4 @@ trait CommonFields { $this->updatedAt = $updatedAt; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/Item.php b/src/Bot/Model/Entity/Message/Item.php index fe3b0b5..65fc1cb 100644 --- a/src/Bot/Model/Entity/Message/Item.php +++ b/src/Bot/Model/Entity/Message/Item.php @@ -103,4 +103,4 @@ class Item { $this->caption = $caption; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/Message.php b/src/Bot/Model/Entity/Message/Message.php index acc5563..a13c13c 100644 --- a/src/Bot/Model/Entity/Message/Message.php +++ b/src/Bot/Model/Entity/Message/Message.php @@ -458,4 +458,4 @@ class Message { $this->product = $product; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/MessageCost.php b/src/Bot/Model/Entity/Message/MessageCost.php index 86030a6..721b3b4 100644 --- a/src/Bot/Model/Entity/Message/MessageCost.php +++ b/src/Bot/Model/Entity/Message/MessageCost.php @@ -79,4 +79,4 @@ class MessageCost { $this->currency = $currency; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/MessageDelivery.php b/src/Bot/Model/Entity/Message/MessageDelivery.php index 3e0b052..ccc6a46 100644 --- a/src/Bot/Model/Entity/Message/MessageDelivery.php +++ b/src/Bot/Model/Entity/Message/MessageDelivery.php @@ -131,4 +131,4 @@ class MessageDelivery { $this->comment = $comment; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/MessageOrder.php b/src/Bot/Model/Entity/Message/MessageOrder.php index 66106f8..92badd0 100644 --- a/src/Bot/Model/Entity/Message/MessageOrder.php +++ b/src/Bot/Model/Entity/Message/MessageOrder.php @@ -16,9 +16,6 @@ namespace RetailCrm\Mg\Bot\Model\Entity\Message; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; -use RetailCrm\Mg\Bot\Model\Entity\Cost; -use RetailCrm\Mg\Bot\Model\Entity\Delivery; -use RetailCrm\Mg\Bot\Model\Entity\Status; /** * PHP version 7.0 @@ -32,16 +29,6 @@ use RetailCrm\Mg\Bot\Model\Entity\Status; */ class MessageOrder { -// const JSON_PROPERTY_MAP = [ -// 'cost' => 'MessageCost', -// 'date' => 'string', -// 'delivery' => 'MessageDelivery', -// 'items' => 'MessageOrderItem[]', -// 'number' => 'string', -// 'payments' => 'MessagePayment[]', -// 'status' => 'MessageStatus' -// ]; - /** * @var string $number * @@ -241,4 +228,4 @@ class MessageOrder { $this->payments = $payments; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/MessageOrderItem.php b/src/Bot/Model/Entity/Message/MessageOrderItem.php index e1d7d6c..5a01d9c 100644 --- a/src/Bot/Model/Entity/Message/MessageOrderItem.php +++ b/src/Bot/Model/Entity/Message/MessageOrderItem.php @@ -1,14 +1,14 @@ * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers + * + * @see http://help.retailcrm.pro/docs/Developers */ namespace RetailCrm\Mg\Bot\Model\Entity\Message; @@ -18,19 +18,19 @@ use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; /** - * PHP version 7.0 + * PHP version 7.0. * * MessageOrderItem class * - * @package RetailCrm\Mg\Bot\Model\Entity\Message * @author retailCRM * @license https://opensource.org/licenses/MIT MIT License - * @link http://help.retailcrm.pro/docs/Developers + * + * @see http://help.retailcrm.pro/docs/Developers */ class MessageOrderItem { /** - * @var string $name + * @var string * * @Type("string") * @Accessor(getter="getName",setter="setName") @@ -39,7 +39,7 @@ class MessageOrderItem private $name; /** - * @var string $url + * @var string * * @Type("string") * @Accessor(getter="getUrl",setter="setUrl") @@ -48,7 +48,7 @@ class MessageOrderItem private $url; /** - * @var string $img + * @var string * * @Type("string") * @Accessor(getter="getImg",setter="setImg") @@ -57,7 +57,7 @@ class MessageOrderItem private $img; /** - * @var MessageCost $price + * @var MessageCost * * @Type("MessageCost") * @Accessor(getter="getPrice",setter="setPrice") @@ -66,7 +66,7 @@ class MessageOrderItem private $price; /** - * @var MessageQuantity $quantity + * @var MessageQuantity * * @Type("MessageQuantity") * @Accessor(getter="getQuantity",setter="setQuantity) @@ -153,4 +153,4 @@ class MessageOrderItem { $this->quantity = $quantity; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php b/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php index 15ee079..357a032 100644 --- a/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php +++ b/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php @@ -81,4 +81,4 @@ class MessageOrderPaymentStatus { $this->payed = $payed; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/MessagePayment.php b/src/Bot/Model/Entity/Message/MessagePayment.php index ee9df9e..eae13f1 100644 --- a/src/Bot/Model/Entity/Message/MessagePayment.php +++ b/src/Bot/Model/Entity/Message/MessagePayment.php @@ -103,4 +103,4 @@ class MessagePayment { $this->amount = $amount; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/MessageProduct.php b/src/Bot/Model/Entity/Message/MessageProduct.php index 0dac7b9..490d6e6 100644 --- a/src/Bot/Model/Entity/Message/MessageProduct.php +++ b/src/Bot/Model/Entity/Message/MessageProduct.php @@ -203,4 +203,4 @@ class MessageProduct { $this->quantity = $quantity; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/MessageQuantity.php b/src/Bot/Model/Entity/Message/MessageQuantity.php index b28a2b3..d03cbdc 100644 --- a/src/Bot/Model/Entity/Message/MessageQuantity.php +++ b/src/Bot/Model/Entity/Message/MessageQuantity.php @@ -82,4 +82,4 @@ class MessageQuantity { $this->unit = $unit; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Entity/Message/MessageStatus.php b/src/Bot/Model/Entity/Message/MessageStatus.php index a60fc6f..27f4c0c 100644 --- a/src/Bot/Model/Entity/Message/MessageStatus.php +++ b/src/Bot/Model/Entity/Message/MessageStatus.php @@ -78,4 +78,4 @@ class MessageStatus { $this->name = $name; } -} \ No newline at end of file +} diff --git a/src/Bot/Model/Request/CommonFields.php b/src/Bot/Model/Request/CommonFields.php index 5ade7d0..140c774 100644 --- a/src/Bot/Model/Request/CommonFields.php +++ b/src/Bot/Model/Request/CommonFields.php @@ -30,6 +30,8 @@ use JMS\Serializer\Annotation\Type; trait CommonFields { /** + * @var int + * * @Type("int") * @Accessor(getter="getId",setter="setId") * @SkipWhenEmpty @@ -37,14 +39,18 @@ trait CommonFields private $id; /** - * @Type("string") + * @var \DateTime + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Accessor(getter="getSince",setter="setSince") * @SkipWhenEmpty */ private $since; /** - * @Type("string") + * @var \DateTime + * + * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") * @Accessor(getter="getUntil",setter="setUntil") * @SkipWhenEmpty */ @@ -67,7 +73,7 @@ trait CommonFields } /** - * @return string + * @return \DateTime */ public function getSince() { @@ -75,15 +81,15 @@ trait CommonFields } /** - * @param string $since + * @param \DateTime $since */ - public function setSince($since) + public function setSince(\DateTime $since): void { $this->since = $since; } /** - * @return string + * @return \DateTime */ public function getUntil() { @@ -91,9 +97,9 @@ trait CommonFields } /** - * @param string $until + * @param \DateTime $until */ - public function setUntil($until) + public function setUntil(\DateTime $until): void { $this->until = $until; } diff --git a/src/Bot/Model/Request/UploadFileByUrlRequest.php b/src/Bot/Model/Request/UploadFileByUrlRequest.php new file mode 100644 index 0000000..f2b4cf3 --- /dev/null +++ b/src/Bot/Model/Request/UploadFileByUrlRequest.php @@ -0,0 +1,57 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Model\Request; + +use JMS\Serializer\Annotation\Accessor; +use JMS\Serializer\Annotation\Type; +use Symfony\Component\Validator\Constraints as Assert; + +/** + * PHP version 7.0 + * + * UploadFileByUrlRequest class + * + * @package RetailCrm\Mg\Bot\Model\Request + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class UploadFileByUrlRequest +{ + /** + * @var string $url + * + * @Type("string") + * @Accessor(getter="getUrl",setter="setUrl") + * @Assert\NotBlank() + * @Assert\Url() + */ + private $url; + + /** + * @return string + */ + public function getUrl(): string + { + return $this->url; + } + + /** + * @param string $url + */ + public function setUrl(string $url): void + { + $this->url = $url; + } +} diff --git a/src/Bot/Model/Response/ErrorOnlyResponse.php b/src/Bot/Model/Response/ErrorOnlyResponse.php index 82307a1..dfe5a38 100644 --- a/src/Bot/Model/Response/ErrorOnlyResponse.php +++ b/src/Bot/Model/Response/ErrorOnlyResponse.php @@ -23,6 +23,7 @@ namespace RetailCrm\Mg\Bot\Model\Response; * @license https://opensource.org/licenses/MIT MIT License * @link http://help.retailcrm.pro/docs/Developers */ -class ErrorOnlyResponse { +class ErrorOnlyResponse +{ use CommonFields; } diff --git a/src/Serializer.php b/src/Serializer.php index f9e3556..190fac3 100644 --- a/src/Serializer.php +++ b/src/Serializer.php @@ -36,7 +36,7 @@ class Serializer * Serialize given object to JSON or Array * * @param object $request - * @param int $serialize + * @param string $serialize * * @return array|string */ @@ -63,10 +63,10 @@ class Serializer * Deserialize given array or JSON to object * * @param mixed $data - * @param string self::normalizeNamespace($entityType) + * @param string $entityType * @param string $from * - * @return array|object|null + * @return object|null */ public static function deserialize($data, $entityType, $from = self::S_JSON) { @@ -85,7 +85,7 @@ class Serializer break; } - return $deserialized; + return is_object($deserialized) ? $deserialized : null; } /** diff --git a/tests/Bot/Tests/ClientListTest.php b/tests/Bot/Tests/ClientListTest.php index 3e6ab16..d2d6129 100644 --- a/tests/Bot/Tests/ClientListTest.php +++ b/tests/Bot/Tests/ClientListTest.php @@ -22,7 +22,6 @@ 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; -use RetailCrm\Mg\Bot\Model\Response; use RetailCrm\Mg\Bot\Test\TestCase; /** @@ -37,7 +36,6 @@ use RetailCrm\Mg\Bot\Test\TestCase; */ class ClientListTest extends TestCase { - /** * @group("list") * @throws \Exception diff --git a/tests/Bot/Tests/FileTest.php b/tests/Bot/Tests/FileTest.php new file mode 100644 index 0000000..6529945 --- /dev/null +++ b/tests/Bot/Tests/FileTest.php @@ -0,0 +1,113 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ + +namespace RetailCrm\Mg\Bot\Tests; + +use RetailCrm\Mg\Bot\Model\Constants; +use RetailCrm\Mg\Bot\Model\Request\MessageSendRequest; +use RetailCrm\Mg\Bot\Model\Response\FullFileResponse; +use RetailCrm\Mg\Bot\Model\Response\UploadFileResponse; +use RetailCrm\Mg\Bot\Test\TestCase; + +/** + * PHP version 7.0 + * + * Class UploadFileTest + * + * @package RetailCrm\Mg\Bot\Tests + * @author retailCRM + * @license https://opensource.org/licenses/MIT MIT License + * @link http://help.retailcrm.pro/docs/Developers + */ +class FileTest extends TestCase +{ + /** + * @group("upload") + * @throws \Exception + */ + public function testUploadFileByUrlException() + { + $client = self::getApiClient( + null, + null, + false, + $this->getEmptyResponse(400) + ); + + self::expectException(\InvalidArgumentException::class); + $client->uploadFileByUrl(''); + $client->uploadFileByUrl('rar'); + } + + /** + * @group("upload") + * @throws \Exception + */ + public function testUploadFileByUrl() + { + $client = self::getApiClient( + null, + null, + false, + $this->getResponse('{"id":"881712bb-4062-4973-9e23-3373135836e2","type":"image","size":3773}') + ); + + $response = $client->uploadFileByUrl('https://2ip.ru/images/logo.gif'); + + self::assertTrue($response->isSuccessful()); + self::assertEquals('881712bb-4062-4973-9e23-3373135836e2', $response->getId()); + self::assertEquals('image', $response->getType()); + self::assertEquals('3773', $response->getSize()); + } + + /** + * @group("upload") + * @throws \Exception + */ + public function testUploadFileViaForm() + { + $client = self::getApiClient( + null, + null, + false, + $this->getResponse('{"id":"b2bdba90-166c-4e0a-829d-69f26a09fd2a","type":"file","size":214}') + ); + + $response = $client->uploadFile(__FILE__); + + self::assertTrue($response instanceof UploadFileResponse); + self::assertEquals('b2bdba90-166c-4e0a-829d-69f26a09fd2a', $response->getId()); + self::assertEquals('file', $response->getType()); + self::assertEquals(214, $response->getSize()); + } + + /** + * @group("upload") + * @throws \Exception + */ + public function testGetFileById() + { + $fileId = 'b2bdba90-166c-4e0a-829d-69f26a09fd2a'; + $client = self::getApiClient( + null, + null, + false, + $this->getJsonResponse('getFile') + ); + + $response = $client->getFileById($fileId); + + self::assertTrue($response instanceof FullFileResponse); + self::assertEquals($fileId, $response->getId()); + } +} diff --git a/tests/Resources/getFile.json b/tests/Resources/getFile.json new file mode 100644 index 0000000..ed16333 --- /dev/null +++ b/tests/Resources/getFile.json @@ -0,0 +1 @@ +{"id":"b2bdba90-166c-4e0a-829d-69f26a09fd2a","type":"file","size":214,"Url":"https://s3.eu-central-1.amazonaws.com/mg-node-files/files/21/b2bdba90-166c-4e0a-829d-69f26a09fd2a"} \ No newline at end of file