src/HttpAsyncClientDiscovery.php 1 location
|
@@ 13-36 (lines=24) @@
|
10 |
|
* |
11 |
|
* @author Joel Wurtz <[email protected]> |
12 |
|
*/ |
13 |
|
final class HttpAsyncClientDiscovery extends ClassDiscovery |
14 |
|
{ |
15 |
|
/** |
16 |
|
* Finds an HTTP Async Client. |
17 |
|
* |
18 |
|
* @return HttpAsyncClient |
19 |
|
* |
20 |
|
* @throws Exception\NotFoundException |
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 |
|
} |
33 |
|
|
src/HttpClientDiscovery.php 1 location
|
@@ 13-36 (lines=24) @@
|
10 |
|
* |
11 |
|
* @author Márk Sági-Kazár <[email protected]> |
12 |
|
*/ |
13 |
|
final class HttpClientDiscovery extends ClassDiscovery |
14 |
|
{ |
15 |
|
/** |
16 |
|
* Finds an HTTP Client. |
17 |
|
* |
18 |
|
* @return HttpClient |
19 |
|
* |
20 |
|
* @throws Exception\NotFoundException |
21 |
|
*/ |
22 |
|
public static function find() |
23 |
|
{ |
24 |
|
try { |
25 |
|
$client = static::findOneByType(HttpClient::class); |
26 |
|
} catch (DiscoveryFailedException $e) { |
27 |
|
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); |
28 |
|
} |
29 |
|
|
30 |
|
return static::instantiateClass($client); |
31 |
|
} |
32 |
|
} |
33 |
|
|
src/MessageFactoryDiscovery.php 1 location
|
@@ 15-38 (lines=24) @@
|
12 |
|
* |
13 |
|
* @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery. |
14 |
|
*/ |
15 |
|
final class MessageFactoryDiscovery extends ClassDiscovery |
16 |
|
{ |
17 |
|
/** |
18 |
|
* Finds a Message Factory. |
19 |
|
* |
20 |
|
* @return MessageFactory |
21 |
|
* |
22 |
|
* @throws Exception\NotFoundException |
23 |
|
*/ |
24 |
|
public static function find() |
25 |
|
{ |
26 |
|
try { |
27 |
|
$messageFactory = static::findOneByType(MessageFactory::class); |
28 |
|
} catch (DiscoveryFailedException $e) { |
29 |
|
throw new NotFoundException('No message factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e); |
30 |
|
} |
31 |
|
|
32 |
|
return static::instantiateClass($messageFactory); |
33 |
|
} |
34 |
|
} |
35 |
|
|
src/Psr18ClientDiscovery.php 1 location
|
@@ 13-36 (lines=24) @@
|
10 |
|
* |
11 |
|
* @author Tobias Nyholm <[email protected]> |
12 |
|
*/ |
13 |
|
final class Psr18ClientDiscovery extends ClassDiscovery |
14 |
|
{ |
15 |
|
/** |
16 |
|
* Finds a PSR-18 HTTP Client. |
17 |
|
* |
18 |
|
* @return ClientInterface |
19 |
|
* |
20 |
|
* @throws Exception\NotFoundException |
21 |
|
*/ |
22 |
|
public static function find() |
23 |
|
{ |
24 |
|
try { |
25 |
|
$client = static::findOneByType(ClientInterface::class); |
26 |
|
} catch (DiscoveryFailedException $e) { |
27 |
|
throw new \Http\Discovery\Exception\NotFoundException('No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle6-adapter".', 0, $e); |
28 |
|
} |
29 |
|
|
30 |
|
return static::instantiateClass($client); |
31 |
|
} |
32 |
|
} |
33 |
|
|
src/StreamFactoryDiscovery.php 1 location
|
@@ 15-38 (lines=24) @@
|
12 |
|
* |
13 |
|
* @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery. |
14 |
|
*/ |
15 |
|
final class StreamFactoryDiscovery extends ClassDiscovery |
16 |
|
{ |
17 |
|
/** |
18 |
|
* Finds a Stream Factory. |
19 |
|
* |
20 |
|
* @return StreamFactory |
21 |
|
* |
22 |
|
* @throws Exception\NotFoundException |
23 |
|
*/ |
24 |
|
public static function find() |
25 |
|
{ |
26 |
|
try { |
27 |
|
$streamFactory = static::findOneByType(StreamFactory::class); |
28 |
|
} catch (DiscoveryFailedException $e) { |
29 |
|
throw new NotFoundException('No stream factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e); |
30 |
|
} |
31 |
|
|
32 |
|
return static::instantiateClass($streamFactory); |
33 |
|
} |
34 |
|
} |
35 |
|
|
src/UriFactoryDiscovery.php 1 location
|
@@ 15-38 (lines=24) @@
|
12 |
|
* |
13 |
|
* @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery. |
14 |
|
*/ |
15 |
|
final class UriFactoryDiscovery extends ClassDiscovery |
16 |
|
{ |
17 |
|
/** |
18 |
|
* Finds a URI Factory. |
19 |
|
* |
20 |
|
* @return UriFactory |
21 |
|
* |
22 |
|
* @throws Exception\NotFoundException |
23 |
|
*/ |
24 |
|
public static function find() |
25 |
|
{ |
26 |
|
try { |
27 |
|
$uriFactory = static::findOneByType(UriFactory::class); |
28 |
|
} catch (DiscoveryFailedException $e) { |
29 |
|
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); |
30 |
|
} |
31 |
|
|
32 |
|
return static::instantiateClass($uriFactory); |
33 |
|
} |
34 |
|
} |
35 |
|
|