Open Journal Systems  3.3.0
Http\Discovery\ClassDiscovery Class Reference
Inheritance diagram for Http\Discovery\ClassDiscovery:
Http\Discovery\HttpAsyncClientDiscovery Http\Discovery\HttpClientDiscovery Http\Discovery\MessageFactoryDiscovery Http\Discovery\Psr17FactoryDiscovery Http\Discovery\Psr18ClientDiscovery Http\Discovery\StreamFactoryDiscovery Http\Discovery\UriFactoryDiscovery

Static Public Member Functions

static appendStrategy ($strategy)
 
static clearCache ()
 
static prependStrategy ($strategy)
 
static safeClassExists ($class)
 
static setStrategies (array $strategies)
 

Static Protected Member Functions

static evaluateCondition ($condition)
 
static findOneByType ($type)
 
static instantiateClass ($class)
 

Detailed Description

Registry that based find results on class existence.

Author
David de Boer david.nosp@m.@dde.nosp@m.boer..nosp@m.nl
Márk Sági-Kazár mark..nosp@m.sagi.nosp@m.kazar.nosp@m.@gma.nosp@m.il.co.nosp@m.m
Tobias Nyholm tobia.nosp@m.s.ny.nosp@m.holm@.nosp@m.gmai.nosp@m.l.com

Definition at line 17 of file ClassDiscovery.php.

Member Function Documentation

◆ appendStrategy()

static Http\Discovery\ClassDiscovery::appendStrategy (   $strategy)
static

Append a strategy at the end of the strategy queue.

Parameters
string$strategyFully qualified class name to a DiscoveryStrategy

Definition at line 132 of file ClassDiscovery.php.

References Http\Discovery\ClassDiscovery\clearCache().

◆ clearCache()

static Http\Discovery\ClassDiscovery::clearCache ( )
static

◆ evaluateCondition()

static Http\Discovery\ClassDiscovery::evaluateCondition (   $condition)
staticprotected

Evaluates conditions to boolean.

Parameters
mixed$condition
Returns
bool

Definition at line 164 of file ClassDiscovery.php.

References Http\Discovery\ClassDiscovery\safeClassExists().

◆ findOneByType()

static Http\Discovery\ClassDiscovery::findOneByType (   $type)
staticprotected

Finds a class.

Parameters
string$type
Returns
string|\Closure
Exceptions
DiscoveryFailedException

Definition at line 46 of file ClassDiscovery.php.

References Http\Discovery\Exception\DiscoveryFailedException\create().

◆ instantiateClass()

static Http\Discovery\ClassDiscovery::instantiateClass (   $class)
staticprotected

Get an instance of the $class.

Parameters
string | \Closure$classA FQCN of a class or a closure that instantiate the class.
Returns
object
Exceptions
ClassInstantiationFailedException

Definition at line 199 of file ClassDiscovery.php.

◆ prependStrategy()

static Http\Discovery\ClassDiscovery::prependStrategy (   $strategy)
static

Prepend a strategy at the beginning of the strategy queue.

Parameters
string$strategyFully qualified class name to a DiscoveryStrategy

Definition at line 143 of file ClassDiscovery.php.

References Http\Discovery\ClassDiscovery\clearCache().

◆ safeClassExists()

static Http\Discovery\ClassDiscovery::safeClassExists (   $class)
static

We want to do 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 that file does not exits.

This function will catch all potential exceptions and make sure it returns a boolean.

Parameters
string$class
bool$autoload
Returns
bool

Definition at line 228 of file ClassDiscovery.php.

Referenced by Http\Discovery\ClassDiscovery\evaluateCondition().

◆ setStrategies()

static Http\Discovery\ClassDiscovery::setStrategies ( array  $strategies)
static

Set new strategies and clear the cache.

Parameters
array$strategiesstring array of fully qualified class name to a DiscoveryStrategy

Definition at line 121 of file ClassDiscovery.php.

References Http\Discovery\ClassDiscovery\clearCache().


The documentation for this class was generated from the following file: