Core_Config
in package
Module configurations
Tags
Table of Contents
Properties
- $_definedConstants : array<string|int, mixed>
- Defined constants
- $_type : array<string|int, mixed>
- Config types
- $_instance : mixed
- The singleton instance.
- $_values : array<string|int, mixed>
- Loaded values
Methods
- get() : mixed
- Get config, e.g. 'Core_Myconfig' requires modules/core/config/myconfig.php
- getPath() : string
- Get config path
- instance() : object
- Register an existing instance as a singleton.
- replace() : Core_Config
- Replace config without changing config file
- set() : Core_Config
- Set config value
- type() : self
- Set config type, e.g. array('curl')
- _correctName() : string
- Correct config name
- _escape() : mixed
- Escape key or value
- _toString() : string
- Convert value to string
Properties
$_definedConstants
Defined constants
protected
array<string|int, mixed>
$_definedConstants
= array()
$_type
Config types
protected
array<string|int, mixed>
$_type
= array()
$_instance
The singleton instance.
private
static mixed
$_instance
= \NULL
$_values
Loaded values
private
array<string|int, mixed>
$_values
= array()
Methods
get()
Get config, e.g. 'Core_Myconfig' requires modules/core/config/myconfig.php
public
get(mixed $name[, mixed $defaultValue = NULL ]) : mixed
Parameters
- $name : mixed
- $defaultValue : mixed = NULL
Return values
mixed —Config or NULL
// Get config values + default values if necessary value does not exist
$aConfigValues = Core_Config::instance()->get('mymodule_config') + array('foo' => 'baz');
echo $aConfigValues['foo'];
getPath()
Get config path
public
getPath(string $name) : string
Parameters
- $name : string
Return values
stringinstance()
Register an existing instance as a singleton.
public
static instance() : object
Return values
objectreplace()
Replace config without changing config file
public
replace(string $name, array<string|int, mixed> $value) : Core_Config
Parameters
- $name : string
-
Config name, e.g. 'Core_Myconfig' set modules/core/config/myconfig.php
- $value : array<string|int, mixed>
-
Config value, e.g. array('key' => 'value')
Return values
Core_Configset()
Set config value
public
set(string $name, array<string|int, mixed> $value) : Core_Config
Parameters
- $name : string
-
Config name, e.g. 'Core_Myconfig' set modules/core/config/myconfig.php
- $value : array<string|int, mixed>
-
Config value, e.g. array('key' => 'value')
Return values
Core_Config —
Core_Config::instance()->set('mymodule_config', array('foo' => 'bar'));
type()
Set config type, e.g. array('curl')
public
type(array<string|int, mixed> $array) : self
Parameters
- $array : array<string|int, mixed>
Return values
self_correctName()
Correct config name
protected
_correctName(string $name) : string
Parameters
- $name : string
Return values
string_escape()
Escape key or value
protected
_escape(mixed $value) : mixed
Parameters
- $value : mixed
_toString()
Convert value to string
protected
_toString(mixed $value[, $level = 1 ]) : string