ParameterBag.php
- Classes
- ParameterBag
NoiseLabs\ToolKit\ParameterBag
- author
- Fabien Potencier <fabien@symfony.com>
- Properties
- $parameters
- Methods
- __construct
- all
- keys
- replace
- add
- get
- getDeep
- set
- has
- remove
- getAlpha
- getAlnum
- getDigits
- getInt
Description
ParameterBag is a container for key/value pairs.
Properties
Methods
__construct
__construct(
array $parameters
=
array
)
:
Constructor.
Arguments
- $parameters
- array
An array of parameters
Details
- visibility
- public
- final
- false
- static
- false
add
add(
array $parameters
=
array
)
:
Adds parameters.
Arguments
- $parameters
- array
An array of parameters
Details
- visibility
- public
- final
- false
- static
- false
all
all(
)
:
array
Returns the parameters.
Output
- array
- An array of parameters
Details
- visibility
- public
- final
- false
- static
- false
get
get(
string $key, mixed $default
=
null
)
:
Returns a parameter by name.
Arguments
- $key
- string
The key - $default
- mixed
The default value
Details
- visibility
- public
- final
- false
- static
- false
getAlnum
getAlnum(
string $key, mixed $default
)
:
string
Returns the alphabetic characters and digits of the parameter value.
Arguments
- $key
- string
The parameter key - $default
- mixed
The default value
Output
- string
- The filtered value
Details
- visibility
- public
- final
- false
- static
- false
getAlpha
getAlpha(
string $key, mixed $default
)
:
string
Returns the alphabetic characters of the parameter value.
Arguments
- $key
- string
The parameter key - $default
- mixed
The default value
Output
- string
- The filtered value
Details
- visibility
- public
- final
- false
- static
- false
getDeep
getDeep(
string $path, mixed $default
=
null
)
:
Returns a parameter by name allowing to specify a path with arbitrary depth.
Arguments
- $path
- string
The path, e.g. foo[bar] - $default
- mixed
The default value
Details
- visibility
- public
- final
- false
- static
- false
getDigits
getDigits(
string $key, mixed $default
)
:
string
Returns the digits of the parameter value.
Arguments
- $key
- string
The parameter key - $default
- mixed
The default value
Output
- string
- The filtered value
Details
- visibility
- public
- final
- false
- static
- false
getInt
getInt(
string $key, mixed $default
=
0
)
:
string
Returns the parameter value converted to integer.
Arguments
- $key
- string
The parameter key - $default
- mixed
The default value
Output
- string
- The filtered value
Details
- visibility
- public
- final
- false
- static
- false
has
has(
string $key
)
:
Boolean
Returns true if the parameter is defined.
Arguments
- $key
- string
The key
Output
- Boolean
- true if the parameter exists, false otherwise
Details
- visibility
- public
- final
- false
- static
- false
keys
keys(
)
:
array
Returns the parameter keys.
Output
- array
- An array of parameter keys
Details
- visibility
- public
- final
- false
- static
- false
remove
remove(
string $key
)
:
Removes a parameter.
Arguments
- $key
- string
The key
Details
- visibility
- public
- final
- false
- static
- false
replace
replace(
array $parameters
=
array
)
:
Replaces the current parameters by a new set.
Arguments
- $parameters
- array
An array of parameters
Details
- visibility
- public
- final
- false
- static
- false
set
set(
string $key, mixed $value
)
:
Sets a parameter by name.
Arguments
- $key
- string
The key - $value
- mixed
The value
Details
- visibility
- public
- final
- false
- static
- false