Q_Config Class
Holds the entire Qbix configuration
Item Index
Methods
- clear static
- clearOnServer static
- expect static
- get static
- getAll static
- getFromServer static
- load static
- merge static
- save static
- serverInfo static
- set static
- setOnServer static
Methods
clear
-
$key1
-
$key2
Clears the value of a configuration field, possibly deep inside the array
Parameters:
-
$key1
StringThe name of the first key in the configuration path
-
$key2
StringOptional. The name of the second key in the configuration path. You can actually pass as many keys as you need, delving deeper and deeper into the configuration structure. All but the second-to-last parameter are interpreted as keys.
clearOnServer
-
$filename
-
[$args=null]
-
[$noSave=false]
Modify a config file by clearing some data Config file is searched in APP_DIR/files forder. If config server url is defined the filename is searched on config server
Parameters:
-
$filename
StringThe name of the config file. If config server is defined, file is changed there
-
[$args=null]
String | Array optionalOA key or an array of keys for traversing the tree. If keys are not supplied the file is cleared If all-but-last keys point to plain array, last key is interpreted as a member of that array and only this array member is removed If all-but-last keys point to associative array (A) and last key is plain array (B) all keys from array A which are in array B are unset
-
[$noSave=false]
Boolean optionalWeather result shall be returned or saved. Shall be of type boolean
Returns:
Wheather data was successfuly cleared. If some key does not exist still true
expect
-
$key1
-
$key2
Gets the value of a configuration field. If it is null or not set, throws an exception. Otherwise, it is guaranteed to return a non-null value.
Parameters:
-
$key1
StringThe name of the first key in the configuration path
-
$key2
StringOptional. The name of the second key in the configuration path. You can actually pass as many keys as you need, delving deeper and deeper into the configuration structure. All but the second-to-last parameter are interpreted as keys.
Returns:
Only returns non-null values
get
-
$key1
-
$key2
-
$default
Gets the value of a configuration field
Parameters:
-
$key1
StringThe name of the first key in the configuration path
-
$key2
StringOptional. The name of the second key in the configuration path. You can actually pass as many keys as you need, delving deeper and deeper into the configuration structure. All but the second-to-last parameter are interpreted as keys.
-
$default
MixedThe last parameter should not be omitted, and contains the default value to return in case the requested configuration field was not indicated.
getAll
()
Array
static
Gets the array of all parameters
Returns:
getFromServer
-
$filename
Get contents of config file Config file is searched in APP_DIR/files forder. If config server url is defined the filename is searched on config server
Parameters:
-
$filename
StringThe name of the config file. If config server is defined, file is got from there
Returns:
The loaded tree
load
-
$filename
-
$ignoreCache=false
Loads a configuration file
Parameters:
-
$filename
StringThe filename of the file to load.
-
$ignoreCache=false
BooleanDefaults to false. If true, then this function ignores the cached value, if any, and attempts to search for the file. It will cache the new value.
Returns:
Returns true if saved, otherwise false.
merge
-
$second
Merges parameters over the top of existing parameters
Parameters:
-
$second
Array | Q_TreeThe array or Q_Tree to merge on top of the existing one
save
-
$file
-
[$array_path=array()]
Saves the configuration to a file
Parameters:
-
$file
StringThe file to save into
-
[$array_path=array()]
Array optionalArray of keys identifying the path of the config subtree to save
Returns:
Returns true if saved, otherwise false.
serverInfo
()
Mixed
static
Check for config server url and return it if found
Returns:
Config server information or false if config server is not defined or points to this server
set
-
$key1
-
$key2
-
$value
Sets the value of a configuration field
Parameters:
-
$key1
StringThe name of the first key in the configuration path
-
$key2
StringOptional. The name of the second key in the configuration path. You can actually pass as many keys as you need, delving deeper and deeper into the configuration structure. All but the second-to-last parameter are interpreted as keys.
-
$value
MixedThe last parameter should not be omitted, and contains the value to set the field to.
setOnServer
-
$filename
-
$data
-
[$clear=false]
Modify a config file by merging over new data Config file is searched in APP_DIR/files forder. If config server url is defined the filename is searched on config server
Parameters:
-
$filename
StringThe name of the config file. If config server is defined, file is changed there
-
$data
ArrayThe data to merge to the file
-
[$clear=false]
Boolean optionalWeather data shall be merged over or cleared and set
Returns:
Wheather data was successfuly merged in