diff --git a/composer.json b/composer.json index 1a3276fe..7611908a 100644 --- a/composer.json +++ b/composer.json @@ -36,15 +36,7 @@ "require": { "php": ">=5.6", "ext-json": "*", - "monolog/monolog": "^1.27", - "prestashop/module-lib-cache-directory-provider": "^1.0", "sentry/sentry": "^1.11.0", - "php-http/message": "<1.15.0", - "psr/http-message": "<1.1", - "symfony/config": "^3.4", - "symfony/dependency-injection": "^3.4", - "symfony/yaml": "^3.4", - "prestashop/module-lib-guzzle-adapter": "v0.6", - "guzzlehttp/guzzle": "^5.0" + "prestashop/module-lib-guzzle-adapter": "v0.6" } } diff --git a/composer.lock b/composer.lock index d7659e4b..904ca42f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "695b291857289682779629da8e61a9ca", + "content-hash": "b1aa019aa9af07f0c3b6d26b8ded8b3b", "packages": [ { "name": "clue/stream-filter", @@ -72,63 +72,6 @@ ], "time": "2023-12-20T15:40:13+00:00" }, - { - "name": "guzzlehttp/guzzle", - "version": "5.3.4", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "b87eda7a7162f95574032da17e9323c9899cb6b2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b87eda7a7162f95574032da17e9323c9899cb6b2", - "reference": "b87eda7a7162f95574032da17e9323c9899cb6b2", - "shasum": "" - }, - "require": { - "guzzlehttp/ringphp": "^1.1", - "php": ">=5.4.0", - "react/promise": "^2.2" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "support": { - "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/5.3" - }, - "time": "2019-10-30T09:32:00+00:00" - }, { "name": "guzzlehttp/psr7", "version": "1.9.1", @@ -234,203 +177,6 @@ ], "time": "2023-04-17T16:00:37+00:00" }, - { - "name": "guzzlehttp/ringphp", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/RingPHP.git", - "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/5e2a174052995663dd68e6b5ad838afd47dd615b", - "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b", - "shasum": "" - }, - "require": { - "guzzlehttp/streams": "~3.0", - "php": ">=5.4.0", - "react/promise": "~2.0" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "ext-curl": "Guzzle will use specific adapters if cURL is present" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Ring\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", - "support": { - "issues": "https://github.com/guzzle/RingPHP/issues", - "source": "https://github.com/guzzle/RingPHP/tree/1.1.1" - }, - "abandoned": true, - "time": "2018-07-31T13:22:33+00:00" - }, - { - "name": "guzzlehttp/streams", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/streams.git", - "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", - "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Stream\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple abstraction over streams of data", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "stream" - ], - "support": { - "issues": "https://github.com/guzzle/streams/issues", - "source": "https://github.com/guzzle/streams/tree/master" - }, - "abandoned": true, - "time": "2014-10-12T19:18:40+00:00" - }, - { - "name": "monolog/monolog", - "version": "1.27.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "904713c5929655dc9b97288b69cfeedad610c9a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/904713c5929655dc9b97288b69cfeedad610c9a1", - "reference": "904713c5929655dc9b97288b69cfeedad610c9a1", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "php-amqplib/php-amqplib": "~2.4", - "php-console/php-console": "^3.1.3", - "phpstan/phpstan": "^0.12.59", - "phpunit/phpunit": "~4.5", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "^5.3|^6.0" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "php-console/php-console": "Allow sending log messages to Google Chrome", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" - }, - "type": "library", - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "support": { - "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/1.27.1" - }, - "funding": [ - { - "url": "https://github.com/Seldaek", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", - "type": "tidelift" - } - ], - "time": "2022-06-09T08:53:42+00:00" - }, { "name": "php-http/httplug", "version": "v1.1.0", @@ -676,55 +422,6 @@ }, "time": "2016-01-26T13:27:02+00:00" }, - { - "name": "prestashop/module-lib-cache-directory-provider", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/PrestaShopCorp/module-lib-cache-directory-provider.git", - "reference": "34a577b66a7e52ae16d6f40efd1db17290bad453" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PrestaShopCorp/module-lib-cache-directory-provider/zipball/34a577b66a7e52ae16d6f40efd1db17290bad453", - "reference": "34a577b66a7e52ae16d6f40efd1db17290bad453", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "require-dev": { - "phpunit/phpunit": "~5.7" - }, - "type": "project", - "autoload": { - "psr-4": { - "PrestaShop\\ModuleLibCacheDirectoryProvider\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "AFL-3.0" - ], - "authors": [ - { - "name": "PrestaShop SA", - "email": "contact@prestashop.com" - } - ], - "description": "Cache directory provider to use on prestashop modules", - "keywords": [ - "composer", - "modules", - "package", - "prestashop" - ], - "support": { - "issues": "https://github.com/PrestaShopCorp/module-lib-cache-directory-provider/issues", - "source": "https://github.com/PrestaShopCorp/module-lib-cache-directory-provider/tree/master" - }, - "time": "2020-09-08T14:13:23+00:00" - }, { "name": "prestashop/module-lib-guzzle-adapter", "version": "v0.6", @@ -778,59 +475,6 @@ }, "time": "2023-01-11T15:09:56+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" - ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/master" - }, - "time": "2017-02-14T16:28:37+00:00" - }, { "name": "psr/http-message", "version": "1.0.1", @@ -885,32 +529,31 @@ "time": "2016-08-06T14:39:51+00:00" }, { - "name": "psr/log", - "version": "1.1.4", + "name": "ralouphie/getallheaders", + "version": "3.0.3", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=5.6" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" }, + "type": "library", "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } + "files": [ + "src/getallheaders.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -918,138 +561,17 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], + "description": "A polyfill for getallheaders.", "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, - "time": "2021-05-03T11:20:27+00:00" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "support": { - "issues": "https://github.com/ralouphie/getallheaders/issues", - "source": "https://github.com/ralouphie/getallheaders/tree/develop" + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" }, "time": "2019-03-08T08:55:37+00:00" }, - { - "name": "react/promise", - "version": "v2.11.0", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "1a8460931ea36dc5c76838fec5734d55c88c6831" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/1a8460931ea36dc5c76838fec5734d55c88c6831", - "reference": "1a8460931ea36dc5c76838fec5734d55c88c6831", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" - }, - "type": "library", - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "React\\Promise\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" - } - ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "keywords": [ - "promise", - "promises" - ], - "support": { - "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v2.11.0" - }, - "funding": [ - { - "url": "https://opencollective.com/reactphp", - "type": "open_collective" - } - ], - "time": "2023-11-16T16:16:50+00:00" - }, { "name": "sentry/sentry", "version": "1.11.0", @@ -1117,377 +639,6 @@ "source": "https://github.com/getsentry/sentry-php/tree/1.11.0" }, "time": "2020-02-12T18:38:11+00:00" - }, - { - "name": "symfony/config", - "version": "v3.4.47", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", - "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", - "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", - "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", - "support": { - "source": "https://github.com/symfony/config/tree/v3.4.47" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-24T10:57:07+00:00" - }, - { - "name": "symfony/dependency-injection", - "version": "v3.4.47", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "51d2a2708c6ceadad84393f8581df1dcf9e5e84b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/51d2a2708c6ceadad84393f8581df1dcf9e5e84b", - "reference": "51d2a2708c6ceadad84393f8581df1dcf9e5e84b", - "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", - "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", - "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v3.4.47" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-24T10:57:07+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v3.4.47", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e58d7841cddfed6e846829040dca2cca0ebbbbb3", - "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "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", - "support": { - "source": "https://github.com/symfony/filesystem/tree/v3.4.47" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-24T10:57:07+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.19.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b", - "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.19-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-23T09:01:57+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.4.47", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "88289caa3c166321883f67fe5130188ebbb47094" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", - "reference": "88289caa3c166321883f67fe5130188ebbb47094", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/yaml/tree/v3.4.47" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-24T10:57:07+00:00" } ], "packages-dev": [], diff --git a/e2e-env/cloudsync-mock/src/lib/live-sync-api.ts b/e2e-env/cloudsync-mock/src/lib/live-sync-api.ts index ced7c3b2..bce462a2 100644 --- a/e2e-env/cloudsync-mock/src/lib/live-sync-api.ts +++ b/e2e-env/cloudsync-mock/src/lib/live-sync-api.ts @@ -9,7 +9,7 @@ export class LiveSyncApiServer extends Server { res.status(200).end(); }); - this.api.get("/notify/:shopId", (req, res) => { + this.api.post("/notify/:shopId", (req, res) => { const shopId = req.params.shopId; if (shopId.startsWith("valid-shopid-")) { res.status(201).end(); diff --git a/src/Api/CollectorApiClient.php b/src/Api/CollectorApiClient.php index 7a30065e..0a34bb91 100644 --- a/src/Api/CollectorApiClient.php +++ b/src/Api/CollectorApiClient.php @@ -26,13 +26,12 @@ namespace PrestaShop\Module\PsEventbus\Api; -use GuzzleHttp\Psr7\Request; use PrestaShop\Module\PsEventbus\Api\Post\MultipartBody; use PrestaShop\Module\PsEventbus\Api\Post\PostFileApi; use PrestaShop\Module\PsEventbus\Config\Config; use PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService; -use Prestashop\ModuleLibGuzzleAdapter\ClientFactory; -use Prestashop\ModuleLibGuzzleAdapter\Interfaces\HttpClientInterface; +use Symfony\Component\Mime\Part\DataPart; +use Symfony\Component\Mime\Part\Multipart\FormDataPart; if (!defined('_PS_VERSION_')) { exit; @@ -78,25 +77,6 @@ public function __construct($collectorApiUrl, \Ps_eventbus $module, PsAccountsAd $this->collectorApiUrl = $collectorApiUrl; } - /** - * @see https://docs.guzzlephp.org/en/stable/quickstart.html - * @see https://docs.guzzlephp.org/en/stable/request-options.html#read-timeout - * - * @param int $startTime @optional start time in seconds since epoch - * - * @return HttpClientInterface - */ - private function getClient($startTime = null) - { - return (new ClientFactory())->getClient([ - 'allow_redirects' => true, - 'connect_timeout' => 10, - 'http_errors' => false, - 'read_timeout' => 30, - 'timeout' => $this->getRemainingTime($startTime), - ]); - } - /** * Push some ShopContents to CloudSync * @@ -109,73 +89,45 @@ private function getClient($startTime = null) */ public function upload($jobId, $data, $startTime, $fullSyncRequested = null) { + $client = new HttpClientFactory($this->getRemainingTime($startTime)); + $url = $this->collectorApiUrl . '/upload/' . $jobId; - // Prepare request - $file = new PostFileApi('file', $data, 'file'); - $contentSize = $file->getContent()->getSize(); - $multipartBody = new MultipartBody([], [$file], Config::COLLECTOR_MULTIPART_BOUNDARY); - - $response = $this->getClient($startTime)->sendRequest( - new Request( - 'POST', - $url, - [ - 'Accept' => 'application/json', - 'Authorization' => 'Bearer ' . $this->jwt, - 'Content-Length' => $contentSize ? (string) $contentSize : '0', - 'Content-Type' => 'multipart/form-data; boundary=' . Config::COLLECTOR_MULTIPART_BOUNDARY, - 'Full-Sync-Requested' => $fullSyncRequested ? '1' : '0', - 'User-Agent' => 'ps-eventbus/' . $this->module->version, - ], - $multipartBody->getContents() - ) - ); - return [ - 'status' => substr((string) $response->getStatusCode(), 0, 1) === '2', - 'httpCode' => $response->getStatusCode(), - 'body' => json_decode($response->getBody()->getContents(), true), - 'upload_url' => $url, - ]; - } + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '9', '>=')) { + $contentSize = strlen($data); - /** - * Push information about removed ShopContents to CloudSync - * - * @param string $jobId - * @param string $data - * @param int $startTime in seconds since epoch - * - * @return array - */ - public function uploadDelete($jobId, $data, $startTime) - { - $url = $this->collectorApiUrl . '/delete/' . $jobId; - // Prepare request - $file = new PostFileApi('file', $data, 'file'); - $contentSize = $file->getContent()->getSize(); - $multipartBody = new MultipartBody([], [$file], Config::COLLECTOR_MULTIPART_BOUNDARY); - - $response = $this->getClient($startTime)->sendRequest( - new Request( - 'POST', - $url, - [ - 'Accept' => 'application/json', - 'Authorization' => 'Bearer ' . $this->jwt, - 'Content-Length' => $contentSize ? (string) $contentSize : '0', - 'Content-Type' => 'multipart/form-data; boundary=' . Config::COLLECTOR_MULTIPART_BOUNDARY, - 'User-Agent' => 'ps-eventbus/' . $this->module->version, - ], - $multipartBody->getContents() - ) + $formData = new FormDataPart([ + 'file' => new DataPart($data, 'file', 'text/plain') + ]); + + $boundary = $formData->getPreparedHeaders()->getHeaderParameter('content-type', 'boundary'); + } else { + $file = new PostFileApi('file', $data, 'file'); + $contentSize = $file->getContent()->getSize(); + + $boundary = 'ps_eventbus_boundary'; + $formData = new MultipartBody([], [$file], $boundary); + } + + $response = $client->sendRequest( + 'POST', + $url, + [ + 'Accept' => 'application/json', + 'Authorization' => 'Bearer ' . $this->jwt, + 'Content-Length' => $contentSize ? (string) $contentSize : '0', + 'Content-Type' => 'multipart/form-data; boundary=' . $boundary, + 'Full-Sync-Requested' => $fullSyncRequested ? '1' : '0', + 'User-Agent' => 'ps-eventbus/' . $this->module->version, + ], + version_compare(_PS_VERSION_, '9', '>=') ? $formData->bodyToString() : $formData->getContents() ); return [ 'status' => substr((string) $response->getStatusCode(), 0, 1) === '2', 'httpCode' => $response->getStatusCode(), - 'body' => json_decode($response->getBody()->getContents(), true), + 'body' => json_decode($response->getContent(), true), 'upload_url' => $url, ]; } diff --git a/src/Api/HttpClientFactory.php b/src/Api/HttpClientFactory.php new file mode 100644 index 00000000..40d530a8 --- /dev/null +++ b/src/Api/HttpClientFactory.php @@ -0,0 +1,149 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Api; + +use GuzzleHttp\Psr7\Request; +use PrestaShop\Module\PsEventbus\Api\Post\MultipartBody; +use PrestaShop\Module\PsEventbus\Api\Post\PostFileApi; +use Prestashop\ModuleLibGuzzleAdapter\ClientFactory; +use Prestashop\ModuleLibGuzzleAdapter\Interfaces\HttpClientInterface; +use Symfony\Component\HttpClient\Exception\ClientException; +use Symfony\Component\HttpClient\Exception\ServerException; +use Symfony\Component\HttpClient\HttpClient; +use Symfony\Component\Mime\Part\DataPart; +use Symfony\Component\Mime\Part\Multipart\FormDataPart; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class HttpClientFactory +{ + /** + * @var HttpClientInterface|\Symfony\Contracts\HttpClient\HttpClientInterface + */ + private $client; + + /** + * + * @var \Symfony\Contracts\HttpClient\ResponseInterface|\Psr\Http\Message\ResponseInterface + */ + private $response; + + /** + * @param int $timeout + * + * @return HttpClientFactory + */ + public function __construct($timeout) + { + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '9', '>=')) { + $this->client = HttpClient::create(); + } else { + $this->client = (new ClientFactory())->getClient([ + 'allow_redirects' => true, + 'connect_timeout' => 10, + 'http_errors' => false, + 'read_timeout' => 30, + 'timeout' => $timeout, + ]); + } + } + + /** + * Send HTTP Request + * + * @param string|\Psr\Http\Message\RequestInterface $method + * @param string $endpoint + * @param array $headers + * @param array $body + * + * @return self + */ + public function sendRequest($method, $endpoint, $headers = null, $body = null) + { + $params = []; + + // Define $headers to array for Request() class + // Or for Symfony Client + if (is_null($headers)) { + $headers = []; + } else { + $params['headers'] = $headers; + } + + if (!is_null($body)) { + $params['body'] = $body; + } + + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '9', '>=')) { + $params['headers'] = $headers; + + $this->response = $this->client->request( + $method, + $endpoint, + $params + ); + } else { + $this->response = $this->client->sendRequest( + new Request( + $method, + $endpoint, + $headers, + $body + ) + ); + } + + return $this; + } + + /** + * @return string + */ + public function getContent() + { + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '9', '>=')) { + try { + return $this->response->getContent(); + /* } catch (ClientException $e) { + //return '404 - not found'; + } catch(ServerException $e) { + //return '500 - Server error'; */ + } catch (\Exception $e) { + return ''; + } + } else { + return $this->response->getBody()->getContents(); + } + } + + public function getStatusCode() + { + return $this->response->getStatusCode(); + } +} diff --git a/src/Api/LiveSyncApiClient.php b/src/Api/LiveSyncApiClient.php index 6e026698..5179919a 100644 --- a/src/Api/LiveSyncApiClient.php +++ b/src/Api/LiveSyncApiClient.php @@ -26,11 +26,7 @@ namespace PrestaShop\Module\PsEventbus\Api; -use GuzzleHttp\Psr7\Request; -use PrestaShop\Module\PsEventbus\Config\Config; use PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService; -use Prestashop\ModuleLibGuzzleAdapter\ClientFactory; -use Prestashop\ModuleLibGuzzleAdapter\Interfaces\HttpClientInterface; if (!defined('_PS_VERSION_')) { exit; @@ -75,23 +71,6 @@ public function __construct($liveSyncApiUrl, \Ps_eventbus $module, PsAccountsAda $this->liveSyncApiUrl = $liveSyncApiUrl; } - /** - * @see https://docs.guzzlephp.org/en/stable/quickstart.html- - * - * @param int $timeout - * - * @return HttpClientInterface - */ - private function getClient($timeout = Config::SYNC_API_MAX_TIMEOUT) - { - return (new ClientFactory())->getClient([ - 'allow_redirects' => true, - 'connect_timeout' => 5, - 'http_errors' => false, - 'timeout' => $timeout, - ]); - } - /** * @param string $shopContent * @param string $action @@ -103,24 +82,24 @@ public function liveSync($shopContent, $action) // shop content send to the API must be in kebab-case $kebabCasedShopContent = str_replace('_', '-', $shopContent); - $response = $this->getClient(3)->sendRequest( - new Request( - 'POST', - $this->liveSyncApiUrl . '/notify/' . $this->shopId, - [ - 'Accept' => 'application/json', - 'Authorization' => 'Bearer ' . $this->jwt, - 'User-Agent' => 'ps-eventbus/' . $this->module->version, - 'Content-Type' => 'application/json', - ], - '{"shopContents": ["' . $kebabCasedShopContent . '"], "action": "' . $action . '"}' - ) + $client = new HttpClientFactory(3); + + $response = $client->sendRequest( + 'POST', + $this->liveSyncApiUrl . '/notify/' . $this->shopId, + [ + 'Accept' => 'application/json', + 'Authorization' => 'Bearer ' . $this->jwt, + 'User-Agent' => 'ps-eventbus/' . $this->module->version, + 'Content-Type' => 'application/json', + ], + '{"shopContents": ["' . $kebabCasedShopContent . '"], "action": "' . $action . '"}' ); return [ 'status' => substr((string) $response->getStatusCode(), 0, 1) === '2', 'httpCode' => $response->getStatusCode(), - 'body' => $response->getBody(), + 'body' => $response->getContent(), ]; } } diff --git a/src/Api/SyncApiClient.php b/src/Api/SyncApiClient.php index 0e1d0fc5..1a5a3599 100644 --- a/src/Api/SyncApiClient.php +++ b/src/Api/SyncApiClient.php @@ -26,8 +26,6 @@ namespace PrestaShop\Module\PsEventbus\Api; -use GuzzleHttp\Psr7\Request; -use PrestaShop\Module\PsEventbus\Config\Config; use PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService; use Prestashop\ModuleLibGuzzleAdapter\ClientFactory; use Symfony\Component\HttpClient\HttpClient; @@ -74,40 +72,17 @@ public function __construct($syncApiUrl, \Ps_eventbus $module, PsAccountsAdapter */ public function validateJobId($jobId) { - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '9', '>=')) { - $client = HttpClient::create(); + $client = new HttpClientFactory(3); - $response = $client->request( - 'GET', - $this->syncApiUrl . '/job/' . $jobId, - [ - 'headers' => [ - 'Accept' => 'application/json', - 'Authorization' => 'Bearer ' . $this->jwt, - 'User-Agent' => 'ps-eventbus/' . $this->module->version, - ], - ] - ); - } else { - $client = (new ClientFactory())->getClient([ - 'allow_redirects' => true, - 'connect_timeout' => 10, - 'http_errors' => false, - 'timeout' => Config::SYNC_API_MAX_TIMEOUT, - ]); - - $response = $client->sendRequest( - new Request( - 'GET', - $this->syncApiUrl . '/job/' . $jobId, - [ - 'Accept' => 'application/json', - 'Authorization' => 'Bearer ' . $this->jwt, - 'User-Agent' => 'ps-eventbus/' . $this->module->version, - ] - ) - ); - } + $response = $client->sendRequest( + 'GET', + $this->syncApiUrl . '/job/' . $jobId, + [ + 'Accept' => 'application/json', + 'Authorization' => 'Bearer ' . $this->jwt, + 'User-Agent' => 'ps-eventbus/' . $this->module->version, + ] + ); return [ 'status' => substr((string) $response->getStatusCode(), 0, 1) === '2', diff --git a/src/Config/Config.php b/src/Config/Config.php index 27b5a5ab..9375d9b3 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -39,7 +39,6 @@ class Config const INCREMENTAL_TYPE_UPSERT = 'upsert'; const INCREMENTAL_TYPE_DELETE = 'delete'; - const SYNC_API_MAX_TIMEOUT = 5; const SYNC_SERVICE_NAME = 'PrestaShop\Module\PsEventbus\Service\SynchronizationService'; const COLLECTOR_MULTIPART_BOUNDARY = 'ps_eventbus_boundary'; diff --git a/src/Handler/ErrorHandler/ErrorHandler.php b/src/Handler/ErrorHandler/ErrorHandler.php index 41bf2988..0d0ad68d 100644 --- a/src/Handler/ErrorHandler/ErrorHandler.php +++ b/src/Handler/ErrorHandler/ErrorHandler.php @@ -26,7 +26,6 @@ namespace PrestaShop\Module\PsEventbus\Handler\ErrorHandler; -use Exception; use PrestaShop\Module\PsEventbus\Service\CommonService; use PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService; diff --git a/src/Service/ProxyService.php b/src/Service/ProxyService.php index 29fdf4a2..049d355a 100644 --- a/src/Service/ProxyService.php +++ b/src/Service/ProxyService.php @@ -37,7 +37,7 @@ exit; } -class ProxyService implements ProxyServiceInterface +class ProxyService { /** * @var CollectorApiClient @@ -85,28 +85,4 @@ public function upload($jobId, $data, $scriptStartTime, $isFull) return ['error' => $exception->getMessage()]; } } - - /** - * @param string $jobId - * @param array $data - * @param int $scriptStartTime - * - * @return array - * - * @throws EnvVarException - */ - public function delete($jobId, $data, $scriptStartTime) - { - $dataJson = $this->jsonFormatter->formatNewlineJsonString($data); - - try { - $response = $this->eventBusProxyClient->uploadDelete($jobId, $dataJson, $scriptStartTime); - } catch (ClientException $exception) { - $this->errorHandler->handle($exception); - - return ['error' => $exception->getMessage()]; - } - - return $response; - } } diff --git a/src/Service/ProxyServiceInterface.php b/src/Service/ProxyServiceInterface.php deleted file mode 100644 index 3ec8f616..00000000 --- a/src/Service/ProxyServiceInterface.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - */ - -namespace PrestaShop\Module\PsEventbus\Service; - -if (!defined('_PS_VERSION_')) { - exit; -} - -interface ProxyServiceInterface -{ - /** - * @param string $jobId - * @param array $data - * @param int $scriptStartTime - * @param bool $isFull - * - * @return array - */ - public function upload($jobId, $data, $scriptStartTime, $isFull); - - /** - * @param string $jobId - * @param array $data - * @param int $scriptStartTime - * - * @return array - */ - public function delete($jobId, $data, $scriptStartTime); -} diff --git a/src/Service/SynchronizationService.php b/src/Service/SynchronizationService.php index 94125501..1de6319a 100644 --- a/src/Service/SynchronizationService.php +++ b/src/Service/SynchronizationService.php @@ -68,7 +68,7 @@ class SynchronizationService private $languagesService; /** - * @var ProxyServiceInterface + * @var ProxyService */ private $proxyService; @@ -83,7 +83,7 @@ public function __construct( IncrementalSyncRepository $incrementalSyncRepository, LiveSyncRepository $liveSyncRepository, LanguagesService $languagesService, - ProxyServiceInterface $proxyService, + ProxyService $proxyService, ErrorHandler $errorHandler ) { $this->liveSyncApiClient = $liveSyncApiClient; diff --git a/tests/phpstan/phpstan.neon b/tests/phpstan/phpstan.neon index 0211e05d..e999bfa7 100644 --- a/tests/phpstan/phpstan.neon +++ b/tests/phpstan/phpstan.neon @@ -29,7 +29,6 @@ parameters: - '#Cannot call method execute\(\) on mysqli_stmt\|PDOStatement\|false.#' - '#Parameter \#1 \$restriction of method DbQueryCore::where\(\) expects string, int\|string given.#' - '#Method PrestaShop\\Module\\PsEventbus\\Repository\\MerchantConsentRepository::getConsentByShopId\(\) should return array but returns array\|mysqli_result\|PDOStatement\|resource\|false\|null.#' - - '#Property PrestaShop\\Module\\PsEventbus\\Api\\Post\\MultipartBody::\$stream is never read, only written.#' - '#Caught class GuzzleHttp\\Ring\\Exception\\ConnectException not found#' - '#Call to method getMessage\(\) on an unknown class GuzzleHttp\\Ring\\Exception\\ConnectException.#' - '#Parameter \#2 \$type of static method TaxManagerFactoryCore::getManager\(\) expects string, int given.#'