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

Breadcrumb

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

class UriFactoryDiscovery

Finds a URI Factory.

@author David de Boer <david@ddeboer.nl>

Hierarchy

  • class \Http\Discovery\ClassDiscovery
    • class \Http\Discovery\UriFactoryDiscovery extends \Http\Discovery\ClassDiscovery

Expanded class hierarchy of UriFactoryDiscovery

Deprecated

This will be removed in 2.0. Consider using Psr17FactoryDiscovery.

File

vendor/php-http/discovery/src/UriFactoryDiscovery.php, line 15

Namespace

Http\Discovery
View source
final class UriFactoryDiscovery extends ClassDiscovery {
    
    /**
     * Finds a URI Factory.
     *
     * @return UriFactory
     *
     * @throws Exception\NotFoundException
     */
    public static function find() {
        try {
            $uriFactory = static::findOneByType(UriFactory::class);
        } catch (DiscoveryFailedException $e) {
            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);
        }
        return static::instantiateClass($uriFactory);
    }

}

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.
UriFactoryDiscovery::find public static function Finds a URI Factory.

API Navigation

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