Class Config
Core configuration: - config files reading: - reading config.ini file by relative path - parsing and typing ini data into stdClass/array by key types - typing ini values into integers, floats, booleans or strings - environment management: - simple environment name detection by comparing server and client ip - environment name detection by config records about computer name or ip
public static
|
|
public static
boolean
|
|
public static
boolean
|
|
public static
boolean
|
|
public static
boolean
|
|
public static
string
|
#
GetEnvironment( )
Get environment name as string, defined by constants: \MvcCore\Config::ENVIRONMENT_ |
public static
|
#
SetEnvironment( $environment = self::ENVIRONMENT_PRODUCTION )
Set environment name as string, defined by constants: \MvcCore\Config::ENVIRONMENT_ |
public static
stdClass|array|boolean
&
|
|
protected static
string
|
|
protected static
string
|
|
public
array|boolean
&
|
#
Load( string $configPath = '', string $environment,… )
Load ini file and return system configuration - load only sections for current environment name - retype all raw string values into array, float, int or boolean - where is possible - retype whole values level into stdClass, if there are no numeric keys |
protected
array
&
|
#
prepareIniDataToParse( array & $rawIniData, string $environment )
Aline all raw ini data to single level array, filtered for only current environment data items. |
protected
string
|
#
detectEnvironmentBySystemConfig( array & $rawIni = array() )
Detect environment name to load proper config sections |
protected
|
#
processIniData( array & $iniData )
Process single level array with dotted keys into tree structure and complete object type switches about tree records to set final stdClasses or arrays |
protected
boolean
|
|
protected
array|float|integer|string
|
#
getTypedValue( string|array $rawValue )
Retype raw ini value into array wth retyped it's own values or to float, int or string |
protected
float|string|integer
|
|
protected
boolean|string
|
string |
ENVIRONMENT_DEVELOPMENT
|
#
'development'
|
string |
ENVIRONMENT_BETA
|
#
'beta'
|
string |
ENVIRONMENT_ALPHA
|
#
'alpha'
|
string |
ENVIRONMENT_PRODUCTION
|
#
'production'
|
public static
string
|
$SystemConfigPath
System config relative path from app root |
#
'/%appPath%/config.ini'
|
protected static
string
|
$environment
Environment name - development, beta, alpha, production |
#
''
|
protected static
stdClass|array|boolean
|
$systemConfig
System config object placed in /App/config.ini |
#
NULL
|
protected static
mixed
|
$booleanValues
Ini file values to convert into booleans |
#
array('yes' => TRUE, 'no' => FALSE, 'true' => TRUE, 'false' => FALSE,)
|
protected
array|stdClass
|
$result
Temporary variable used when ini file is parsed and loaded to store complete result to return |
#
array()
|
protected
array
|
$objectTypes
Temporary variable used when ini file is parsed and loaded, to store information about final retyping. Keys are addresses into result level to by retyped or not, values are arrays. First index in values is boolean to define if result level will be retyped into stdClass or not, second index in values is reference link to object retyped at the end or not. |
#
array()
|