Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 37b8922

Browse filesBrowse files
PGLongoOskarStark
authored andcommitted
[Notifier] add support for gatewayapi-notifier
1 parent 2a4f97c commit 37b8922
Copy full SHA for 37b8922

19 files changed

+108
-319
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,11 +2237,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
22372237
SendinblueNotifierTransportFactory::class => 'notifier.transport_factory.sendinblue',
22382238
DiscordTransportFactory::class => 'notifier.transport_factory.discord',
22392239
LinkedInTransportFactory::class => 'notifier.transport_factory.linkedin',
2240-
<<<<<<< HEAD
22412240
GatewayApiTransportFactory::class => 'notifier.transport_factory.gatewayapi',
2242-
=======
2243-
GatewayAPITransportFactory::class => 'notifier.transport_factory.gatewayapi',
2244-
>>>>>>> 2575ca2b12 ([Notifier] add support for gatewayapi-notifier)
22452241
];
22462242

22472243
foreach ($classToServices as $class => $service) {

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\Notifier\Bridge\Esendex\EsendexTransportFactory;
1616
use Symfony\Component\Notifier\Bridge\Firebase\FirebaseTransportFactory;
1717
use Symfony\Component\Notifier\Bridge\FreeMobile\FreeMobileTransportFactory;
18-
use Symfony\Component\Notifier\Bridge\GatewayAPI\GatewayAPITransportFactory;
18+
use Symfony\Component\Notifier\Bridge\GatewayApi\GatewayApiTransportFactory;
1919
use Symfony\Component\Notifier\Bridge\GoogleChat\GoogleChatTransportFactory;
2020
use Symfony\Component\Notifier\Bridge\Infobip\InfobipTransportFactory;
2121
use Symfony\Component\Notifier\Bridge\Iqsms\IqsmsTransportFactory;

‎src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Doctrine\DBAL\Driver\AbstractMySQLDriver;
1616
use Doctrine\DBAL\DriverManager;
1717
use Doctrine\DBAL\Schema\Schema;
18+
use Doctrine\DBAL\Version;
1819
use Psr\Cache\CacheItemPoolInterface;
1920
use Symfony\Component\Cache\Adapter\PdoAdapter;
2021
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;

‎src/Symfony/Component/Notifier/Bridge/GatewayAPI/.gitattributes

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GatewayAPI/.gitattributes
-3Lines changed: 0 additions & 3 deletions
This file was deleted.

‎src/Symfony/Component/Notifier/Bridge/GatewayAPI/GatewayAPITransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GatewayAPI/GatewayAPITransport.php
-76Lines changed: 0 additions & 76 deletions
This file was deleted.

‎src/Symfony/Component/Notifier/Bridge/GatewayAPI/GatewayAPITransportFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GatewayAPI/GatewayAPITransportFactory.php
-47Lines changed: 0 additions & 47 deletions
This file was deleted.

‎src/Symfony/Component/Notifier/Bridge/GatewayAPI/LICENSE

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GatewayAPI/LICENSE
-19Lines changed: 0 additions & 19 deletions
This file was deleted.

‎src/Symfony/Component/Notifier/Bridge/GatewayAPI/README.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GatewayAPI/README.md
-26Lines changed: 0 additions & 26 deletions
This file was deleted.

‎src/Symfony/Component/Notifier/Bridge/GatewayAPI/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GatewayAPI/composer.json
-35Lines changed: 0 additions & 35 deletions
This file was deleted.

‎src/Symfony/Component/Notifier/Bridge/GatewayAPI/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GatewayAPI/phpunit.xml.dist
-31Lines changed: 0 additions & 31 deletions
This file was deleted.
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/Tests export-ignore
22
/phpunit.xml.dist export-ignore
3+
/.gitattributes export-ignore
34
/.gitignore export-ignore
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG
2+
=========
3+
4+
5.3.0
5+
-----
6+
7+
* Added the bridge

‎src/Symfony/Component/Notifier/Bridge/GatewayApi/GatewayApiTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GatewayApi/GatewayApiTransport.php
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Component\Notifier\Bridge\GatewayAPI;
12+
namespace Symfony\Component\Notifier\Bridge\GatewayApi;
1313

14-
use Symfony\Component\Notifier\Exception\LogicException;
1514
use Symfony\Component\Notifier\Exception\TransportException;
15+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1616
use Symfony\Component\Notifier\Message\MessageInterface;
1717
use Symfony\Component\Notifier\Message\SentMessage;
1818
use Symfony\Component\Notifier\Message\SmsMessage;
@@ -22,9 +22,10 @@
2222

2323
/**
2424
* @author Piergiuseppe Longo <piergiuseppe.longo@gmail.com>
25-
* @experimental in 5.2
25+
*
26+
* @experimental in 5.3
2627
*/
27-
final class GatewayAPITransport extends AbstractTransport
28+
final class GatewayApiTransport extends AbstractTransport
2829
{
2930
protected const HOST = 'gatewayapi.com';
3031

@@ -41,7 +42,7 @@ public function __construct(string $authToken, string $from, HttpClientInterface
4142

4243
public function __toString(): string
4344
{
44-
return sprintf('gatewaypi://%s?from=%s', $this->getEndpoint(), $this->from);
45+
return sprintf('gatewayapi://%s?from=%s', $this->getEndpoint(), $this->from);
4546
}
4647

4748
public function supports(MessageInterface $message): bool
@@ -52,7 +53,7 @@ public function supports(MessageInterface $message): bool
5253
protected function doSend(MessageInterface $message): SentMessage
5354
{
5455
if (!$message instanceof SmsMessage) {
55-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, get_debug_type($message)));
56+
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
5657
}
5758

5859
$endpoint = sprintf('https://%s/rest/mtsms', $this->getEndpoint());

‎src/Symfony/Component/Notifier/Bridge/GatewayApi/GatewayApiTransportFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GatewayApi/GatewayApiTransportFactory.php
+19-11Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,47 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Component\Notifier\Bridge\GatewayAPI;
12+
namespace Symfony\Component\Notifier\Bridge\GatewayApi;
1313

14+
use Symfony\Component\Notifier\Exception\IncompleteDsnException;
1415
use Symfony\Component\Notifier\Exception\UnsupportedSchemeException;
1516
use Symfony\Component\Notifier\Transport\AbstractTransportFactory;
1617
use Symfony\Component\Notifier\Transport\Dsn;
1718
use Symfony\Component\Notifier\Transport\TransportInterface;
1819

1920
/**
2021
* @author Piergiuseppe Longo <piergiuseppe.longo@gmail.com>
21-
* @experimental in 5.2
22+
*
23+
* @experimental in 5.3
2224
*/
23-
class GatewayAPITransportFactory extends AbstractTransportFactory
25+
final class GatewayApiTransportFactory extends AbstractTransportFactory
2426
{
2527
/**
26-
* @return GatewayAPITransport
28+
* @return GatewayApiTransport
2729
*/
2830
public function create(Dsn $dsn): TransportInterface
2931
{
3032
$scheme = $dsn->getScheme();
31-
$authToken = $dsn->getUser();
32-
$host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
33+
34+
if ('gatewayapi' !== $scheme) {
35+
throw new UnsupportedSchemeException($dsn, 'gatewayapi', $this->getSupportedSchemes());
36+
}
37+
38+
$authToken = $this->getUser($dsn);
3339
$from = $dsn->getOption('from');
34-
$port = $dsn->getPort();
3540

36-
if ('gatewaypi' === $scheme) {
37-
return (new GatewayAPITransport($authToken, $from, $this->client, $this->dispatcher))->setHost($host)->setPort($port);
41+
if (!$from) {
42+
throw new IncompleteDsnException('Missing from.', $dsn->getOriginalDsn());
3843
}
3944

40-
throw new UnsupportedSchemeException($dsn, 'gatewaypi', $this->getSupportedSchemes());
45+
$host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
46+
$port = $dsn->getPort();
47+
48+
return (new GatewayApiTransport($authToken, $from, $this->client, $this->dispatcher))->setHost($host)->setPort($port);
4149
}
4250

4351
protected function getSupportedSchemes(): array
4452
{
45-
return ['gatewaypi'];
53+
return ['gatewayapi'];
4654
}
4755
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.