API Services IConfigService - chsxf/mfx GitHub Wiki
IConfigService Interface
interface IConfigService
Summary
Configuration service interface
Since 2.0
Constants
public const DEFAULT_DOMAIN = '__default';
Since 2.0
Methods
getValue
public abstract function getValue(string $property, mixed $default = null, ?string $domain = null): mixed
Gets the value of a configuration property
Since 2.0
Parameters
Name | Type | Description |
---|---|---|
$property |
string |
Name of the propery |
$default |
mixed |
Default value if the property does not exist in the loaded configuration (Defaults to NULL) |
$domain |
`string | null` |
Returns
mixed
hasValue
public abstract function hasValue(string $property, ?string $domain = null): bool
Determines if a property has been loaded in the configuration
Since 2.0
Parameters
Name | Type | Description |
---|---|---|
$property |
string |
Name of the propery |
$domain |
`string | null` |
Returns
bool
true if the property exists in the loaded configuration, false either
load
public abstract function load(Config $configData, string $domain = 'self::DEFAULT_DOMAIN')
Loads configuration properties
Since 2.0
Parameters
Name | Type | Description |
---|---|---|
$configData |
Config |
Config data |
$domain |
string |
Domain name |
tryGetValue
public abstract function tryGetValue(string $property, mixed &$outValue, ?string $domain = null): bool
Tries to get the value of a configuration property
Since 2.0
Parameters
Name | Type | Description |
---|---|---|
$property |
string |
Name of the propery |
$outValue |
mixed |
Reference to the variable containing the property value if existing |
$domain |
`string | null` |
Returns
bool
true if the property exists in the loaded configuration, or false either