minor #39465 [Mailer] [Sendgrid] Use $scheme variable to stay consistent (OskarStark)

This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] [Sendgrid] Use $scheme variable to stay consistent

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | ---
| License       | MIT
| Doc PR        | ---

Its used like this in all other mailer bridges

Commits
-------

1a40d7c75a [Mailer] [Sendgrid] Use $scheme variable to stay consistent
This commit is contained in:
Maxime Steinhausser 2020-12-11 15:13:33 +01:00
commit 278688deeb
1 changed files with 3 additions and 2 deletions

View File

@ -23,16 +23,17 @@ final class SendgridTransportFactory extends AbstractTransportFactory
{
public function create(Dsn $dsn): TransportInterface
{
$scheme = $dsn->getScheme();
$key = $this->getUser($dsn);
if ('sendgrid+api' === $dsn->getScheme()) {
if ('sendgrid+api' === $scheme) {
$host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
$port = $dsn->getPort();
return (new SendgridApiTransport($key, $this->client, $this->dispatcher, $this->logger))->setHost($host)->setPort($port);
}
if ('sendgrid+smtp' === $dsn->getScheme() || 'sendgrid+smtps' === $dsn->getScheme() || 'sendgrid' === $dsn->getScheme()) {
if ('sendgrid+smtp' === $scheme || 'sendgrid+smtps' === $scheme || 'sendgrid' === $scheme) {
return new SendgridSmtpTransport($key, $this->dispatcher, $this->logger);
}