NullConfig
in package
implements
Config
uses
GetValuesTrait
Provides a black hole configuration that will always return the default values.
Table of Contents
Interfaces
- Config
- Provides a common interface for configuration providers.
Methods
- __construct() : mixed
- getAllValueInfos() : array<string|int, ConfigValueInfo>
- Lists all value informations from this configuration.
- getArray() : array<string|int, mixed>
- Gets an array value.
- getBoolean() : bool
- Gets a single boolean value.
- getFloat() : float
- Gets a single floating point value.
- getInteger() : int
- Gets a single integer value.
- getSeparator() : string
- Gets the separator character used for scoping.
- getString() : string
- Gets a single string value.
- getValueInfo() : ConfigValueInfo|null
- Gets value information for a single item.
- getValueInfos() : array<string|int, ConfigValueInfo>
- Gets value informations for one or more items.
- getValues() : array<string, mixed>
- Format described in {@see Config::getValues}.
- hasValues() : bool
- Checks if configurations contains given names.
- removeValues() : void
- Removes values with given names from the configuration, if writable.
- scopeTo() : Config
- Creates a scoped configuration instance that prepends a prefix to all names.
- setArray() : void
- Sets an array value.
- setBoolean() : void
- Sets a single boolean value.
- setFloat() : void
- Sets a single floating point value.
- setInteger() : void
- Sets a single integer value.
- setString() : void
- Sets a single string value.
- setValues() : void
- Sets multiple values at once using an associative array.
Methods
__construct()
public
__construct() : mixed
getAllValueInfos()
Lists all value informations from this configuration.
public
getAllValueInfos([int $range = 0 ][, int $offset = 0 ]) : array<string|int, ConfigValueInfo>
Parameters
- $range : int = 0
-
Amount of items to take, 0 for all. Must be a positive integer.
- $offset : int = 0
-
Amount of items to skip. Must be a positive integer. Has no effect if $range is 0.
Return values
array<string|int, ConfigValueInfo> —Configuration value infos.
getArray()
Gets an array value.
public
getArray(string $name[, array<string|int, mixed> $default = [] ]) : array<string|int, mixed>
Parameters
- $name : string
-
Name of the value to fetch.
- $default : array<string|int, mixed> = []
-
Default value to fall back on if the value is not present.
Return values
array<string|int, mixed> —Configuration value for $name.
getBoolean()
Gets a single boolean value.
public
getBoolean(string $name[, bool $default = false ]) : bool
Parameters
- $name : string
-
Name of the value to fetch.
- $default : bool = false
-
Default value to fall back on if the value is not present.
Return values
bool —Configuration value for $name.
getFloat()
Gets a single floating point value.
public
getFloat(string $name[, float $default = 0 ]) : float
Parameters
- $name : string
-
Name of the value to fetch.
- $default : float = 0
-
Default value to fall back on if the value is not present.
Return values
float —Configuration value for $name.
getInteger()
Gets a single integer value.
public
getInteger(string $name[, int $default = 0 ]) : int
Parameters
- $name : string
-
Name of the value to fetch.
- $default : int = 0
-
Default value to fall back on if the value is not present.
Return values
int —Configuration value for $name.
getSeparator()
Gets the separator character used for scoping.
public
getSeparator() : string
Return values
string —Separator character.
getString()
Gets a single string value.
public
getString(string $name[, string $default = '' ]) : string
Parameters
- $name : string
-
Name of the value to fetch.
- $default : string = ''
-
Default value to fall back on if the value is not present.
Return values
string —Configuration value for $name.
getValueInfo()
Gets value information for a single item.
public
getValueInfo(string $name) : ConfigValueInfo|null
Parameters
- $name : string
-
Name or names to retrieve.
Return values
ConfigValueInfo|null —Value information, or null if not present.
getValueInfos()
Gets value informations for one or more items.
public
getValueInfos(string|array<string|int, mixed> $names) : array<string|int, ConfigValueInfo>
Parameters
- $names : string|array<string|int, mixed>
-
Name or names to retrieve.
Return values
array<string|int, ConfigValueInfo> —Array with value informations.
getValues()
Format described in {@see Config::getValues}.
public
getValues(array<string|int, string|array<string|int, string>> $specs) : array<string, mixed>
Parameters
- $specs : array<string|int, string|array<string|int, string>>
Tags
Return values
array<string, mixed>hasValues()
Checks if configurations contains given names.
public
hasValues(string|array<string|int, mixed> $names) : bool
An empty $names list will always return true.
Parameters
- $names : string|array<string|int, mixed>
-
Name or names to check for.
Return values
bool —Whether all given names are present or not.
removeValues()
Removes values with given names from the configuration, if writable.
public
removeValues(string|array<string|int, mixed> $names) : void
Parameters
- $names : string|array<string|int, mixed>
-
Name or names to remove.
scopeTo()
Creates a scoped configuration instance that prepends a prefix to all names.
public
scopeTo(string ...$prefix) : Config
Parameters
- $prefix : string
Return values
Config —A scoped configuration instance.
setArray()
Sets an array value.
public
setArray(string $name, array<string|int, mixed> $value) : void
Parameters
- $name : string
-
Name of the value to save.
- $value : array<string|int, mixed>
-
Value to save.
setBoolean()
Sets a single boolean value.
public
setBoolean(string $name, bool $value) : void
Parameters
- $name : string
-
Name of the value to save.
- $value : bool
-
Value to save.
setFloat()
Sets a single floating point value.
public
setFloat(string $name, float $value) : void
Parameters
- $name : string
-
Name of the value to save.
- $value : float
-
Value to save.
setInteger()
Sets a single integer value.
public
setInteger(string $name, int $value) : void
Parameters
- $name : string
-
Name of the value to save.
- $value : int
-
Value to save.
setString()
Sets a single string value.
public
setString(string $name, string $value) : void
Parameters
- $name : string
-
Name of the value to save.
- $value : string
-
Value to save.
setValues()
Sets multiple values at once using an associative array.
public
setValues(array<string|int, mixed> $values) : void
Parameters
- $values : array<string|int, mixed>
-
Values to save.