Debian Codegraph @

lib/3rdParty/composer/php-http/discovery/src/HttpClientDiscovery.php

raw symbols SCIP
1 <?php
2
3 namespace Http\Discovery;
4
5 use Http\Client\HttpClient;
6 use Http\Discovery\Exception\DiscoveryFailedException;
7
8 /**
9 * Finds an HTTP Client.
10 *
11 * @author Márk Sági-Kazár <[email protected]om>
12 *
13 * @deprecated This will be removed in 2.0. Consider using Psr18ClientDiscovery.
14 */
15 final class HttpClientDiscovery extends ClassDiscovery
16 {
17 /**
18 * Finds an HTTP Client.
19 *
20 * @return HttpClient
21 *
22 * @throws Exception\NotFoundException
23 */
24 public static function find()
25 {
26 try {
27 $client = static::findOneByType(HttpClient::class);
28 } catch (DiscoveryFailedException $e) {
29 throw new NotFoundException('No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation". Example: "php-http/guzzle6-adapter".', 0, $e);
30 }
31
32 return static::instantiateClass($client);
33 }
34 }