Vars_Manager __construct(
[integer
$gc_maxlifetime = 1440]
)
|
|
Constructor
Parameters:
|
integer |
$gc_maxlifetime: |
Maximum life time for variables after which will be seen as garbage. |
void add_var(
string
$var_name,
&$value, any
$value
)
|
|
Adds new variable. Shortcut for register_var() and set_var()
Parameters:
|
string |
$var_name: |
|
|
any |
$value: |
must be a variable not reference. Use temporary variables if needed. |
|
|
&$value: |
|
API Tags:
void garbage_collector(
)
|
|
Collects the garbage.
Normally this function is not called directly by the user.
API Tags:
any &get_var(
string
$var_name
)
|
|
Gets variable as reference. Use this function if you intend to change the value.
If variable is not found - throws exception.
Parameters:
API Tags:
| Return: | rvalue is eturned as reference |
| Access: | public |
Information Tags:
| Throws: | TE_Var_Not_Exists |
boolean is_var_registered(
string
$var_name
)
|
|
Checks if variable with name provided by $var_name exists.
Parameters:
API Tags:
any query_var(
string
$var_name
)
|
|
Query variable. Similar to get_var() but returns copy of the variable, not reference. Use this function instead of get_var() if you are not intending to change the value.
If variable is not found - throws exception.
Parameters:
API Tags:
Information Tags:
| Throws: | TE_Var_Not_Exists |
void register_var(
string
$var_name, [boolean
$expires = true]
)
|
|
Registers variable. You have first to register variable before using Vars_Manager::set_var()
Parameters:
|
string |
$var_name: |
|
|
boolean |
$expires: |
- if false variable will be never seen as garbage. Default is true. |
API Tags:
void remove_var(
string
$var_name
)
|
|
Removes/unregisters variable.
If variable is not found - throws exception.
Parameters:
API Tags:
Information Tags:
| Throws: | TE_Var_Not_Exists |
void set_var(
string
$var_name,
&$value, any
$value
)
|
|
Sets variable.
Variable must be already registered - if not - throws exception.
Parameters:
|
string |
$var_name: |
|
|
any |
$value: |
|
|
|
&$value: |
|
API Tags:
Information Tags:
| Throws: | TE_Var_Not_Exists |