Class LamiasConfigAggregatorConfig.
Description
Integrates Laminas\ConfigAggregator for collecting configuration data from multiple providers. This class MUST support optional caching of the merged configuration using a defined file path. It SHALL return an ArrayConfig with the aggregated data upon invocation.
Interfaces
Properties
Methods
Constructs the configuration aggregator.
Aggregates configuration from the provided sources and returns a unified configuration object.
Retrieves a configuration value by key.
Retrieves an iterator for traversing the configuration data.
Checks for existence of a configuration key.
Removes a configuration key.
Sets configuration data.
Exports the entire configuration to an array.
Retrieves or initializes the configuration instance.
private
string|null
$cachedConfigFile
=
null
private
ConfigInterface|null
$config
=
null
Description
holds the loaded configuration instance
private
iterable<string|int, mixed>
$providers
Constructs the configuration aggregator.
public
__construct(
iterable<string|int, mixed>
$providers[,
string|null
$cachedConfigFile = null]) : mixed
Description
This constructor SHALL accept a set of configuration providers and an optional cache file path. Providers MUST be iterable and yield valid configuration arrays.
Parameters
$providers
:
iterable<string|int, mixed>
Description
the configuration providers for aggregation
$cachedConfigFile
:
string|null
=
null
Description
the optional path to a cached config file
Aggregates configuration from the provided sources and returns a unified configuration object.
public
__invoke() : ConfigInterface
Description
If a cached config file is provided and exists, it SHALL be used to hydrate the result. Otherwise, all providers SHALL be executed to merge configurations.
Return values
Description
the resulting configuration object as an ArrayConfig instance
Retrieves a configuration value by key.
public
get(
string
$key[,
mixed|null
$default = null]) : mixed
Parameters
$key
:
string
Description
the configuration key to retrieve
$default
:
mixed|null
=
null
Description
the default value if the key is not found
Return values
Description
the value of the configuration key or the default
Retrieves an iterator for traversing the configuration data.
public
getIterator() : Traversable
Return values
Description
an iterator over the configuration
Checks for existence of a configuration key.
public
has(
string
$key) : bool
Parameters
$key
:
string
Description
the configuration key to check
Return values
Description
TRUE if the key exists, FALSE otherwise
Removes a configuration key.
public
remove(
string
$key) : void
Parameters
$key
:
string
Description
the configuration key to remove
Sets configuration data.
public
set(
array<string|int, mixed>|ConfigInterface|string
$key[,
mixed|null
$value = null]) : void
Parameters
Description
the key or set of keys/values to set
$value
:
mixed|null
=
null
Description
the value to set if a single key is provided
Exports the entire configuration to an array.
public
toArray() : array<string|int, mixed>
Return values
Description
the configuration as an associative array
Retrieves or initializes the configuration instance.
private
getConfig() : ConfigInterface
Return values
Description
the lazily-loaded configuration object