vendor/php-http/discovery/src/UriFactoryDiscovery.php line 27

Open in your IDE?
  1. <?php
  2. namespace Http\Discovery;
  3. use Http\Discovery\Exception\DiscoveryFailedException;
  4. use Http\Message\UriFactory;
  5. /**
  6. * Finds a URI Factory.
  7. *
  8. * @author David de Boer <david@ddeboer.nl>
  9. *
  10. * @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery.
  11. */
  12. final class UriFactoryDiscovery extends ClassDiscovery
  13. {
  14. /**
  15. * Finds a URI Factory.
  16. *
  17. * @return UriFactory
  18. *
  19. * @throws Exception\NotFoundException
  20. */
  21. public static function find()
  22. {
  23. try {
  24. $uriFactory = static::findOneByType(UriFactory::class);
  25. } catch (DiscoveryFailedException $e) {
  26. throw new NotFoundException('No uri factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e);
  27. }
  28. return static::instantiateClass($uriFactory);
  29. }
  30. }