class HttpClientDiscovery
Finds an HTTP Client.
@author Márk Sági-Kazár <mark.sagikazar@gmail.com>
Hierarchy
- class \Http\Discovery\ClassDiscovery
- class \Http\Discovery\HttpClientDiscovery extends \Http\Discovery\ClassDiscovery
Expanded class hierarchy of HttpClientDiscovery
Deprecated
This will be removed in 2.0. Consider using Psr18ClientDiscovery.
File
-
vendor/
php-http/ discovery/ src/ HttpClientDiscovery.php, line 15
Namespace
Http\DiscoveryView source
final class HttpClientDiscovery extends ClassDiscovery {
/**
* Finds an HTTP Client.
*
* @return HttpClient
*
* @throws Exception\NotFoundException
*/
public static function find() {
try {
$client = static::findOneByType(HttpClient::class);
} catch (DiscoveryFailedException $e) {
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);
}
return static::instantiateClass($client);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ClassDiscovery::$cache | private static | property | Discovery cache to make the second time we use discovery faster. |
ClassDiscovery::$deprecatedStrategies | private static | property | |
ClassDiscovery::$strategies | private static | property | A list of strategies to find classes. |
ClassDiscovery::appendStrategy | public static | function | Append a strategy at the end of the strategy queue. |
ClassDiscovery::clearCache | public static | function | |
ClassDiscovery::evaluateCondition | protected static | function | Evaluates conditions to boolean. |
ClassDiscovery::findOneByType | protected static | function | Finds a class. |
ClassDiscovery::getFromCache | private static | function | Get a value from cache. |
ClassDiscovery::getStrategies | public static | function | Returns the currently configured discovery strategies as fully qualified class names. |
ClassDiscovery::instantiateClass | protected static | function | Get an instance of the $class. |
ClassDiscovery::prependStrategy | public static | function | Prepend a strategy at the beginning of the strategy queue. |
ClassDiscovery::safeClassExists | public static | function | We need a "safe" version of PHP's "class_exists" because Magento has a bug (or they call it a "feature"). Magento is throwing an exception if you do class_exists() on a class that ends with "Factory" and if… |
ClassDiscovery::setStrategies | public static | function | Set new strategies and clear the cache. |
ClassDiscovery::storeInCache | private static | function | Store a value in cache. |
HttpClientDiscovery::find | public static | function | Finds an HTTP Client. |