class Route (View source)

Represents a matched request route.

Methods

__construct(RouteDefinition $definition, string $method, array $segments, array $values)

Route constructor.

string
getMethod()

Returns the requested HTTP method.

mixed
getHandler()

Returns the handler for the requested route.

string
getPath()

Returns the unencoded canonical path for the requested route.

string
getUrl()

Returns the encoded URL for the requested route.

string
getParameter(string $name)

Returns the value for the given parameter from the requested route.

array
getParameters()

Returns all parameters from the requested route as an associative array.

Details

__construct(RouteDefinition $definition, string $method, array $segments, array $values)

Route constructor.

Parameters

RouteDefinition $definition The definition of the matched route
string $method The requested HTTP method
array $segments The segments of the requested path
array $values The values for the parameters in the requested route

string getMethod()

Returns the requested HTTP method.

Return Value

string The requested HTTP method

mixed getHandler()

Returns the handler for the requested route.

Return Value

mixed The handler for the requested route

string getPath()

Returns the unencoded canonical path for the requested route.

Return Value

string The canonical path for the requested route

string getUrl()

Returns the encoded URL for the requested route.

Return Value

string The encoded URL for the requested route

string getParameter(string $name)

Returns the value for the given parameter from the requested route.

Parameters

string $name The name of the parameter

Return Value

string The value for the parameter

array getParameters()

Returns all parameters from the requested route as an associative array.

Return Value

array All parameters from the requested route