PHP Class Voodoo\Core\Config

ファイルを表示 Open project: voodoophp/voodoo Class Usage Examples

Public Methods

Method Description
__callStatic ( type $name, type $args ) : Config Statically load any INI file. IE \Core\INI::Settings()->toArray()
__construct ( string $namespace ) Constructor
arrayToINI ( array $iniArray, integer $indent ) : String. To convert an array into a properly formatted INI file
get ( type $dotNotation = "", type $emptyValue = null ) : Mix Access value of an array with dot notation
getNamespace ( ) : Array Return the namespace data
loadFile ( type $file, type $keyname = "" ) To load an .ini file
namespaceExists ( ) : boolean Check if a namespace exists
save ( type $fileName = "" ) Save the ini file.
set ( array $data, type $keyName = "" ) Set data in the loaded
toArray ( ) : Array Return the INI array

Method Details

__callStatic() public static method

Statically load any INI file. IE \Core\INI::Settings()->toArray()
public static __callStatic ( type $name, type $args ) : Config
$name type
$args type
return Config

__construct() public method

Constructor
public __construct ( string $namespace )
$namespace string - A unique name that will hold data for each set of config

arrayToINI() public static method

To convert an array into a properly formatted INI file
public static arrayToINI ( array $iniArray, integer $indent ) : String.
$iniArray array
$indent integer
return String.

get() public method

Access value of an array with dot notation
public get ( type $dotNotation = "", type $emptyValue = null ) : Mix
$dotNotation type - the key. ie: Key.Field1
$emptyValue type - Use this value if empty
return Mix ie self::get("QA.UpVoteQuestion"); Will return the value of [QA][UpVoteQuestion]

getNamespace() public method

Return the namespace data
public getNamespace ( ) : Array
return Array

loadFile() public method

To load an .ini file
public loadFile ( type $file, type $keyname = "" )
$file type
$keyname type

namespaceExists() public method

Check if a namespace exists
public namespaceExists ( ) : boolean
return boolean

save() public method

ATTENTION: It will remove all comments added. At this time, it's limited to 2 depth
public save ( type $fileName = "" )
$fileName type - The filename without the extension

set() public method

Set data in the loaded
public set ( array $data, type $keyName = "" )
$data array
$keyName type

toArray() public method

Return the INI array
public toArray ( ) : Array
return Array