Interface

Symfony\Component\Routing\RouterInterface

interface RouterInterface implements UrlMatcherInterface, UrlGeneratorInterface

RouterInterface is the interface that all Router classes must implement.

This interface is the concatenation of UrlMatcherInterface and UrlGeneratorInterface.

Methods

setContext(RequestContext $context)

Sets the request context.

from RequestContextAwareInterface
RequestContext getContext()

Gets the request context.

from RequestContextAwareInterface
array match(string $pathinfo)

Tries to match a URL path with a set of routes.

from UrlMatcherInterface
string generate(string $name, mixed $parameters = array(), Boolean $absolute = false)

Generates a URL from the given parameters.

from UrlGeneratorInterface
RouteCollection getRouteCollection()

Gets the RouteCollection instance associated with this Router.

Details

public setContext(RequestContext $context)

Sets the request context.

Parameters

RequestContext $context The context

public RequestContext getContext()

Gets the request context.

Return Value

RequestContext The context

in UrlMatcherInterface at line 42
public array match(string $pathinfo)

Tries to match a URL path with a set of routes.

If the matcher can not find information, it must throw one of the exceptions documented below.

Parameters

string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded)

Return Value

array An array of parameters

Exceptions

ResourceNotFoundException If the resource could not be found
MethodNotAllowedException If the resource was found but the request method is not allowed

in UrlGeneratorInterface at line 42
public string generate(string $name, mixed $parameters = array(), Boolean $absolute = false)

Generates a URL from the given parameters.

If the generator is not able to generate the url, it must throw the RouteNotFoundException as documented below.

Parameters

string $name The name of the route
mixed $parameters An array of parameters
Boolean $absolute Whether to generate an absolute URL

Return Value

string The generated URL

Exceptions

RouteNotFoundException if route doesn't exist

at line 31
public RouteCollection getRouteCollection()

Gets the RouteCollection instance associated with this Router.

Return Value

RouteCollection A RouteCollection instance