trait TransportServiceFactoryTrait
A trait containing helper methods for transport service construction.
Hierarchy
- trait \Drupal\Core\Mailer\TransportServiceFactoryTrait
File
-
core/
lib/ Drupal/ Core/ Mailer/ TransportServiceFactoryTrait.php, line 14
Namespace
Drupal\Core\MailerView source
trait TransportServiceFactoryTrait {
/**
* A list of transport factories.
*
* @var Iterable<TransportFactoryInterface>
*/
protected iterable $factories;
/**
* Constructs a transport instance given a DSN object.
*
* @param \Symfony\Component\Mailer\Transport\Dsn $dsn
* The mailer DSN object.
*
* @throws \Symfony\Component\Mailer\Exception\IncompleteDsnException
* @throws \Symfony\Component\Mailer\Exception\UnsupportedSchemeException
*/
protected function fromDsnObject(Dsn $dsn) : TransportInterface {
foreach ($this->factories as $factory) {
if ($factory->supports($dsn)) {
return $factory->create($dsn);
}
}
throw new UnsupportedSchemeException($dsn);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
TransportServiceFactoryTrait::$factories | protected | property | A list of transport factories. |
TransportServiceFactoryTrait::fromDsnObject | protected | function | Constructs a transport instance given a DSN object. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.