minor #33787 [Mailer] Tweak some code (fabpot)
This PR was merged into the 4.4 branch.
Discussion
----------
[Mailer] Tweak some code
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | n/a
| License | MIT
| Doc PR | n/a
Tweaks from the Notifier PR.
Commits
-------
ab094c02eb
[Mailer] Tweak some code
This commit is contained in:
commit
11da6f6eea
@ -35,7 +35,7 @@ class RoundRobinTransport implements TransportInterface
|
|||||||
public function __construct(array $transports, int $retryPeriod = 60)
|
public function __construct(array $transports, int $retryPeriod = 60)
|
||||||
{
|
{
|
||||||
if (!$transports) {
|
if (!$transports) {
|
||||||
throw new TransportException(__CLASS__.' must have at least one transport configured.');
|
throw new TransportException(sprintf('"%s" must have at least one transport configured.', static::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->transports = $transports;
|
$this->transports = $transports;
|
||||||
@ -58,9 +58,7 @@ class RoundRobinTransport implements TransportInterface
|
|||||||
|
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return $this->getNameSymbol().'('.implode(' ', array_map(function (TransportInterface $transport) {
|
return $this->getNameSymbol().'('.implode(' ', array_map('strval', $this->transports)).')';
|
||||||
return (string) $transport;
|
|
||||||
}, $this->transports)).')';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,7 @@ use Symfony\Component\Mime\RawMessage;
|
|||||||
/**
|
/**
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
*/
|
*/
|
||||||
class Transports implements TransportInterface
|
final class Transports implements TransportInterface
|
||||||
{
|
{
|
||||||
private $transports;
|
private $transports;
|
||||||
private $default;
|
private $default;
|
||||||
@ -64,6 +64,6 @@ class Transports implements TransportInterface
|
|||||||
|
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return 'all';
|
return '['.implode(',', array_keys($this->transports)).']';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user