Psr17FactoryDiscovery
extends ClassDiscovery
in package
Finds PSR-17 factories.
Tags
Table of Contents
Methods
- appendStrategy() : mixed
- Append a strategy at the end of the strategy queue.
- clearCache() : mixed
- findRequestFactory() : RequestFactoryInterface
- findResponseFactory() : ResponseFactoryInterface
- findServerRequestFactory() : ServerRequestFactoryInterface
- findStreamFactory() : StreamFactoryInterface
- findUploadedFileFactory() : UploadedFileFactoryInterface
- findUriFactory() : UriFactoryInterface
- findUrlFactory() : UriFactoryInterface
- getStrategies() : array<string|int, string>
- Returns the currently configured discovery strategies as fully qualified class names.
- prependStrategy() : mixed
- Prepend a strategy at the beginning of the strategy queue.
- safeClassExists() : bool
- 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 that file does not exits.
- setStrategies() : mixed
- Set new strategies and clear the cache.
- evaluateCondition() : bool
- Evaluates conditions to boolean.
- findOneByType() : string|Closure
- Finds a class.
- instantiateClass() : object
- Get an instance of the $class.
- createException() : mixed
Methods
appendStrategy()
Append a strategy at the end of the strategy queue.
public
static appendStrategy(string $strategy) : mixed
Parameters
- $strategy : string
-
Fully qualified class name of a DiscoveryStrategy
clearCache()
public
static clearCache() : mixed
findRequestFactory()
public
static findRequestFactory() : RequestFactoryInterface
Tags
Return values
RequestFactoryInterfacefindResponseFactory()
public
static findResponseFactory() : ResponseFactoryInterface
Tags
Return values
ResponseFactoryInterfacefindServerRequestFactory()
public
static findServerRequestFactory() : ServerRequestFactoryInterface
Tags
Return values
ServerRequestFactoryInterfacefindStreamFactory()
public
static findStreamFactory() : StreamFactoryInterface
Tags
Return values
StreamFactoryInterfacefindUploadedFileFactory()
public
static findUploadedFileFactory() : UploadedFileFactoryInterface
Tags
Return values
UploadedFileFactoryInterfacefindUriFactory()
public
static findUriFactory() : UriFactoryInterface
Tags
Return values
UriFactoryInterfacefindUrlFactory()
public
static findUrlFactory() : UriFactoryInterface
This will be removed in 2.0. Consider using the findUriFactory() method.
Tags
Return values
UriFactoryInterfacegetStrategies()
Returns the currently configured discovery strategies as fully qualified class names.
public
static getStrategies() : array<string|int, string>
Return values
array<string|int, string>prependStrategy()
Prepend a strategy at the beginning of the strategy queue.
public
static prependStrategy(string $strategy) : mixed
Parameters
- $strategy : string
-
Fully qualified class name to a DiscoveryStrategy
safeClassExists()
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 that file does not exits.
public
static safeClassExists(string $class) : bool
This function catches all potential exceptions and makes sure to always return a boolean.
Parameters
- $class : string
Return values
boolsetStrategies()
Set new strategies and clear the cache.
public
static setStrategies(array<string|int, string> $strategies) : mixed
Parameters
- $strategies : array<string|int, string>
-
list of fully qualified class names that implement DiscoveryStrategy
evaluateCondition()
Evaluates conditions to boolean.
protected
static evaluateCondition(mixed $condition) : bool
Parameters
- $condition : mixed
Return values
boolfindOneByType()
Finds a class.
protected
static findOneByType(string $type) : string|Closure
Parameters
- $type : string
Tags
Return values
string|ClosureinstantiateClass()
Get an instance of the $class.
protected
static instantiateClass(string|Closure $class) : object
Parameters
- $class : string|Closure
-
a FQCN of a class or a closure that instantiate the class
Tags
Return values
objectcreateException()
private
static createException(mixed $type, Exception $e) : mixed
Parameters
- $type : mixed
- $e : Exception