\Symfony\Component\HttpFoundationParameterBag

ParameterBag is a container for key/value pairs.

Summary

Methods
Properties
Constants
__construct()
all()
keys()
replace()
add()
get()
set()
has()
remove()
getAlpha()
getAlnum()
getDigits()
getInt()
getBoolean()
filter()
getIterator()
count()
No public properties found
No constants found
No protected methods found
$parameters
N/A
No private methods found
No private properties found
N/A

Properties

$parameters

$parameters : 

Parameter storage.

Type

Methods

__construct()

__construct(array  $parameters = array()) 

Parameters

array $parameters

An array of parameters

all()

all() : array

Returns the parameters.

Returns

array —

An array of parameters

keys()

keys() : array

Returns the parameter keys.

Returns

array —

An array of parameter keys

replace()

replace(array  $parameters = array()) 

Replaces the current parameters by a new set.

Parameters

array $parameters

An array of parameters

add()

add(array  $parameters = array()) 

Adds parameters.

Parameters

array $parameters

An array of parameters

get()

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

Returns a parameter by name.

Parameters

string $key

The key

mixed $default

The default value if the parameter key does not exist

Returns

mixed

set()

set(string  $key, mixed  $value) 

Sets a parameter by name.

Parameters

string $key

The key

mixed $value

The value

has()

has(string  $key) : boolean

Returns true if the parameter is defined.

Parameters

string $key

The key

Returns

boolean —

true if the parameter exists, false otherwise

remove()

remove(string  $key) 

Removes a parameter.

Parameters

string $key

The key

getAlpha()

getAlpha(string  $key, string  $default = '') : string

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

Returns

string —

The filtered value

getAlnum()

getAlnum(string  $key, string  $default = '') : string

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

Returns

string —

The filtered value

getDigits()

getDigits(string  $key, string  $default = '') : string

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

Returns

string —

The filtered value

getInt()

getInt(string  $key, integer  $default) : integer

Returns the parameter value converted to integer.

Parameters

string $key

The parameter key

integer $default

The default value if the parameter key does not exist

Returns

integer —

The filtered value

getBoolean()

getBoolean(string  $key, mixed  $default = false) : boolean

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

Returns

boolean —

The filtered value

filter()

filter(string  $key, mixed  $default = null, integer  $filter = FILTER_DEFAULT, mixed  $options = array()) : mixed

Filter key.

Parameters

string $key

Key

mixed $default

Default = null

integer $filter

FILTER_* constant

mixed $options

Filter options

Returns

mixed

getIterator()

getIterator() : \ArrayIterator

Returns an iterator for parameters.

Returns

\ArrayIterator —

An \ArrayIterator instance

count()

count() : integer

Returns the number of parameters.

Returns

integer —

The number of parameters