for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Http\Discovery;
use Http\Client\HttpAsyncClient;
use Http\Discovery\Exception\DiscoveryFailedException;
use Http\Discovery\Exception\NotFoundException;
/**
* Finds an HTTP Asynchronous Client.
*
* @author Joel Wurtz <[email protected]>
*/
final class HttpAsyncClientDiscovery extends ClassDiscovery
{
* Finds an HTTP Async Client.
* @return HttpAsyncClient
* @throws NotFoundException
public static function find()
try {
$asyncClient = static::findOneByType(HttpAsyncClient::class);
// Something like this
if (is_string($asyncClient)) {
return new $asyncClient();
}
return $asyncClient();
} catch (DiscoveryFailedException $e) {
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
);