interface RoutePartInterface (View source)

Contract for all Route Parts.

!!! Warning: If you write your own RoutePart handler which does some queries to the persistence layer, be aware that permission checks are not yet done, i.e. you get back all objects, not just the objects visible to the current role.

Methods

void
setName(string $partName)

Sets name of the Route Part.

string
getName()

Returns name of the Route Part.

bool
hasValue()

Returns true if a value is set for this Route Part, otherwise false.

mixed
getValue()

Returns value of the Route Part. Before match() is called this returns NULL.

bool
hasDefaultValue()

Returns true if a default value is set for this Route Part, otherwise false.

void
setDefaultValue(mixed $defaultValue)

Sets default value of the Route Part.

mixed
getDefaultValue()

Gets default value of the Route Part.

void
setOptional(bool $isOptional)

Specifies whether this Route part is optional.

bool
isOptional()

No description

void
setLowerCase(bool $lowerCase)

Specifies whether this Route part should be converted to lower case when resolved.

bool
isLowerCase()

Getter for $this->lowerCase.

void
setOptions(array $options)

Defines options for this Route Part.

array
getOptions()

No description

match(string $routePath)

Checks whether this Route Part corresponds to the given $routePath.

resolve(array $routeValues)

Checks whether this Route Part corresponds to the given $routeValues.

Details

void setName(string $partName)

Sets name of the Route Part.

Parameters

string $partName

Return Value

void

string getName()

Returns name of the Route Part.

Return Value

string

bool hasValue()

Returns true if a value is set for this Route Part, otherwise false.

Return Value

bool

mixed getValue()

Returns value of the Route Part. Before match() is called this returns NULL.

Return Value

mixed

bool hasDefaultValue()

Returns true if a default value is set for this Route Part, otherwise false.

Return Value

bool

void setDefaultValue(mixed $defaultValue)

Sets default value of the Route Part.

Parameters

mixed $defaultValue

Return Value

void

mixed getDefaultValue()

Gets default value of the Route Part.

Return Value

mixed $defaultValue

void setOptional(bool $isOptional)

Specifies whether this Route part is optional.

Parameters

bool $isOptional

true: this Route part is optional. false: this Route part is required.

Return Value

void

bool isOptional()

No description

Return Value

bool

true if this Route part is optional, otherwise false.

See also

setOptional()

void setLowerCase(bool $lowerCase)

Specifies whether this Route part should be converted to lower case when resolved.

Parameters

bool $lowerCase

true: this Route part is converted to lower case. false: this Route part is not altered.

Return Value

void

bool isLowerCase()

Getter for $this->lowerCase.

Return Value

bool

true if this Route part will be converted to lower case, otherwise false.

See also

setLowerCase()

void setOptions(array $options)

Defines options for this Route Part.

Options can be used to enrich a route part with parameters or settings like case sensivitity.

Parameters

array $options

Return Value

void

array getOptions()

No description

Return Value

array

options of this Route Part.

bool|MatchResult match(string $routePath)

Checks whether this Route Part corresponds to the given $routePath.

This method does not only check if the Route Part matches. It can also shorten the $routePath by the matching substring when matching is successful. This is why $routePath has to be passed by reference.

Parameters

string $routePath

The request path to be matched - without query parameters, host and fragment.

Return Value

bool|MatchResult

true or an instance of MatchResult if Route Part matched $routePath, otherwise false.

bool|ResolveResult resolve(array $routeValues)

Checks whether this Route Part corresponds to the given $routeValues.

This method does not only check if the Route Part matches. It also removes resolved elements from $routeValues-Array. This is why $routeValues has to be passed by reference.

Parameters

array $routeValues

An array with key/value pairs to be resolved by Dynamic Route Parts.

Return Value

bool|ResolveResult

true or an instance of ResolveResult if Route Part can resolve one or more $routeValues elements, otherwise false.