Skip to content

Commit 91342ba

Browse files
[Notifier] Bring consistency to bridges
1 parent 911ad25 commit 91342ba

File tree

5 files changed

+4
-100
lines changed

5 files changed

+4
-100
lines changed

CHANGELOG.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
CHANGELOG
22
=========
33

4-
6.3
5-
---
6-
7-
* Add `ClickatellOptions` class
8-
94
6.2
105
---
116

ClickatellOptions.php

Lines changed: 0 additions & 61 deletions
This file was deleted.

ClickatellTransport.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ public function __toString(): string
4545
return sprintf('clickatell://%s', $this->getEndpoint());
4646
}
4747

48-
return sprintf('clickatell://%s?from=%s', $this->getEndpoint(), $this->from);
48+
return sprintf('clickatell://%s%s', $this->getEndpoint(), null !== $this->from ? '?from='.$this->from : '');
4949
}
5050

5151
public function supports(MessageInterface $message): bool
5252
{
53-
return $message instanceof SmsMessage && (null === $message->getOptions() || $message->getOptions() instanceof ClickatellOptions);
53+
return $message instanceof SmsMessage;
5454
}
5555

5656
protected function doSend(MessageInterface $message): SentMessage
@@ -61,11 +61,8 @@ protected function doSend(MessageInterface $message): SentMessage
6161

6262
$endpoint = sprintf('https://%s/rest/message', $this->getEndpoint());
6363

64-
$from = $message->getFrom() ?: $this->from ?: '';
65-
66-
$opts = $message->getOptions();
67-
$options = $opts ? $opts->toArray() : [];
68-
$options['from'] = $options['from'] ?? $from;
64+
$options = [];
65+
$options['from'] = $message->getFrom() ?: $this->from;
6966
$options['to'] = $message->getPhone();
7067
$options['text'] = $message->getSubject();
7168

Tests/ClickatellOptionsTest.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

Tests/ClickatellTransportTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Notifier\Bridge\Clickatell\Tests;
1313

1414
use Symfony\Component\HttpClient\MockHttpClient;
15-
use Symfony\Component\Notifier\Bridge\Clickatell\ClickatellOptions;
1615
use Symfony\Component\Notifier\Bridge\Clickatell\ClickatellTransport;
1716
use Symfony\Component\Notifier\Exception\LogicException;
1817
use Symfony\Component\Notifier\Exception\TransportException;
@@ -40,7 +39,6 @@ public static function toStringProvider(): iterable
4039
public static function supportedMessagesProvider(): iterable
4140
{
4241
yield [new SmsMessage('+33612345678', 'Hello!')];
43-
yield [new SmsMessage('+33612345678', 'Hello!', 'from', new ClickatellOptions(['from' => 'foo']))];
4442
}
4543

4644
public static function unsupportedMessagesProvider(): iterable

0 commit comments

Comments
 (0)