Config_Loader __construct(
mutable
$config_resource
)
|
|
It is supposed loading of the configuration from external resource as file or DB to be performed at construction time of Config_Loader objects.
That means that when you createn new instance of Config_Loader class (some descendant of Config_Loader that is not "abstract") your configuration will be loaded and you can use get_conf_value method to extract values.
Parameters:
|
mutable |
$config_resource: |
Intended to be mutable type, i.e. different Config_Loader descendants may require different paramter type. |
API Tags:
Redefined in descendants as:
void add_pair(
string
$key, string
$value
)
|
|
Adds new key-value pair
Parameters:
|
string |
$key: |
|
|
string |
$value: |
|
API Tags:
string expand(
string
$value, string
$current_key
)
|
|
Expands keys that are present in values
If key starts with _AUTO a global function will be called to return the value. Name of the global function have to be strtolower($key) where $key is the key to be expanded. Example: If we have in machine_specific.conf the following: ROOT=%_AUTO_DETECT_ROOT% function with name _auto_detect_root will be called and returned value will be used to replace %_AUTO_DETECT_ROOT%
Parameters:
|
string |
$value: |
|
|
string |
$current_key: |
|
API Tags:
string extract_key(
string
$value, integer
$start
)
|
|
Extracts single key that start at position $start in string $value
Parameters:
|
string |
$value: |
|
|
integer |
$start: |
|
API Tags:
| Internal: | |
| Access: | private |
array extract_keys(
string
$value
)
|
|
Extracts all keys (delimited by % from both sides)
Parameters:
API Tags:
| Internal: | |
| Access: | private |
unknown get_conf_value(
string
$key, [boolean
$halt_on_missing = true]
)
|
|
Gets coresponding to $key configuration value.
Parameters:
|
boolean |
$halt_on_missing: |
if true exception will be trown if configuration setting specified by $key |
|
string |
$key: |
key name of configuration setting |
API Tags:
Information Tags:
| Throws: | TE_Config_Loader_Error_Key_Missing |
Returns all key-value pairs
API Tags:
void set_pairs(
array
$pairs
)
|
|
Auxiliary method that may be used to set the internal private $pairs variable.
This method normally is not called directly - it is intended to be used by writers of new Config_Loader descendants that require weird approach.
Parameters:
|
array |
$pairs: |
Array must be simple associative array with $key => $value structure. |
API Tags:
Information Tags: