| Methods |
public
|
readConfig(string|array<int, string> $files = ['config.php'], string $format = 'php'): $this
Read config file or files and store it in $config property.
Read config file or files and store it in $config property.
Supported formats:
php - PHP file with return ['foo' => 'bar'] structure
json - JSON file with { 'foo': 'bar' } structure
yaml - YAML file with yaml structure
Parameters
| $files |
One or more filenames
|
| $format |
Optional format for config files
|
|
#
|
public
|
setConfig(string|array<string, mixed> $paths = [], ($paths is array ? never : mixed) $value = null): $this
Manually set configuration option.
Manually set configuration option.
Parameters
| $paths |
Path to configuration element to set or array of [path => value]
|
| $value |
Value to set
|
|
#
|
public
|
getConfig(string $path, mixed $defaultValue = null): mixed
Get configuration element.
Get configuration element.
Parameters
| $path |
path to configuration element
|
| $defaultValue |
Default value returned if element don't exist
|
|
#
|
private
&
|
_lookupConfigElement(string $path, bool $createElements = false): mixed|false
Internal method to lookup config element by given path.
Internal method to lookup config element by given path.
Parameters
| $path |
Path to navigate to
|
| $createElements |
Should we create elements it they don't exist
|
Returns
Pointer to element in $this->config or false is element don't exist and $createElements === false
|
#
|