AssemblerFactory
in package
Attempts to retrieve an Assembler for the provided criteria.
Table of Contents
- $assemblers : array<string|int, AssemblerMatcher>
- $fallbackAssemblers : array<string|int, AssemblerMatcher>
- 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
array<string|int, AssemblerMatcher>
$assemblers
= []
$fallbackAssemblers
protected
array<string|int, AssemblerMatcher>
$fallbackAssemblers
= []
Methods
createDefault()
public
static createDefault(ExampleFinder $exampleFinder) : self
Parameters
- $exampleFinder : ExampleFinder
Return values
self —get()
Retrieves a matching Assembler based on the provided criteria or null if none was found.
public
get(TParamInput $criteria, class-string<\phpDocumentor\Descriptor\Builder\TParamDescriptor> $type) : AssemblerInterface<TParamDescriptor, TParamInput>|null
Parameters
- $criteria : TParamInput
- $type : class-string<\phpDocumentor\Descriptor\Builder\TParamDescriptor>
Tags
Return values
AssemblerInterface<TParamDescriptor, TParamInput>|null —register()
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.
Return values
void —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.