vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php line 30

Open in your IDE?
  1. <?php
  2. namespace Http\Discovery;
  3. use Http\Client\HttpAsyncClient;
  4. use Http\Discovery\Exception\DiscoveryFailedException;
  5. /**
  6. * Finds an HTTP Asynchronous Client.
  7. *
  8. * @author Joel Wurtz <joel.wurtz@gmail.com>
  9. */
  10. final class HttpAsyncClientDiscovery extends ClassDiscovery
  11. {
  12. /**
  13. * Finds an HTTP Async Client.
  14. *
  15. * @return HttpAsyncClient
  16. *
  17. * @throws Exception\NotFoundException
  18. */
  19. public static function find()
  20. {
  21. try {
  22. $asyncClient = static::findOneByType(HttpAsyncClient::class);
  23. } catch (DiscoveryFailedException $e) {
  24. throw new NotFoundException('No HTTPlug async clients found. Make sure to install a package providing "php-http/async-client-implementation". Example: "php-http/guzzle6-adapter".', 0, $e);
  25. }
  26. return static::instantiateClass($asyncClient);
  27. }
  28. }