Show:

Q_Config Class

Module: Q

Holds the entire Qbix configuration

Item Index

Methods

Properties

Methods

clear

(
  • $key1
  • $key2
)
static

Clears the value of a configuration field, possibly deep inside the array

Parameters:

  • $key1 String

    The name of the first key in the configuration path

  • $key2 String

    Optional. 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]
)
Boolean static

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 String

    The name of the config file. If config server is defined, file is changed there

  • [$args=null] String | Array optional

    OA 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 optional

    Weather result shall be returned or saved. Shall be of type boolean

Returns:

Boolean:

Wheather data was successfuly cleared. If some key does not exist still true

expect

(
  • $key1
  • $key2
)
Mixed static

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 String

    The name of the first key in the configuration path

  • $key2 String

    Optional. 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:

Mixed:

Only returns non-null values

get

(
  • $key1
  • $key2
  • $default
)
static

Gets the value of a configuration field

Parameters:

  • $key1 String

    The name of the first key in the configuration path

  • $key2 String

    Optional. 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 Mixed

    The 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:

Array:

getFromServer

(
  • $filename
)
Array static

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 String

    The name of the config file. If config server is defined, file is got from there

Returns:

Array:

The loaded tree

load

(
  • $filename
  • $ignoreCache=false
)
Boolean static

Loads a configuration file

Parameters:

  • $filename String

    The filename of the file to load.

  • $ignoreCache=false Boolean

    Defaults 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:

Boolean:

Returns true if saved, otherwise false.

merge

(
  • $second
)
static

Merges parameters over the top of existing parameters

Parameters:

  • $second Array | Q_Tree

    The array or Q_Tree to merge on top of the existing one

save

(
  • $file
  • [$array_path=array()]
)
Boolean static

Saves the configuration to a file

Parameters:

  • $file String

    The file to save into

  • [$array_path=array()] Array optional

    Array of keys identifying the path of the config subtree to save

Returns:

Boolean:

Returns true if saved, otherwise false.

serverInfo

() Mixed static

Check for config server url and return it if found

Returns:

Mixed:

Config server information or false if config server is not defined or points to this server

set

(
  • $key1
  • $key2
  • $value
)
static

Sets the value of a configuration field

Parameters:

  • $key1 String

    The name of the first key in the configuration path

  • $key2 String

    Optional. 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 Mixed

    The last parameter should not be omitted, and contains the value to set the field to.

setOnServer

(
  • $filename
  • $data
  • [$clear=false]
)
Boolean static

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 String

    The name of the config file. If config server is defined, file is changed there

  • $data Array

    The data to merge to the file

  • [$clear=false] Boolean optional

    Weather data shall be merged over or cleared and set

Returns:

Boolean:

Wheather data was successfuly merged in

Properties

$cache

Mixed static

$tree

Q_Tree protected static