trait ParametersPart

Parameters Part

For all models that can have parameters

Methods

$this
setParameters(array $parameters)

Sets a collection of parameters

$this
addParameter(PhpParameter $parameter)

Adds a parameter

bool
hasParameter(string $name)

Checks whether a parameter exists

$this
addSimpleParameter(string $name, null|string $type = null, mixed $defaultValue = null)

A quick way to add a parameter which is created from the given parameters

$this
addSimpleDescParameter(string $name, null|string $type = null, null|string $typeDescription = null, mixed $defaultValue = null)

A quick way to add a parameter with description which is created from the given parameters

getParameter(string|int $nameOrIndex)

Returns a parameter by index or name

$this
replaceParameter(int $position, PhpParameter $parameter)

Replaces a parameter at a given position

$this
removeParameter(int|string|PhpParameter $param)

Remove a parameter at a given position

array
getParameters()

Returns a collection of parameters

Details

at line line 31
$this setParameters(array $parameters)

Sets a collection of parameters

Note: clears all parameters before setting the new ones

Parameters

array $parameters

Return Value

$this

at line line 46
$this addParameter(PhpParameter $parameter)

Adds a parameter

Parameters

PhpParameter $parameter

Return Value

$this

at line line 58
bool hasParameter(string $name)

Checks whether a parameter exists

Parameters

string $name parameter name

Return Value

bool true if a parameter exists and false if not

at line line 77
$this addSimpleParameter(string $name, null|string $type = null, mixed $defaultValue = null)

A quick way to add a parameter which is created from the given parameters

Parameters

string $name
null|string $type
mixed $defaultValue omit the argument to define no default value

Return Value

$this

at line line 99
$this addSimpleDescParameter(string $name, null|string $type = null, null|string $typeDescription = null, mixed $defaultValue = null)

A quick way to add a parameter with description which is created from the given parameters

Parameters

string $name
null|string $type
null|string $typeDescription
mixed $defaultValue omit the argument to define no default value

Return Value

$this

at line line 119
PhpParameter getParameter(string|int $nameOrIndex)

Returns a parameter by index or name

Parameters

string|int $nameOrIndex

Return Value

PhpParameter

Exceptions

InvalidArgumentException

at line line 142
$this replaceParameter(int $position, PhpParameter $parameter)

Replaces a parameter at a given position

Parameters

int $position
PhpParameter $parameter

Return Value

$this

Exceptions

InvalidArgumentException

at line line 155
$this removeParameter(int|string|PhpParameter $param)

Remove a parameter at a given position

Parameters

int|string|PhpParameter $param

Return Value

$this

at line line 197
array getParameters()

Returns a collection of parameters

Return Value

array