*** # AggregateContainer Aggregates multiple PSR-11 containers and delegates resolution requests among them. This container implementation respects PSR-11 expectations and throws a NotFoundException when a requested service cannot be found in any delegated container. It caches resolved entries to prevent redundant calls to delegated containers. * Full name: `\FastForward\Container\AggregateContainer` * This class implements: [`\FastForward\Container\ContainerInterface`](./ContainerInterface.md) ## Constants | Constant | Visibility | Type | Value | |:---------|:-----------|:-----|:------| |`ALIAS`|public|string|'container'| ## Methods ### __construct Constructs the AggregateContainer with one or more delegated containers. ```php public __construct(\Psr\Container\ContainerInterface $containers): mixed ``` The constructor SHALL bind itself to common aliases, including the class name and the PSR-11 interface, to simplify resolution of the container itself. **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$containers` | **\Psr\Container\ContainerInterface** | One or more container implementations to aggregate. | *** ### append Appends a container to the end of the aggregated list. ```php public append(\Psr\Container\ContainerInterface $container): void ``` This method MAY be used to dynamically expand the resolution pool. **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$container` | **\Psr\Container\ContainerInterface** | the container to append | *** ### prepend Prepends a container to the beginning of the aggregated list. ```php public prepend(\Psr\Container\ContainerInterface $container): void ``` This method MAY be used to prioritize a container during resolution. **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$container` | **\Psr\Container\ContainerInterface** | the container to prepend | *** ### has Determines whether a service identifier can be resolved. ```php public has(string $id): bool ``` This method SHALL return true if the identifier is pre-resolved or can be located in any of the aggregated containers. **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$id` | **string** | the identifier of the entry to look for | **Return Value:** true if the entry exists, false otherwise *** ### get Retrieves the entry associated with the given identifier. ```php public get(string $id): mixed ``` This method SHALL resolve from its internal cache first, and otherwise iterate through the aggregated containers to resolve the entry. It MUST throw a NotFoundException if the identifier cannot be resolved. **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$id` | **string** | the identifier of the entry to retrieve | **Return Value:** the resolved entry **Throws:**
if the identifier cannot be found in any aggregated container
- [`NotFoundException`](./Exception/NotFoundException.md)if the container cannot resolve the entry
- [`ContainerExceptionInterface`](../../Psr/Container/ContainerExceptionInterface.md) *** *** > Automatically generated on 2025-07-03