DynamicRoutePart
class DynamicRoutePart extends AbstractRoutePart implements DynamicRoutePartInterface, ParameterAwareRoutePartInterface (View source)
Dynamic Route Part
Properties
protected string | $name | Name of the Route Part |
from AbstractRoutePart |
protected mixed | $value | Value of the Route Part after decoding. |
from AbstractRoutePart |
protected mixed | $defaultValue | Default value of the Route Part. |
from AbstractRoutePart |
protected bool | $isOptional | Specifies whether this Route Part is optional. Which means it's put in parentheses in the routes URI pattern. |
from AbstractRoutePart |
protected bool | $lowerCase | Specifies whether this Route Part should be converted to lower case when resolved. |
from AbstractRoutePart |
protected array | $options | Contains options for this Route Part. |
from AbstractRoutePart |
protected PersistenceManagerInterface | $persistenceManager | ||
protected string | $splitString | The split string represents the end of a Dynamic Route Part. |
|
protected RouteParameters | $parameters | The Routing RouteParameters passed to matchWithParameters() These allow sub classes to adjust the matching behavior accordingly |
Methods
Returns true if a value is set for this Route Part, otherwise false.
Returns value of the Route Part. Before match() is called this returns NULL.
Returns true if a default value is set for this Route Part, otherwise false.
Sets default value of the Route Part.
Specifies whether this Route part is optional.
Specifies whether this Route part should be converted to lower case when resolved.
Sets split string of the Route Part.
Checks whether this Dynamic Route Part corresponds to the given $routePath.
Checks whether this Dynamic Route Part corresponds to the given $routePath.
Returns the first part of $routePath.
Checks, whether given value can be matched.
Removes matching part from $routePath.
Checks whether $routeValues contains elements which correspond to this Dynamic Route Part.
Checks whether $routeValues contains elements which correspond to this Dynamic Route Part.
Returns the route value of the current route part.
Checks, whether given value can be resolved and if so, sets $this->value to the resolved value.
Details
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()
Getter for $this->isOptional.
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.
Options can be used to enrich a route part with parameters or settings like case sensivity.
array
getOptions()
No description
void
setSplitString(string $splitString)
Sets split string of the Route Part.
final bool|MatchResult
match(string $routePath)
Checks whether this Dynamic Route Part corresponds to the given $routePath.
final bool
matchWithParameters(string $routePath, RouteParameters $parameters)
Checks whether this Dynamic Route Part corresponds to the given $routePath.
On successful match this method sets $this->value to the corresponding uriPart and shortens $routePath respectively.
protected string
findValueToMatch(string|null $routePath)
Returns the first part of $routePath.
If a split string is set, only the first part of the value until location of the splitString is returned. This method can be overridden by custom RoutePartHandlers to implement custom matching mechanisms.
protected bool|MatchResult
matchValue(string $value)
Checks, whether given value can be matched.
In the case of default Dynamic Route Parts a value matches when it's not empty. This method can be overridden by custom RoutePartHandlers to implement custom matching mechanisms.
protected void
removeMatchingPortionFromRequestPath(string $routePath, string $valueToMatch)
Removes matching part from $routePath.
This method can be overridden by custom RoutePartHandlers to implement custom matching mechanisms.
final bool|ResolveResult
resolve(array $routeValues)
Checks whether $routeValues contains elements which correspond to this Dynamic Route Part.
If a corresponding element is found in $routeValues, this element is removed from the array.
final bool|ResolveResult
resolveWithParameters(array $routeValues, RouteParameters $parameters)
Checks whether $routeValues contains elements which correspond to this Dynamic Route Part.
If a corresponding element is found in $routeValues, this element is removed from the array.
protected string|array
findValueToResolve(array $routeValues)
Returns the route value of the current route part.
This method can be overridden by custom RoutePartHandlers to implement custom resolving mechanisms.
protected bool|ResolveResult
resolveValue(mixed $value)
Checks, whether given value can be resolved and if so, sets $this->value to the resolved value.
If $value is empty, this method checks whether a default value exists. This method can be overridden by custom RoutePartHandlers to implement custom resolving mechanisms.