-
-
Notifications
You must be signed in to change notification settings - Fork 0
AggregateConfig
Class AggregateConfig.
Represents an aggregated configuration loader that combines multiple configuration sources. This class MUST be used to merge multiple configurations into a single, unified configuration structure.
It SHALL lazily load and resolve configuration data only when invoked.
- Full name:
\FastForward\Config\AggregateConfig - This class is marked as final and can't be subclassed
- This class implements:
\FastForward\Config\ConfigInterface - This class is a Final class
Constructs a new instance by accepting a variadic list of configuration objects.
public __construct(\FastForward\Config\ConfigInterface $configs): mixedThese configuration objects MUST implement the ConfigInterface.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$configs |
\FastForward\Config\ConfigInterface | One or more configuration instances to aggregate. |
Invokes the configuration aggregator.
public __invoke(): \FastForward\Config\ConfigInterfaceThis method SHALL initialize a new ArrayConfig instance and populate it with the values from each provided configuration source. It MUST return a fully merged configuration in the form of a ConfigInterface implementation.
Return Value:
the resulting merged configuration object
Implementing class MUST define the __invoke() method to return a ConfigInterface instance.
public __invoke(): \FastForward\Config\ConfigInterface- This method is abstract. Return Value:
the actual configuration instance
Retrieves a configuration value by key.
public get(string $key, mixed|null $default = null): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string | the configuration key to retrieve |
$default |
mixed|null | the default value if the key is not found |
Return Value:
the value of the configuration key or the default
Checks for existence of a configuration key.
public has(string $key): boolParameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string | the configuration key to check |
Return Value:
TRUE if the key exists, FALSE otherwise
Sets configuration data.
public set(array|\FastForward\Config\ConfigInterface|string $key, mixed|null $value = null): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$key |
array|\FastForward\Config\ConfigInterface|string | the key or set of keys/values to set |
$value |
mixed|null | the value to set if a single key is provided |
Removes a configuration key.
public remove(string $key): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string | the configuration key to remove |
Exports the entire configuration to an array.
public toArray(): arrayReturn Value:
the configuration as an associative array
Retrieves an iterator for traversing the configuration data.
public getIterator(): \TraversableReturn Value:
an iterator over the configuration