-
Notifications
You must be signed in to change notification settings - Fork 0
AliasFactory
A factory that resolves an alias to another service within a PSR-11 container.
This factory MUST be used when a service should act as an alias for another service already registered in the container.
When invoked, it SHALL delegate resolution to the aliased service identifier.
- Full name:
\FastForward\Container\Factory\AliasFactory
- 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 AliasFactory with the target service identifier.
public __construct(string $alias): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$alias |
string | the identifier of the service to which this factory points |
Resolves the aliased service from the container.
public __invoke(\Psr\Container\ContainerInterface $container): mixed
This method MUST return the same instance as if the original alias identifier were used directly with the container.
Parameters:
Parameter | Type | Description |
---|---|---|
$container |
\Psr\Container\ContainerInterface | the container instance to resolve the alias from |
Return Value:
the resolved service instance
Retrieves or creates a cached AliasFactory for a given alias.
public static get(string $alias): self
This static method SHOULD be used to avoid instantiating multiple factories for the same alias unnecessarily. The same instance will be reused for each alias.
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$alias |
string | the identifier to create or retrieve the factory for |
Return Value:
an AliasFactory instance associated with the provided alias
Automatically generated on 2025-07-03