class Arguments extends ArrayObject (View source)

A composite of controller arguments

Properties

protected array $argumentNames

Names of the arguments contained by this object

Methods

void
offsetSet(mixed $offset, mixed $value)

Adds or replaces the argument specified by $value. The argument's name is taken from the argument object itself, therefore the $offset does not have any meaning in this context.

void
append(mixed $value)

Sets an argument, aliased to offsetSet()

void
offsetUnset(mixed $offset)

Unsets an argument

bool
offsetExists(mixed $offset)

Returns whether the requested index exists

mixed
offsetGet(mixed $offset)

Returns the value at the specified index

addNewArgument(string $name, string $dataType = 'string', bool $isRequired = true, mixed $defaultValue = null, bool $mapRequestBody = false)

Creates, adds and returns a new controller argument to this composite object.

void
addArgument(Argument $argument)

Adds the specified controller argument to this composite object.

getArgument(string $argumentName)

Returns an argument specified by name

bool
hasArgument(string $argumentName)

Checks if an argument with the specified name exists

array
getArgumentNames()

Returns the names of all arguments contained in this object

void
__call(string $methodName, array $arguments)

Magic setter method for the argument values. Each argument value can be set by just calling the setArgumentName() method.

string|false
validateArgumentExistence(string $argumentName)

Translates a short argument name to its corresponding long name. If the specified argument name is a real argument name already, it will be returned again.

void
removeAll()

Remove all arguments and resets this object

getValidationResults()

Get all property mapping / validation errors

Details

void offsetSet(mixed $offset, mixed $value)

Adds or replaces the argument specified by $value. The argument's name is taken from the argument object itself, therefore the $offset does not have any meaning in this context.

Parameters

mixed $offset

Offset - not used here

mixed $value

The argument.

Return Value

void

Exceptions

InvalidArgumentException

void append(mixed $value)

Sets an argument, aliased to offsetSet()

Parameters

mixed $value

The value

Return Value

void

Exceptions

InvalidArgumentException

void offsetUnset(mixed $offset)

Unsets an argument

Parameters

mixed $offset Offset

Return Value

void

bool offsetExists(mixed $offset)

Returns whether the requested index exists

Parameters

mixed $offset Offset

Return Value

bool

mixed offsetGet(mixed $offset)

Returns the value at the specified index

Parameters

mixed $offset Offset

Return Value

mixed

The requested argument object

Exceptions

NoSuchArgumentException

Argument addNewArgument(string $name, string $dataType = 'string', bool $isRequired = true, mixed $defaultValue = null, bool $mapRequestBody = false)

Creates, adds and returns a new controller argument to this composite object.

If an argument with the same name exists already, it will be replaced by the new argument object.

Parameters

string $name

Name of the argument

string $dataType

Name of one of the built-in data types

bool $isRequired

true if this argument should be marked as required

mixed $defaultValue

Default value of the argument. Only makes sense if $isRequired==false

bool $mapRequestBody

If the request body should be mapped into this argument

Return Value

Argument

The new argument

void addArgument(Argument $argument)

Adds the specified controller argument to this composite object.

If an argument with the same name exists already, it will be replaced by the new argument object.

Note that the argument will be cloned, not referenced.

Parameters

Argument $argument

The argument to add

Return Value

void

Argument getArgument(string $argumentName)

Returns an argument specified by name

Parameters

string $argumentName

Name of the argument to retrieve

Return Value

Argument

Exceptions

NoSuchArgumentException

bool hasArgument(string $argumentName)

Checks if an argument with the specified name exists

Parameters

string $argumentName

Name of the argument to check for

Return Value

bool

true if such an argument exists, otherwise false

See also

offsetExists()

array getArgumentNames()

Returns the names of all arguments contained in this object

Return Value

array

Argument names

void __call(string $methodName, array $arguments)

Magic setter method for the argument values. Each argument value can be set by just calling the setArgumentName() method.

Parameters

string $methodName

Name of the method

array $arguments

Method arguments

Return Value

void

Exceptions

LogicException

protected string|false validateArgumentExistence(string $argumentName)

Translates a short argument name to its corresponding long name. If the specified argument name is a real argument name already, it will be returned again.

If an argument with the specified name or short name does not exist, an empty string is returned.

Parameters

string $argumentName

argument name

Return Value

string|false

long argument name or empty string

void removeAll()

Remove all arguments and resets this object

Return Value

void

Result getValidationResults()

Get all property mapping / validation errors

Return Value

Result