Hold configuration form a specified configuration file.

author jorgen
package WebLab

 Methods

Constructs a new instance of WebLab_Config based on a file or an array.

__construct(string | mixed[] $file) 

Parameters

$file

stringmixed[]

Exceptions

\WebLab_Exception_Config If the file could not be found.
\WebLab_Exception_Config If there is an error in the configuration file.

Returns whether a node exists.

exists(string $path) : boolean

Parameters

$path

string

Returns

boolean

Retrieve data from the configuration tree using a '.' delimited path.

get(string $path, string $return_type, $throwError) : mixed

If the resulting value is another branch in the configuration tree, values will be returned according to the optional $return_type parameter. All other values will be returned as the types they were interpreted as.

see \RAW
see OBJECT
see \CONFIG_WRAP

Parameters

$path

string

$return_type

string

$throwError

Exceptions

\WebLab_Exception_Config If the requested node is not available.

Returns

mixed

Return the configuration used by the application.

getApplicationConfig() : \WebLab_Config
Static

This function lazy loads the configuration file.

Returns

Set the path to the configuration file, or set the application config to an instance of WebLab_Config.

setApplicationConfig(string | \WebLab_Config $file) 
Static

Parameters

$file

string\WebLab_Config

 Properties

 

$_application_config : \WebLab_Config

This location of this configuration file should be set at startup of the application.

see \WebLab_Application
see \setApplicationConfig()
 

$_config : mixed[]

 Constants

 

Constant that indicates you want the get function to return the data wrapped in a new instance of WebLab_Config.

CONFIG_WRAP : string
 

Constant that indicates you want the get function to return the data as an object.

OBJECT : string
 

Constant that indicates you want the get function to return RAW data.

RAW : string

In the default implementation this will be an array.