FactoryDefinitionHelper
in package
implements
DefinitionHelper
Helps defining how to create an instance of a class using a factory (callable).
Tags
Table of Contents
Interfaces
- DefinitionHelper
- Helps defining container entries.
Properties
- $decorate : bool
- $factory : callable
- $parameters : array<string|int, mixed>
Methods
- __construct() : mixed
- getDefinition() : FactoryDefinition
- parameter() : $this
- Defines arguments to pass to the factory.
Properties
$decorate
private
bool
$decorate
$factory
private
callable
$factory
$parameters
private
array<string|int, mixed>
$parameters
= []
Methods
__construct()
public
__construct(callable|array<string|int, mixed>|string $factory[, bool $decorate = false ]) : mixed
Parameters
- $factory : callable|array<string|int, mixed>|string
- $decorate : bool = false
-
Is the factory decorating a previous definition?
getDefinition()
public
getDefinition(string $entryName) : FactoryDefinition
Parameters
- $entryName : string
-
Container entry name
Return values
FactoryDefinitionparameter()
Defines arguments to pass to the factory.
public
parameter(string $parameter, mixed $value) : $this
Because factory methods do not yet support attributes or autowiring, this method should be used to define all parameters except the ContainerInterface and RequestedEntry.
Multiple calls can be made to the method to override individual values.
Parameters
- $parameter : string
-
Name or index of the parameter for which the value will be given.
- $value : mixed
-
Value to give to this parameter.