Magrathea PHP 2

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 = []

$mockData

private array<string|int, mixed>|null $mockData = null

Methods

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

Mock()

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

Save()

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

__construct()

private final __construct() : mixed

        
On this page

Search results