-
-
Notifications
You must be signed in to change notification settings - Fork 0
ConfigInterface
Interface ConfigInterface.
Defines the contract for configuration storage and access. Implementing classes MUST support key-based configuration retrieval, nested data export, and mutation in a standardized format.
This interface SHALL extend the IteratorAggregate interface to allow iteration.
Keys MAY use dot notation to access nested structures, e.g., my.next.key
corresponds to ['my' => ['next' => ['key' => $value]]].
- Full name:
\FastForward\Config\ConfigInterface - Parent interfaces:
IteratorAggregate,ArrayAccess
Determines if the specified key exists in the configuration.
public has(string $key): boolDot notation MAY be used to check nested keys.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string | the configuration key to check |
Return Value:
TRUE if the key exists, FALSE otherwise
Retrieves a value from the configuration by key.
public get(string $key, mixed $default = null): mixedDot notation MAY be used to access nested keys. If the key does not exist, the provided default value MUST be returned. Implementations MAY return complex nested structures or objects.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string | the configuration key to retrieve |
$default |
mixed | the default value if the key is not present |
Return Value:
the value associated with the key or the default
Sets a configuration value or merges an array or ConfigInterface.
public set(array|self|string $key, mixed|null $value = null): voidDot notation MAY be used to set values into nested structures. The method MUST support:
- Setting a single key/value pair.
- Merging an entire associative array.
- Merging another ConfigInterface instance.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key |
array|self|string | a configuration key, an array, or another ConfigInterface |
$value |
mixed|null | the value to assign, if a key is provided |
Removes a configuration key and its associated value.
public remove(string $key): voidDot notation MAY be used to specify nested keys. If the key does not exist, this method MUST do nothing.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key |
string | the configuration key to remove |
Exports the configuration as a nested associative array.
public toArray(): arrayImplementations MUST return a deep array representation of all configuration data.
Return Value:
the full configuration array