\rex_config

Class for handling configurations.

The configuration is persisted between requests.

Summary

Methods
Properties
Constants
set()
get()
has()
remove()
removeNamespace()
refresh()
save()
No public properties found
No constants found
init()
load()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

set()

set(string  $namespace, string|array  $key, mixed  $value = null) : bool

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

string $namespace

The namespace e.g. an addon name

string|array $key

The associated key or an associative array of key/value pairs

mixed $value

The value to save

Throws

\InvalidArgumentException

Returns

bool —

TRUE when an existing value was overridden, otherwise FALSE

get()

get(string  $namespace, string|null  $key = null, mixed  $default = null) : mixed

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

string $namespace

The namespace e.g. an addon name

string|null $key

The associated key

mixed $default

Default return value if no associated-value can be found

Throws

\InvalidArgumentException

Returns

mixed —

the value for $key or $default if $key cannot be found in the given $namespace

has()

has(string  $namespace, string|null  $key = null) : bool

Returns if the given key is set.

Parameters

string $namespace

The namespace e.g. an addon name

string|null $key

The associated key

Throws

\InvalidArgumentException

Returns

bool —

TRUE if the key is set, otherwise FALSE

remove()

remove(string  $namespace, string  $key) : bool

Removes the setting associated with the given namespace and key.

Parameters

string $namespace

The namespace e.g. an addon name

string $key

The associated key

Throws

\InvalidArgumentException

Returns

bool —

TRUE if the value was found and removed, otherwise FALSE

removeNamespace()

removeNamespace(string  $namespace) : bool

Removes all settings associated with the given namespace.

Parameters

string $namespace

The namespace e.g. an addon name

Throws

\InvalidArgumentException

Returns

bool —

TRUE if the namespace was found and removed, otherwise FALSE

refresh()

refresh() : mixed

Refreshes rex_config by reloading config from db.

Returns

mixed —

save()

save() : mixed

persists the config-data and truncates the file-cache.

Returns

mixed —

init()

init() : mixed

initilizes the rex_config class.

Returns

mixed —

load()

load() : mixed

load the config-data.

Returns

mixed —