8000 [Notifier] [OvhCloud] Add "sender" by notFloran · Pull Request #40377 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add setSender to remove bc break
  • Loading branch information
notFloran committed Mar 5, 2021
commit c86d170b7d2752d6947d92d1cae9c87f78aa1b6d
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CHANGELOG
5.3
---

* Add "sender" option to the DSN that allows configuring the sender
* Add `sender` option to the DSN that allows configuring the sender
* The bridge is not marked as `@experimental` anymore

5.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ final class OvhCloudTransport extends AbstractTransport
private $serviceName;
private $sender;

public function __construct(string $applicationKey, string $applicationSecret, string $consumerKey, string $serviceName, string $sender = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
public function __construct(string $applicationKey, string $applicationSecret, string $consumerKey, string $serviceName, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
{
$this->applicationKey = $applicationKey;
$this->applicationSecret = $applicationSecret;
$this->consumerKey = $consumerKey;
$this->serviceName = $serviceName;
$this->sender = $sender;

parent::__construct($client, $dispatcher);
}
Expand All @@ -53,6 +52,13 @@ public function __toString(): string
return sprintf('ovhcloud://%s?consumer_key=%s&service_name=%s', $this->getEndpoint(), $this->consumerKey, $this->serviceName);
}

public function setSender(?string $sender): self
{
$this->sender = $sender;

return $this;
}

public function supports(MessageInterface $message): bool
{
return $message instanceof SmsMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function create(Dsn $dsn): TransportInterface
$host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
$port = $dsn->getPort();

return (new OvhCloudTransport($applicationKey, $applicationSecret, $consumerKey, $serviceName, $sender, $this->client, $this->dispatcher))->setHost($host)->setPort($port);
return (new OvhCloudTransport($applicationKey, $applicationSecret, $consumerKey, $serviceName, $this->client, $this->dispatcher))->setHost($host)->setPort($port)->setSender($sender);
}

protected function getSupportedSchemes(): array
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Notifier/Bridge/OvhCloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DSN example
-----------

```
OVHCLOUD_DSN=ovhcloud://APPLICATION_KEY:APPLICATION_SECRET@default?consumer_key=CONSUMER_KEY&service_name=SERVICE_NAME&SENDER=SENDER
OVHCLOUD_DSN=ovhcloud://APPLICATION_KEY:APPLICATION_SECRET@default?consumer_key=CONSUMER_KEY&s 8000 ervice_name=SERVICE_NAME&sender=SENDER
```

where:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class OvhCloudTransportTest extends TransportTestCase
*/
public function createTransport(?HttpClientInterface $client = null, string $sender = null): TransportInterface
{
return new OvhCloudTransport('applicationKey', 'applicationSecret', 'consumerKey', 'serviceName', $sender, $client ?: $this->createMock(HttpClientInterface::class));
return (new OvhCloudTransport('applicationKey', 'applicationSecret', 'consumerKey', 'serviceName', $client ?: $this->createMock(HttpClientInterface::class)))->setSender($sender);
}

public function toStringProvider(): iterable
Expand Down
0