Documentation

ConfigArray extends ArrayObject
in package

Implementation of {@see \ArrayObject} with the addition that values will be fetched from the environment instead from a locally set key.

Tags
copyright

Cloudrexx AG

author

Thomas Wirz thomas.wirz@cloudrexx.com

subpackage

core_core

Table of Contents

Properties

$config  : array<string|int, mixed>
$env  : array<string|int, mixed>
As getenv() is quite slow we cache the whole list of environment variables
$prefix  : string

Methods

__construct()  : mixed
Construct a new Cloudrexx Config array
exists()  : boolean
get()  : mixed
offsetExists()  : mixed
offsetGet()  : string|int|null
{@inheritDoc} If an matching system environment variable is set, then the value of that environment varible is returned instead. Any set value on this array will have no effect in that case.
offsetSet()  : mixed
offsetUnset()  : mixed
set()  : void
unset()  : void

Properties

$env

As getenv() is quite slow we cache the whole list of environment variables

protected static array<string|int, mixed> $env = array()

List of environment variables

Methods

__construct()

Construct a new Cloudrexx Config array

public __construct([string $prefix = '' ]) : mixed
Parameters
$prefix : string = ''

Use to set

exists()

public exists(string $key) : boolean
Parameters
$key : string
Tags
see
static::offsetExists()
Return values
boolean

get()

public get(string $key) : mixed
Parameters
$key : string
Tags
see
static::offsetGet()

offsetExists()

public offsetExists(mixed $offset) : mixed
Parameters
$offset : mixed
Tags
inheritDoc

offsetGet()

{@inheritDoc} If an matching system environment variable is set, then the value of that environment varible is returned instead. Any set value on this array will have no effect in that case.

public offsetGet(mixed $offset) : string|int|null

A matching system environment variable is defined as follows: Each uppercase character in $offset (which should be in camelCase notation) is prefixed by an underscore character, before converting the resulting string all into uppercase and prefixing it with CLX_CONFIG_. Where is substituted by $prefix passed to the constructor of the object. Some examples follow. If $offset is 'cacheUserCacheMemcachedConfig' and object has been initialized with an empty $prefix, then the matching environment variable is: CLX_CONFIG_CACHE_USER_CACHE_MEMCACHED_CONFIG Or if $offset is 'host' and the object has been initialized with $prefix set to 'DB', then its matching environment variable is: CLX_DBCONFIG_HOST

Parameters
$offset : mixed
Return values
string|int|null

Returned type depends on option identified by $offset. If $offset is undefined, then null is returned. Important: this will change in the future. Therefore you must not depend on that. Instead use static::exists() to check for the existance of an option.

offsetSet()

public offsetSet(mixed $offset, mixed $value) : mixed
Parameters
$offset : mixed
$value : mixed
Tags
inheritDoc

offsetUnset()

public offsetUnset(mixed $offset) : mixed
Parameters
$offset : mixed
Tags
inheritDoc

set()

public set(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed
Tags
see
static::offsetSet()

unset()

public unset(string $key) : void
Parameters
$key : string
Tags
see
static::offsetUnset()

        
On this page

Search results