NullTransportFactory.php 861 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Mailer\Transport;
  11. use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
  12. /**
  13. * @author Konstantin Myakshin <molodchick@gmail.com>
  14. */
  15. final class NullTransportFactory extends AbstractTransportFactory
  16. {
  17. public function create(Dsn $dsn): TransportInterface
  18. {
  19. if ('null' === $dsn->getScheme()) {
  20. return new NullTransport($this->dispatcher, $this->logger);
  21. }
  22. throw new UnsupportedSchemeException($dsn, 'null', $this->getSupportedSchemes());
  23. }
  24. protected function getSupportedSchemes(): array
  25. {
  26. return ['null'];
  27. }
  28. }