Skip to content

Commit

Permalink
Mark as deprecated addDefaultVisitors in builder. Add full changelog …
Browse files Browse the repository at this point in the history
…from 3.0 version.
  • Loading branch information
ZhukV committed Apr 12, 2018
1 parent b6b89e6 commit 2e81a5b
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 6 deletions.
49 changes: 46 additions & 3 deletions CHANGELOG.md
Expand Up @@ -2,12 +2,55 @@

### Features

* Add `JwtSignatureGenerator` for available use any libraries for generating the signature from JWT token.
* Support next libraries:
* Add `JwtSignatureGenerator` for available use any libraries for generating the signature from JWT token. Support next libraries:
* [spomky-labs/jose](https://github.com/Spomky-Labs/jose)
* [web-token/jwt-*](https://www.gitbook.com/book/web-token/jwt-framework)
* Mark as **deprecated** method `Apple\ApnPush\Sender\Builder\Http20Builder::addDefaultVisitors`. This method executed from
the `constructor` of builder. In next minor version, we remove this method.

### Impact

Make changes without impact, all code has a BC. If previously you use `SpomkyLabs`, the factory has been successfully
creating require the generator.
creating require generator.

## v3.0.5

* Fix code for Code Style

## v3.0.4

### Features

* Add lifetime for `JwtAuthenticator`.

## v3.0.3

### Feature

* Add able for getting the protocol from the builder `Apple\ApnPush\Sender\Builder\BuilderInterface::buildProtocol`.
* Add able to close the connection manually `Apple\ApnPush\Protoco\ProtocolInterface::closeConnection`.

### Impact

* The exception `Apple\ApnPush\Protocol\Http\Sender\Exception\CurlException` has been renamed to `Apple\ApnPush\Protocol\Http\Sender\Exception\HttpSenderException`

## v3.0.2

### Feature

* Add `apns-collapse-id` to notification.

## v3.0.1

* Fix code for Code Style

## v3.0.0 (New version of library)

### Feature

* Implement a new version of the library for use HTTP/2 Protocol and work with the strict mode in PHP (>= 7.1)

### Impact to v2.*

* Does not support for migration from `v2.*`.
* Does not support the binary protocol.
2 changes: 0 additions & 2 deletions docs/index.md
Expand Up @@ -24,7 +24,6 @@ $authenticator = new CertificateAuthenticator($certificate);

// Build sender
$builder = new Http20Builder($authenticator);
$builder->addDefaultVisitors();

$sender = $builder->build();
```
Expand Down Expand Up @@ -68,7 +67,6 @@ $authenticator = new CertificateAuthenticator($certificate);

// Build sender
$builder = new Http20Builder($authenticator);
$builder->addDefaultVisitors();

$protocol = $builder->buildProtocol();
$sender = new Sender($protocol);
Expand Down
17 changes: 17 additions & 0 deletions src/Sender/Builder/Http20Builder.php
Expand Up @@ -68,6 +68,11 @@ class Http20Builder implements BuilderInterface
*/
private $exceptionFactory;

/**
* @var bool
*/
private $addedDefaultVisitors;

/**
* Constructor.
*
Expand All @@ -81,6 +86,8 @@ public function __construct(AuthenticatorInterface $authenticator)
$this->payloadEncoder = new PayloadEncoder();
$this->httpSender = new CurlHttpSender();
$this->exceptionFactory = new ExceptionFactory();

$this->addDefaultVisitors();
}

/**
Expand Down Expand Up @@ -116,9 +123,19 @@ public function addVisitor(HttpProtocolVisitorInterface $visitor, int $priority
* Add default visitors
*
* @return Http20Builder
*
* @deprecated This method is deprecated and will be a move to private scope.
* Please do not use this method in your code.
* This method will be called from the constructor of this builder.
*/
public function addDefaultVisitors(): Http20Builder
{
if ($this->addedDefaultVisitors) {
return $this;
}

$this->addedDefaultVisitors = true;

$this->addVisitor(new AddExpirationHeaderVisitor());
$this->addVisitor(new AddPriorityHeaderVisitor());
$this->addVisitor(new AddApnIdHeaderVisitor());
Expand Down
1 change: 0 additions & 1 deletion tests/Sender/Builder/Http20BuilderTest.php
Expand Up @@ -90,7 +90,6 @@ private function prepareBuilderAndCreateProtocol(Http20Builder $builder, Authent
->setHttpSender($httpSender)
->setPayloadEncoder($messageEncoder)
->setUriFactory($uriFactory)
->addDefaultVisitors()
->addVisitor($visitor);

return new HttpProtocol(
Expand Down

0 comments on commit 2e81a5b

Please sign in to comment.