interface RouterInterface (View source)

Contract for a Web Router

Methods

array
route(RouteContext $routeContext)

Iterates through all configured routes and calls matches() on them.

UriInterface
resolve(ResolveContext $resolveContext)

Walks through all configured routes and calls their respective resolves-method.

Details

array route(RouteContext $routeContext)

Iterates through all configured routes and calls matches() on them.

Returns the matchResults of the matching route.

Parameters

RouteContext $routeContext

The Route Context containing the current HTTP Request and, optional, Routing RouteParameters

Return Value

array

The results of the matching route

Exceptions

NoMatchingRouteException

UriInterface resolve(ResolveContext $resolveContext)

Walks through all configured routes and calls their respective resolves-method.

When a matching route is found, the corresponding URI is returned.

Parameters

ResolveContext $resolveContext

The Resolve Context containing the route values, the request URI and some flags to be resolved

Return Value

UriInterface

The resolved Uri

Exceptions

NoMatchingRouteException