Documentation

MessageFactoryDiscovery extends ClassDiscovery
in package

FinalYes

Finds a Message Factory.

This will be removed in 2.0. Consider using Psr17FactoryDiscovery.

Tags
author

Márk Sági-Kazár mark.sagikazar@gmail.com

Table of Contents

Methods

appendStrategy()  : mixed
Append a strategy at the end of the strategy queue.
clearCache()  : mixed
find()  : MessageFactory
Finds a Message 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

getStrategies()

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
bool

setStrategies()

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
bool

findOneByType()

Finds a class.

protected static findOneByType(string $type) : string|Closure
Parameters
$type : string
Tags
throws
DiscoveryFailedException
Return values
string|Closure

instantiateClass()

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
throws
ClassInstantiationFailedException
Return values
object

        
On this page

Search results