class ParameterBag implements IteratorAggregate, Countable

ParameterBag is a container for key/value pairs.

Methods

__construct(array $parameters = array())

No description

array
all()

Returns the parameters.

array
keys()

Returns the parameter keys.

replace(array $parameters = array())

Replaces the current parameters by a new set.

add(array $parameters = array())

Adds parameters.

mixed
get(string $path, mixed $default = null, bool $deep = false)

Returns a parameter by name.

set(string $key, mixed $value)

Sets a parameter by name.

bool
has(string $key)

Returns true if the parameter is defined.

remove(string $key)

Removes a parameter.

string
getAlpha(string $key, string $default = '', bool $deep = false)

Returns the alphabetic characters of the parameter value.

string
getAlnum(string $key, string $default = '', bool $deep = false)

Returns the alphabetic characters and digits of the parameter value.

string
getDigits(string $key, string $default = '', bool $deep = false)

Returns the digits of the parameter value.

int
getInt(string $key, int $default, bool $deep = false)

Returns the parameter value converted to integer.

bool
getBoolean(string $key, mixed $default = false, bool $deep = false)

Returns the parameter value converted to boolean.

mixed
filter(string $key, mixed $default = null, bool $deep = false, int $filter = FILTER_DEFAULT, mixed $options = array())

Filter key.

getIterator()

Returns an iterator for parameters.

int
count()

Returns the number of parameters.

Details

at line line 29
__construct(array $parameters = array())

Parameters

array $parameters An array of parameters

at line line 39
array all()

Returns the parameters.

Return Value

array An array of parameters

at line line 49
array keys()

Returns the parameter keys.

Return Value

array An array of parameter keys

at line line 59
replace(array $parameters = array())

Replaces the current parameters by a new set.

Parameters

array $parameters An array of parameters

at line line 69
add(array $parameters = array())

Adds parameters.

Parameters

array $parameters An array of parameters

at line line 85
mixed get(string $path, mixed $default = null, bool $deep = false)

Returns a parameter by name.

Parameters

string $path The key
mixed $default The default value if the parameter key does not exist
bool $deep If true, a path like foo[bar] will find deeper items

Return Value

mixed

Exceptions

InvalidArgumentException

at line line 140
set(string $key, mixed $value)

Sets a parameter by name.

Parameters

string $key The key
mixed $value The value

at line line 152
bool has(string $key)

Returns true if the parameter is defined.

Parameters

string $key The key

Return Value

bool true if the parameter exists, false otherwise

at line line 162
remove(string $key)

Removes a parameter.

Parameters

string $key The key

at line line 176
string getAlpha(string $key, string $default = '', bool $deep = false)

Returns the alphabetic characters of the parameter value.

Parameters

string $key The parameter key
string $default The default value if the parameter key does not exist
bool $deep If true, a path like foo[bar] will find deeper items

Return Value

string The filtered value

at line line 190
string getAlnum(string $key, string $default = '', bool $deep = false)

Returns the alphabetic characters and digits of the parameter value.

Parameters

string $key The parameter key
string $default The default value if the parameter key does not exist
bool $deep If true, a path like foo[bar] will find deeper items

Return Value

string The filtered value

at line line 204
string getDigits(string $key, string $default = '', bool $deep = false)

Returns the digits of the parameter value.

Parameters

string $key The parameter key
string $default The default value if the parameter key does not exist
bool $deep If true, a path like foo[bar] will find deeper items

Return Value

string The filtered value

at line line 219
int getInt(string $key, int $default, bool $deep = false)

Returns the parameter value converted to integer.

Parameters

string $key The parameter key
int $default The default value if the parameter key does not exist
bool $deep If true, a path like foo[bar] will find deeper items

Return Value

int The filtered value

at line line 233
bool getBoolean(string $key, mixed $default = false, bool $deep = false)

Returns the parameter value converted to boolean.

Parameters

string $key The parameter key
mixed $default The default value if the parameter key does not exist
bool $deep If true, a path like foo[bar] will find deeper items

Return Value

bool The filtered value

at line line 251
mixed filter(string $key, mixed $default = null, bool $deep = false, int $filter = FILTER_DEFAULT, mixed $options = array())

Filter key.

Parameters

string $key Key
mixed $default Default = null
bool $deep Default = false
int $filter FILTER_* constant
mixed $options Filter options

Return Value

mixed

See also

http://php.net/manual/en/function.filter-var.php

at line line 273
ArrayIterator getIterator()

Returns an iterator for parameters.

Return Value

ArrayIterator An \ArrayIterator instance

at line line 283
int count()

Returns the number of parameters.

Return Value

int The number of parameters