Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Psr18ClientDiscovery.php

class Psr18ClientDiscovery

Finds a PSR-18 HTTP Client.

@author Tobias Nyholm <tobias.nyholm@gmail.com>

Hierarchy

  • class \Http\Discovery\ClassDiscovery
    • class \Http\Discovery\Psr18ClientDiscovery extends \Http\Discovery\ClassDiscovery

Expanded class hierarchy of Psr18ClientDiscovery

3 files declare their use of Psr18ClientDiscovery
Discovery.php in vendor/open-telemetry/sdk/Common/Http/Psr/Client/Discovery.php
PsrClientResolver.php in vendor/open-telemetry/sdk/Common/Adapter/HttpDiscovery/PsrClientResolver.php
PsrTransportFactory.php in vendor/open-telemetry/sdk/Common/Export/Http/PsrTransportFactory.php

File

vendor/php-http/discovery/src/Psr18ClientDiscovery.php, line 14

Namespace

Http\Discovery
View source
final class Psr18ClientDiscovery extends ClassDiscovery {
    
    /**
     * Finds a PSR-18 HTTP Client.
     *
     * @return ClientInterface
     *
     * @throws RealNotFoundException
     */
    public static function find() {
        try {
            $client = static::findOneByType(ClientInterface::class);
        } catch (DiscoveryFailedException $e) {
            throw new RealNotFoundException('No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle7-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 &quot;safe&quot; version of PHP&#039;s &quot;class_exists&quot; because Magento has a bug
(or they call it a &quot;feature&quot;). Magento is throwing an exception if you do class_exists()
on a class that ends with &quot;Factory&quot; and if…
ClassDiscovery::setStrategies public static function Set new strategies and clear the cache.
ClassDiscovery::storeInCache private static function Store a value in cache.
Psr18ClientDiscovery::find public static function Finds a PSR-18 HTTP Client.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal