LamiasConfigAggregatorConfig

Class

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.

Table of Contents

Interfaces

ConfigInterface

Interface ConfigInterface.

Properties

 : string|null
 : iterable<string|int, mixed>

Methods

__construct()

Constructs the configuration aggregator.

 : mixed
__invoke()

Aggregates configuration from the provided sources and returns a unified configuration object.

 : ConfigInterface
get()

Retrieves a configuration value by key.

 : mixed
getIterator()

Retrieves an iterator for traversing the configuration data.

 : Traversable
has()

Checks for existence of a configuration key.

 : bool
remove()

Removes a configuration key.

 : void
set()

Sets configuration data.

 : void
toArray()

Exports the entire configuration to an array.

 : array<string|int, mixed>
getConfig()

Retrieves or initializes the configuration instance.

 : ConfigInterface
Properties
Methods

__construct()

Public

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

__invoke()

Public

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

get()

Public

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

getIterator()

Public

Retrieves an iterator for traversing the configuration data.

public getIterator() : Traversable
Return values
Traversable

Description

an iterator over the configuration

has()

Public

Checks for existence of a configuration key.

public has( string  $key) : bool
Parameters
$key : string

Description

the configuration key to check

Return values
bool

Description

TRUE if the key exists, FALSE otherwise

remove()

Public

Removes a configuration key.

public remove( string  $key) : void
Parameters
$key : string

Description

the configuration key to remove

set()

Public

Sets configuration data.

public set( array<string|int, mixed>|ConfigInterface|string  $key[, mixed|null  $value = null]) : void
Parameters
$key : array<string|int, mixed>|ConfigInterface|string

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

toArray()

Public

Exports the entire configuration to an array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

Description

the configuration as an associative array