Skip to content

Commit

Permalink
v3.1.0 (added two interfaces)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paramtamtam committed Jul 11, 2019
1 parent cde12e5 commit e23b3d6
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 11 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]).
Expand Down
4 changes: 0 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,4 @@
<log type="coverage-clover" target="./coverage/clover.xml"/>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
</logging>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_DEBUG" value="true"/>
</php>
</phpunit>
9 changes: 3 additions & 6 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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';

Expand Down Expand Up @@ -62,9 +61,7 @@ public function __construct(Settings $settings,
}

/**
* Set events handler.
*
* @param Closure $events_handler
* {@inheritDoc}
*
* @return $this
*/
Expand All @@ -76,7 +73,7 @@ public function setEventsHandler(Closure $events_handler): self
}

/**
* @return Settings
* {@inheritDoc}
*/
public function getSettings(): Settings
{
Expand Down
15 changes: 15 additions & 0 deletions src/WithEventsHandlerSetterInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Avtocod\B2BApi;

use Closure;

interface WithEventsHandlerSetterInterface
{
/**
* Set events handler.
*
* @param Closure $events_handler
*/
public function setEventsHandler(Closure $events_handler);
}
13 changes: 13 additions & 0 deletions src/WithSettingsInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Avtocod\B2BApi;

interface WithSettingsInterface
{
/**
* Get client settings object.
*
* @return Settings
*/
public function getSettings(): Settings;
}
4 changes: 4 additions & 0 deletions tests/Unit/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Avtocod\B2BApi\Tests;

use Avtocod\B2BApi\WithSettingsInterface;
use Avtocod\B2BApi\WithEventsHandlerSetterInterface;
use DateTime;
use Avtocod\B2BApi\Client;
use Avtocod\B2BApi\Settings;
Expand Down Expand Up @@ -68,6 +70,8 @@ protected function setUp(): void
public function testImplementations(): void
{
$this->assertInstanceOf(ClientInterface::class, $this->client);
$this->assertInstanceOf(WithSettingsInterface::class, $this->client);
$this->assertInstanceOf(WithEventsHandlerSetterInterface::class, $this->client);
}

/**
Expand Down

0 comments on commit e23b3d6

Please sign in to comment.