-
Notifications
You must be signed in to change notification settings - Fork 0
ServiceFactory
Felipe Sayão Lobato Abreu edited this page Jul 3, 2025
·
2 revisions
This factory wraps a predefined service instance and returns it directly upon invocation.
It SHALL be used when a fixed service object must be registered in a container using a factory interface.
The returned value MUST be the exact same instance provided at construction.
This ensures immutability and predictable resolution.
- Full name:
\FastForward\Container\Factory\ServiceFactory
- This class is marked as final and can't be subclassed
- This class implements:
\FastForward\Container\Factory\FactoryInterface
- This class is a Final class
Constructs the factory with a fixed service instance.
public __construct(mixed $service): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$service |
mixed | the service instance to be returned by the factory |
Returns the fixed service instance.
public __invoke(\Psr\Container\ContainerInterface $container): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$container |
\Psr\Container\ContainerInterface | the container instance (ignored in this context) |
Return Value:
the predefined service instance
Automatically generated on 2025-07-03