AssemblerFactory
Attempts to retrieve an Assembler for the provided criteria.
Table of Contents
Properties
Methods
- createDefault() : self
- get() : AssemblerInterface<TParamDescriptor, TParamInput>|null
- Retrieves a matching Assembler based on the provided criteria or null if none was found.
- register() : void
- Registers an assembler instance to this factory.
- registerFallback() : void
- Registers an assembler instance to this factory that is to be executed after all other assemblers have been checked.
Properties
$assemblers
protected
AssemblerMatcher[]
$assemblers
= []
$fallbackAssemblers
protected
AssemblerMatcher[]
$fallbackAssemblers
= []
Methods
createDefault()
public
static createDefault(ExampleFinder $exampleFinder) : self
Parameters
- $exampleFinder : ExampleFinder
Return values
selfget()
Retrieves a matching Assembler based on the provided criteria or null if none was found.
public
get(TParamInput $criteria, class-string $type) : AssemblerInterface<TParamDescriptor, TParamInput>|null
Parameters
- $criteria : TParamInput
-
$type
: class-string
Tags
Return values
AssemblerInterface<TParamDescriptor, TParamInput>|nullregister()
Registers an assembler instance to this factory.
public
register(Matcher<string|int, object> $matcher, AssemblerInterface<Descriptor, object> $assembler) : void
Parameters
- $matcher : Matcher<string|int, object>
-
A callback function accepting the criteria as only parameter and which must return a boolean.
- $assembler : AssemblerInterface<Descriptor, object>
-
An instance of the Assembler that will be returned if the callback returns true with the provided criteria.
registerFallback()
Registers an assembler instance to this factory that is to be executed after all other assemblers have been checked.
public
registerFallback(Matcher<string|int, object> $matcher, AssemblerInterface<Descriptor, object> $assembler) : void
Parameters
- $matcher : Matcher<string|int, object>
-
A callback function accepting the criteria as only parameter and which must return a boolean.
- $assembler : AssemblerInterface<Descriptor, object>
-
An instance of the Assembler that will be returned if the callback returns true with the provided criteria.