class Config implements ArrayAccess, Countable

Config.

$config = new \Soli\Config($arrayConfig);

Methods

__construct(array $arrayConfig = null)

Config constructor.

offsetExists($index)

var_dump(isset($config['database']));

offsetGet($index)

var_dump($config['database']);

offsetSet($index, $value)

$config['database'] = [ 'host' => '127.0.0.1', 'port' => '3306', ]

offsetUnset($index)

unset($config['cacheDir']);

count()

echo count($config); echo $config->count();

set($index, $value)

$config->set('database', [ 'host' => '127.0.0.1', 'port' => '3306', ]); $config->set('database.host', '192.168.1.100'); $config->set('database.dbname', 'demo');

get($index, $defaultValue = null)

print_r($config->get('database')); print_r($config->get('database.host', '192.168.1.100'));

toArray()

var_dump($config->toArray());

static 
__set_state($data)

var_export($config);

Details

at line 19
__construct(array $arrayConfig = null)

Config constructor.

Parameters

array $arrayConfig

at line 31
offsetExists($index)

var_dump(isset($config['database']));

Parameters

$index

at line 39
offsetGet($index)

var_dump($config['database']);

Parameters

$index

at line 50
offsetSet($index, $value)

$config['database'] = [ 'host' => '127.0.0.1', 'port' => '3306', ]

Parameters

$index
$value

at line 62
offsetUnset($index)

unset($config['cacheDir']);

Parameters

$index

at line 71
count()

echo count($config); echo $config->count();

at line 84
set($index, $value)

$config->set('database', [ 'host' => '127.0.0.1', 'port' => '3306', ]); $config->set('database.host', '192.168.1.100'); $config->set('database.dbname', 'demo');

Parameters

$index
$value

at line 108
get($index, $defaultValue = null)

print_r($config->get('database')); print_r($config->get('database.host', '192.168.1.100'));

Parameters

$index
$defaultValue

at line 141
toArray()

var_dump($config->toArray());

at line 161
static __set_state($data)

var_export($config);

Parameters

$data