From e23b3d6e13b762d7b517725a66f7351061639494 Mon Sep 17 00:00:00 2001 From: Paramtamtam Date: Thu, 11 Jul 2019 18:06:37 +0500 Subject: [PATCH] v3.1.0 (added two interfaces) --- CHANGELOG.md | 11 +++++++++++ README.md | 2 +- phpunit.xml.dist | 4 ---- src/Client.php | 9 +++------ src/WithEventsHandlerSetterInterface.php | 15 +++++++++++++++ src/WithSettingsInterface.php | 13 +++++++++++++ tests/Unit/ClientTest.php | 4 ++++ 7 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 src/WithEventsHandlerSetterInterface.php create mode 100644 src/WithSettingsInterface.php diff --git a/CHANGELOG.md b/CHANGELOG.md index af6deb1..7d9dd23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver]. +## v3.1.0 + +### Added + +- Interface `WithSettingsInterface` +- Interface `WithEventsHandlerSetterInterface` + +### Changed + +- Class `Client` now implements `WithSettingsInterface` and `WithEventsHandlerSetterInterface` + ## v3.0.0 ### Changed diff --git a/README.md b/README.md index d712f3d..45e3307 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Require this package with composer using the following command: ```shell -$ composer require avtocod/b2b-api-php "^3.0" +$ composer require avtocod/b2b-api-php "^3.1" ``` > Installed `composer` is required ([how to install composer][getcomposer]). diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0dc9b3d..680a5e3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -31,8 +31,4 @@ - - - - diff --git a/src/Client.php b/src/Client.php index e5ac170..99153ec 100644 --- a/src/Client.php +++ b/src/Client.php @@ -8,7 +8,6 @@ use DateTime; use GuzzleHttp\Psr7\Request; use PackageVersions\Versions; -use Tarampampam\Wrappers\Json; use GuzzleHttp\Client as Guzzle; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -26,7 +25,7 @@ use Avtocod\B2BApi\Responses\UserReportTypesResponse; use Avtocod\B2BApi\Responses\UserReportRefreshResponse; -class Client implements ClientInterface +class Client implements ClientInterface, WithSettingsInterface, WithEventsHandlerSetterInterface { protected const TOKEN_PREFIX = 'AR-REST'; @@ -62,9 +61,7 @@ public function __construct(Settings $settings, } /** - * Set events handler. - * - * @param Closure $events_handler + * {@inheritDoc} * * @return $this */ @@ -76,7 +73,7 @@ public function setEventsHandler(Closure $events_handler): self } /** - * @return Settings + * {@inheritDoc} */ public function getSettings(): Settings { diff --git a/src/WithEventsHandlerSetterInterface.php b/src/WithEventsHandlerSetterInterface.php new file mode 100644 index 0000000..63deb73 --- /dev/null +++ b/src/WithEventsHandlerSetterInterface.php @@ -0,0 +1,15 @@ +assertInstanceOf(ClientInterface::class, $this->client); + $this->assertInstanceOf(WithSettingsInterface::class, $this->client); + $this->assertInstanceOf(WithEventsHandlerSetterInterface::class, $this->client); } /**