| 1 |
<?php |
| 2 |
|
| 3 |
namespace Http\Discovery; |
| 4 |
|
| 5 |
use Http\Client\HttpAsyncClient; |
| 6 |
use Http\Discovery\Exception\DiscoveryFailedException; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
final class HttpAsyncClientDiscovery extends ClassDiscovery |
| 14 |
{ |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
public static function find() |
| 23 |
{ |
| 24 |
try { |
| 25 |
$asyncClient = static::findOneByType(HttpAsyncClient::class); |
| 26 |
} catch (DiscoveryFailedException $e) { |
| 27 |
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); |
| 28 |
} |
| 29 |
|
| 30 |
return static::instantiateClass($asyncClient); |
| 31 |
} |
| 32 |
} |