Class rex_config
Class for handling configurations. The configuration is persisted between
requests.
Methods summary
public static
boolean
|
#
set( string $namespace, string|array $key, mixed $value = null )
Method which saves an arbitary value associated to the given namespace and
key. If the second parameter is an associative array, all key/value pairs will
be saved.
Method which saves an arbitary value associated to the given namespace and
key. If the second parameter is an associative array, all key/value pairs will
be saved.
The set-method returns TRUE when an existing value was overridden, otherwise
FALSE is returned.
Parameters
- $namespace
- The namespace e.g. an addon name
- $key
- The associated key or an associative array of key/value pairs
- $value
- The value to save
Returns
boolean TRUE when an existing value was overridden, otherwise FALSE
Throws
InvalidArgumentException InvalidArgumentException
|
|
public static
mixed
|
#
get( string $namespace, string $key = null, mixed $default = null )
Method which returns an associated value for the given namespace and key. If
$key is null, an array of all key/value pairs for the given namespace will be
returned.
Method which returns an associated value for the given namespace and key. If
$key is null, an array of all key/value pairs for the given namespace will be
returned.
If no value can be found for the given key/namespace combination $default is
returned.
Parameters
- $namespace
- The namespace e.g. an addon name
- $key
- The associated key
- $default
- Default return value if no associated-value can be found
Returns
mixed the value for $key or $default if $key cannot be found in the given $namespace
Throws
InvalidArgumentException InvalidArgumentException
|
|
public static
boolean
|
#
has( string $namespace, string $key = null )
Returns if the given key is set.
Returns if the given key is set.
Parameters
- $namespace
- The namespace e.g. an addon name
- $key
- The associated key
Returns
boolean TRUE if the key is set, otherwise FALSE
Throws
InvalidArgumentException InvalidArgumentException
|
|
public static
boolean
|
#
remove( string $namespace, string $key )
Removes the setting associated with the given namespace and key.
Removes the setting associated with the given namespace and key.
Parameters
- $namespace
- The namespace e.g. an addon name
- $key
- The associated key
Returns
boolean TRUE if the value was found and removed, otherwise FALSE
Throws
InvalidArgumentException InvalidArgumentException
|
|
public static
boolean
|
#
removeNamespace( string $namespace )
Removes all settings associated with the given namespace.
Removes all settings associated with the given namespace.
Parameters
- $namespace
- The namespace e.g. an addon name
Returns
boolean TRUE if the namespace was found and removed, otherwise FALSE
Throws
InvalidArgumentException InvalidArgumentException
|
|
public static
|
#
refresh( )
Refreshes rex_config by reloading config from db.
Refreshes rex_config by reloading config from db.
|
|
protected static
|
#
init( )
initilizes the rex_config class.
initilizes the rex_config class.
|
|
protected static
|
|
|
public static
|
#
save( )
persists the config-data and truncates the file-cache.
persists the config-data and truncates the file-cache.
|
|