You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
870 B

3 years ago
  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\Translation\Provider;
  11. use Symfony\Component\Translation\Exception\UnsupportedSchemeException;
  12. /**
  13. * @author Mathieu Santostefano <msantostefano@protonmail.com>
  14. *
  15. * @experimental in 5.3
  16. */
  17. final class NullProviderFactory extends AbstractProviderFactory
  18. {
  19. public function create(Dsn $dsn): ProviderInterface
  20. {
  21. if ('null' === $dsn->getScheme()) {
  22. return new NullProvider();
  23. }
  24. throw new UnsupportedSchemeException($dsn, 'null', $this->getSupportedSchemes());
  25. }
  26. protected function getSupportedSchemes(): array
  27. {
  28. return ['null'];
  29. }
  30. }