StreamFactoryDiscovery
extends ClassDiscovery
in package
Finds a Stream Factory.
This will be removed in 2.0. Consider using Psr17FactoryDiscovery.
Tags
Table of Contents
Methods
- appendStrategy() : mixed
- Append a strategy at the end of the strategy queue.
- clearCache() : mixed
- find() : StreamFactory
- Finds a Stream Factory.
- 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.
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
find()
Finds a Stream Factory.
public
static find() : StreamFactory
Tags
Return values
StreamFactorygetStrategies()
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