class Config

Config class.

Properties

protected LoaderInterface $loader Loader.
protected string $environment Environment name.
protected array $configuration Configuration.

Methods

__construct(LoaderInterface $loader, string|null $environment = null)

Constructor.

getLoader()

Returns the config loader.

array
getLoadedConfiguration()

Returns the currently loaded configuration.

setEnvironment(string $environment)

Sets the environment.

array
parseKey(string $key)

Parses the language key.

load(string $file)

Loads the configuration file.

mixed
get(string $key, mixed $default = null)

Returns config value or entire config array from a file.

set(string $key, mixed $value)

Sets a config value.

bool
remove(string $key)

Removes a value from the configuration.

Details

at line 48
__construct(LoaderInterface $loader, string|null $environment = null)

Constructor.

Parameters

LoaderInterface $loader Config loader
string|null $environment Environment name

at line 60
LoaderInterface getLoader()

Returns the config loader.

Return Value

LoaderInterface

at line 70
array getLoadedConfiguration()

Returns the currently loaded configuration.

Return Value

array

at line 80
setEnvironment(string $environment)

Sets the environment.

Parameters

string $environment Environment name

at line 91
protected array parseKey(string $key)

Parses the language key.

Parameters

string $key Language key

Return Value

array

at line 101
protected load(string $file)

Loads the configuration file.

Parameters

string $file Filename

at line 113
mixed get(string $key, mixed $default = null)

Returns config value or entire config array from a file.

Parameters

string $key Config key
mixed $default Default value to return if config value doesn't exist

Return Value

mixed

at line 131
set(string $key, mixed $value)

Sets a config value.

Parameters

string $key Config key
mixed $value Config value

at line 149
bool remove(string $key)

Removes a value from the configuration.

Parameters

string $key Config key

Return Value

bool