Route
class Route (View source)
Implementation of a standard route
Constants
ROUTEPART_TYPE_STATIC |
|
ROUTEPART_TYPE_DYNAMIC |
|
PATTERN_EXTRACTROUTEPARTS |
|
Properties
protected string | $name | Route name |
|
protected array | $defaults | Default values |
|
protected string | $uriPattern | URI Pattern of this route |
|
protected bool | $lowerCase | Specifies whether Route Parts of this Route should be converted to lower case when resolved. |
|
protected bool | $appendExceedingArguments | Specifies whether Route Values, that are not part of the Routes configuration, should be appended as query string |
|
protected RouteTags|null | $cacheTags | Specifies the tags to be associated with cache items generated by this route |
|
protected RouteLifetime|null | $cacheLifetime | Specifies the lifetime to be associated with cache items generated by this route |
|
protected array | $matchResults | Contains the routing results (indexed by "package", "controller" and "action") after a successful call of matches() |
|
protected RouteTags|null | $matchedTags | The tags that have been associated with this route during request matching, or NULL if no tags were set |
|
protected RouteLifetime|null | $matchedLifetime | The lifetime that has been associated with this route during request matching, or NULL |
|
protected UriConstraints|null | $resolvedUriConstraints | The merged UriConstraints of all Route Parts after resolving |
|
protected RouteTags|null | $resolvedTags | The tags that have been associated with this route during resolving, or NULL if no tags were set |
|
protected RouteLifetime|null | $resolvedLifetime | The lifetime that has been associated with this route during resolving, or NULL |
|
protected array | $routePartsConfiguration | Contains associative array of Route Part options (key: Route Part name, value: array of Route Part options) |
|
protected RoutePartInterface[] | $routeParts | Container for Route Parts. |
|
protected list<string> | $httpMethods | If not empty only the specified HTTP verbs are accepted by this route |
|
protected bool | $isParsed | Indicates whether this route is parsed. |
|
protected ObjectManagerInterface | $objectManager | ||
protected PersistenceManagerInterface | $persistenceManager |
Methods
Sets Route name.
Returns the name of this Route.
Sets default values for this Route.
Returns default values for this Route.
Sets the URI pattern this route should match with
Returns the URI pattern this route should match with
Specifies whether Route parts of this route should be converted to lower case when resolved.
Getter for $this->lowerCase.
Specifies whether Route values, that are not part of the Route configuration, should be appended to the Resulting URI as query string.
Returns true if exceeding arguments should be appended to the URI as query string, otherwise false
By default all Dynamic Route Parts are resolved by \Neos\Flow\Mvc\Routing\DynamicRoutePart.
Returns the route parts configuration of this route
Limits the HTTP verbs that are accepted by this route.
No description
Tags for cache items
Lifetime for cache items
Whether or not this route is limited to one or more HTTP verbs
Returns an array with the Route match results.
Returns the tags that have been associated with this route during request matching, or NULL if no tags were set
Returns the lifetime been associated with this route during request matching, or NULL
Returns the merged UriConstraints of all Route Parts after resolving, or NULL if no constraints were set yet
Returns the tags that have been associated with this route during resolving, or NULL if no tags were set
Returns the tags that have been associated with this route during resolving, or NULL if no tags were set
Checks whether $routeValues can be resolved to a corresponding uri.
Recursively iterates through the defaults of this route.
Removes all internal arguments (prefixed with two underscores) from the given $arguments and returns them as array
Checks if the given subject contains an object
Iterates through all segments in $this->uriPattern and creates appropriate RoutePart instances.
Details
void
setName(string $name)
Sets Route name.
string
getName()
Returns the name of this Route.
void
setDefaults(array $defaults)
Sets default values for this Route.
This array is merged with the actual matchResults when match() is called.
array
getDefaults()
Returns default values for this Route.
void
setUriPattern(string $uriPattern)
Sets the URI pattern this route should match with
string
getUriPattern()
Returns the URI pattern this route should match with
void
setLowerCase(bool $lowerCase)
Specifies whether Route parts of this route should be converted to lower case when resolved.
This setting can be overwritten for all dynamic Route parts.
bool
isLowerCase()
Getter for $this->lowerCase.
void
setAppendExceedingArguments(bool $appendExceedingArguments)
Specifies whether Route values, that are not part of the Route configuration, should be appended to the Resulting URI as query string.
If set to false, the route won't resolve if there are route values left after iterating through all Route Part handlers and removing the matching default values.
bool
getAppendExceedingArguments()
Returns true if exceeding arguments should be appended to the URI as query string, otherwise false
void
setRoutePartsConfiguration(array $routePartsConfiguration)
By default all Dynamic Route Parts are resolved by \Neos\Flow\Mvc\Routing\DynamicRoutePart.
But you can specify different classes to handle particular Route Parts.
Note: Route Part handlers must implement \Neos\Flow\Mvc\Routing\DynamicRoutePartInterface.
Usage: setRoutePartsConfiguration(array('@controller' => array('handler' => \Neos\Package\Subpackage\MyRoutePartHandler::class)));
array
getRoutePartsConfiguration()
Returns the route parts configuration of this route
void
setHttpMethods(array $httpMethods)
Limits the HTTP verbs that are accepted by this route.
If empty all HTTP verbs are accepted
array
getHttpMethods()
No description
void
setCacheTags(RouteTags|null $tags)
Tags for cache items
void
setCacheLifetime(RouteLifetime|null $lifetime)
Lifetime for cache items
bool
hasHttpMethodConstraints()
Whether or not this route is limited to one or more HTTP verbs
array
getMatchResults()
Returns an array with the Route match results.
RouteTags|null
getMatchedTags()
Returns the tags that have been associated with this route during request matching, or NULL if no tags were set
RouteLifetime|null
getMatchedLifetime()
Returns the lifetime been associated with this route during request matching, or NULL
UriConstraints|null
getResolvedUriConstraints()
Returns the merged UriConstraints of all Route Parts after resolving, or NULL if no constraints were set yet
RouteTags|null
getResolvedTags()
Returns the tags that have been associated with this route during resolving, or NULL if no tags were set
RouteLifetime|null
getResolvedLifetime()
Returns the tags that have been associated with this route during resolving, or NULL if no tags were set
bool
matches(RouteContext $routeContext)
Checks whether $routeContext corresponds to this Route.
If all Route Parts match successfully true is returned an $this->matchResults contains an array combining Route default values and calculated matchResults from the individual Route Parts.
bool
resolves(ResolveContext $resolveContext)
Checks whether $routeValues can be resolved to a corresponding uri.
If all Route Parts can resolve one or more of the $routeValues, true is returned and $this->resolvedUriConstraints contains an instance of UriConstraints that can be applied to a template URI transforming it accordingly (Router::resolve())
protected bool
compareAndRemoveMatchingDefaultValues(array $defaults, array $routeValues)
Recursively iterates through the defaults of this route.
If a route value is equal to a default value, it's removed from $routeValues. If a value exists but is not equal to is corresponding default, iteration is interrupted and false is returned.
protected array
extractInternalArguments(array $arguments)
Removes all internal arguments (prefixed with two underscores) from the given $arguments and returns them as array
protected bool
containsObject(mixed $subject)
Checks if the given subject contains an object
void
parse()
Iterates through all segments in $this->uriPattern and creates appropriate RoutePart instances.