Config
in package
Table of Contents
- $fallback : Config|null
- $settings : array<string|int, mixed>
- __construct() : mixed
- Constructor.
- get() : mixed
- Get a setting.
- has() : bool
- Check if an item exists by key.
- set() : $this
- Set a setting.
- setFallback() : $this
- Set the fallback.
- getDefault() : mixed
- Try to retrieve a default setting from a config fallback.
Properties
$fallback
protected
Config|null
$fallback
$settings
protected
array<string|int, mixed>
$settings
= []
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $settings = [] ]) : mixed
Parameters
- $settings : array<string|int, mixed> = []
Return values
mixed —get()
Get a setting.
public
get(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
Return values
mixed —config setting or default when not found
has()
Check if an item exists by key.
public
has(string $key) : bool
Parameters
- $key : string
Return values
bool —set()
Set a setting.
public
set(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$this —setFallback()
Set the fallback.
public
setFallback(Config $fallback) : $this
Parameters
- $fallback : Config
Return values
$this —getDefault()
Try to retrieve a default setting from a config fallback.
protected
getDefault(string $key, mixed $default) : mixed
Parameters
- $key : string
- $default : mixed
Return values
mixed —config setting or default when not found