8000 feature #35688 [Notifier] Simplify OVH implementation (fabpot) · symfony/symfony@3fb89ef · GitHub
[go: up one dir, main page]

Skip to content

Commit 3fb89ef

Browse files
committed
feature #35688 [Notifier] Simplify OVH implementation (fabpot)
This PR was merged into the 5.1-dev branch. Discussion ---------- [Notifier] Simplify OVH implementation | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | n/a <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | n/a <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too.) - Features and deprecations must be submitted against branch master. --> Commits ------- 39f9ac2 [Notifier] Simplify OVH implementation
2 parents 5150fc5 + 39f9ac2 commit 3fb89ef

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/Symfony/Component/Notifier/Bridge/OvhCloud/OvhCloudTransport.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
*/
2727
final class OvhCloudTransport extends AbstractTransport
2828
{
29-
private $endpoints = [
30-
'ovh-eu' => 'https://eu.api.ovh.com/1.0',
31-
];
29+
protected const HOST = 'eu.api.ovh.com';
3230

3331
private $applicationKey;
3432
private $applicationSecret;
@@ -45,13 +43,6 @@ public function __construct(string $applicationKey, string $applicationSecret, s
4543
parent::__construct($client, $dispatcher);
4644
}
4745

48-
public function setEndpointName(?string $endpoint): self
49-
{
50-
$this->host = $this->endpoints[$endpoint] ?: self::HOST;
51-
52-
return $this;
53-
}
54-
5546
public function __toString(): string
5647
{
5748
return sprintf('ovhcloud://%s?consumer_key=%s&service_name=%s', $this->getEndpoint(), $this->consumerKey, $this->serviceName);
@@ -68,7 +59,7 @@ protected function doSend(MessageInterface $message): void
6859
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, \get_class($message)));
6960
}
7061

71-
$endpoint = sprintf('%s/sms/%s/jobs', $this->getEndpoint(), $this->serviceName);
62+
$endpoint = sprintf('https://%s/1.0/sms/%s/jobs', 8000 $this->getEndpoint(), $this->serviceName);
7263

7364
$content = [
7465
'charset' => 'UTF-8',

src/Symfony/Component/Notifier/Bridge/OvhCloud/OvhCloudTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function create(Dsn $dsn): TransportInterface
3434
$port = $dsn->getPort();
3535

3636
if ('ovhcloud' === $scheme) {
37-
return (new OvhCloudTransport($applicationKey, $applicationSecret, $consumerKey, $serviceName, $this->client, $this->dispatcher))->setEndpointName($host)->setPort($port);
37+
return (new OvhCloudTransport($applicationKey, $applicationSecret, $consumerKey, $serviceName, $this->client, $this->dispatcher))->setHost($host)->setPort($port);
3838
}
3939

4040
throw new UnsupportedSchemeException($dsn, 'ovhcloud', $this->getSupportedSchemes());

0 commit comments

Comments
 (0)
0