Skip to content

AggregateConfig

github-actions[bot] edited this page Oct 9, 2026 · 3 revisions

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

Methods

__construct

Constructs a new instance by accepting a variadic list of configuration objects.

public __construct(\FastForward\Config\ConfigInterface $configs): mixed

These configuration objects MUST implement the ConfigInterface.

Parameters:

Parameter Type Description
$configs \FastForward\Config\ConfigInterface One or more configuration instances to aggregate.

__invoke

Invokes the configuration aggregator.

public __invoke(): \FastForward\Config\ConfigInterface

This method SHALL merge normalized configuration sources and return an ArrayConfig. Sequential lists SHALL be concatenated in source order, retaining duplicates. Maps SHALL merge recursively, and later scalar values SHALL replace earlier values. It MUST return a fully merged configuration in the form of a ConfigInterface implementation.

Return Value:

the resulting merged configuration object


Inherited methods

__invoke

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


get

Retrieves a configuration value by key.

public get(string $key, mixed|null $default = null): mixed

Parameters:

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


has

Checks for existence of a configuration key.

public has(string $key): bool

Parameters:

Parameter Type Description
$key string the configuration key to check

Return Value:

TRUE if the key exists, FALSE otherwise


set

Sets configuration data.

public set(array|\FastForward\Config\ConfigInterface|string $key, mixed|null $value = null): void

Parameters:

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

remove

Removes a configuration key.

public remove(string $key): void

Parameters:

Parameter Type Description
$key string the configuration key to remove

toArray

Exports the entire configuration to an array.

public toArray(): array

Return Value:

the configuration as an associative array


getIterator

Retrieves an iterator for traversing the configuration data.

public getIterator(): \Traversable

Return Value:

an iterator over the configuration


Clone this wiki locally