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 50
__construct(LoaderInterface $loader, string|null $environment = null)

Constructor.

Parameters

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

at line 62
LoaderInterface getLoader()

Returns the config loader.

Return Value

LoaderInterface

at line 72
array getLoadedConfiguration()

Returns the currently loaded configuration.

Return Value

array

at line 82
setEnvironment(string $environment)

Sets the environment.

Parameters

string $environment Environment name

at line 93
protected array parseKey(string $key)

Parses the language key.

Parameters

string $key Language key

Return Value

array

at line 103
protected load(string $file)

Loads the configuration file.

Parameters

string $file File name

at line 115
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 133
set(string $key, mixed $value)

Sets a config value.

Parameters

string $key Config key
mixed $value Config value

at line 151
bool remove(string $key)

Removes a value from the configuration.

Parameters

string $key Config key

Return Value

bool