ConfigApp
extends Singleton
in package
This class will provide you the quickest access possible to the magrathea.conf config file.
Table of Contents
Properties
- $instance : array<string|int, mixed>|null
- $cache : mixed
- $control : AppConfigControl|null
- $isMocked : bool
- $mockData : array<string|int, mixed>|null
Methods
- __wakeup() : mixed
- Get() : string
- Gets the value by key
- GetBool() : string
- Gets a boolean by key
- GetFloat() : string
- Gets an integer by key
- GetInt() : string
- Gets an integer by key
- Instance() : static|Singleton
- Mock() : ConfigApp
- Mocks data
- MockClass() : static|Singleton
- Save() : AppConfig
- saves a config
- SetInstance() : mixed
- UnMock() : ConfigApp
- unmocks this
- __clone() : mixed
- __construct() : mixed
- GetControl() : AppConfigControl
Properties
$instance
protected
static array<string|int, mixed>|null
$instance
= []
$cache
private
mixed
$cache
= []
$control
private
AppConfigControl|null
$control
= null
$isMocked
private
bool
$isMocked
= false
$mockData
private
array<string|int, mixed>|null
$mockData
= null
Methods
__wakeup()
public
final __wakeup() : mixed
Get()
Gets the value by key
public
Get(string $key[, string|null $default = null ]) : string
Parameters
- $key : string
-
config key
- $default : string|null = null
-
default (optional), if config does not exists
Return values
string —key value
GetBool()
Gets a boolean by key
public
GetBool(string $key[, bool $default = false ]) : string
Parameters
- $key : string
-
config key
- $default : bool = false
-
default (optional), if config does not exists
Return values
string —key value
GetFloat()
Gets an integer by key
public
GetFloat(string $key[, float $default = 0 ]) : string
Parameters
- $key : string
-
config key
- $default : float = 0
-
default (optional), if config does not exists
Return values
string —key value
GetInt()
Gets an integer by key
public
GetInt(string $key[, int $default = 0 ]) : string
Parameters
- $key : string
-
config key
- $default : int = 0
-
default (optional), if config does not exists
Return values
string —key value
Instance()
public
static Instance() : static|Singleton
Return values
static|SingletonMock()
Mocks data
public
Mock(array<string|int, mixed> $data) : ConfigApp
Parameters
- $data : array<string|int, mixed>
-
array for mocking in format ["key" => "value"]
Return values
ConfigApp —itself
MockClass()
public
static MockClass(mixed $mocker) : static|Singleton
Parameters
- $mocker : mixed
Return values
static|SingletonSave()
saves a config
public
Save(string $key, string $value[, bool $overwrite = true ]) : AppConfig
Parameters
- $key : string
-
config key
- $value : string
-
config value
- $overwrite : bool = true
-
should overwrite existing values?
Return values
AppConfig —saved config
SetInstance()
public
SetInstance(mixed $inst) : mixed
Parameters
- $inst : mixed
UnMock()
unmocks this
public
UnMock() : ConfigApp
Return values
ConfigApp —itself
__clone()
protected
final __clone() : mixed
__construct()
private
final __construct() : mixed
GetControl()
private
GetControl() : AppConfigControl