Router

A path router.

since

1.0

Methods

__construct

Constructor.

__construct(\Joomla\Input\Input $input = null) 
since

1.0

Arguments

$input

\Joomla\Input\InputAn optional input object from which to derive the route.

addMap

Add a route map to the router. If the pattern already exists it will be overwritten.

addMap(string $pattern, string $controller) : \Joomla\Router\Router
deprecated
since

1.0

deprecated

2.0 Deprecated without replacement

Arguments

$pattern

stringThe route pattern to use for matching.

$controller

stringThe controller name to map to the given pattern.

Response

\Joomla\Router\RouterReturns itself to support chaining.

addMaps

Add an array of route maps to the router. If the pattern already exists it will be overwritten.

addMaps(array $maps) : \Joomla\Router\Router
deprecated
since

1.0

deprecated

2.0 Deprecated without replacement

Arguments

$maps

arrayA list of route maps to add to the router as $pattern => $controller.

Response

\Joomla\Router\RouterReturns itself to support chaining.

fetchController

Get a Controller object for a given name.

fetchController(string $name) : \Joomla\Controller\ControllerInterface
deprecated
since

1.0

throws

\RuntimeException

deprecated

2.0 Deprecated without replacement

Arguments

$name

stringThe controller name (excluding prefix) for which to fetch and instance.

Response

\Joomla\Controller\ControllerInterface

getController

Find and execute the appropriate controller based on a given route.

getController(string $route) : \Joomla\Controller\ControllerInterface
deprecated
since

1.0

throws

\InvalidArgumentException

\RuntimeException

deprecated

2.0 Deprecated without replacement

Arguments

$route

stringThe route string for which to find and execute a controller.

Response

\Joomla\Controller\ControllerInterface

parseRoute

Parse the given route and return the name of a controller mapped to the given route.

parseRoute(string $route) : string
since

1.0

throws

\InvalidArgumentException

Arguments

$route

stringThe route string for which to find and execute a controller.

Response

stringThe controller name for the given route excluding prefix.

setControllerPrefix

Set the controller name prefix.

setControllerPrefix(string $prefix) : \Joomla\Router\Router
deprecated
since

1.0

deprecated

2.0 Deprecated without replacement

Arguments

$prefix

stringController class name prefix for creating controller objects by name.

Response

\Joomla\Router\RouterReturns itself to support chaining.

setDefaultController

Set the default controller name.

setDefaultController(string $name) : \Joomla\Router\Router
deprecated
since

1.0

deprecated

2.0 Deprecated without replacement

Arguments

$name

stringThe default page controller name for an empty route.

Response

\Joomla\Router\RouterReturns itself to support chaining.

Properties

controllerPrefix

Controller class name prefix for creating controller objects by name.

deprecated
since

1.0

deprecated

2.0 Deprecated without replacement

Type(s)

string

default

The default page controller name for an empty route.

deprecated
since

1.0

deprecated

2.0 Deprecated without replacement

Type(s)

string

input

An input object from which to derive the route.

deprecated
since

1.0

deprecated

2.0 Deprecated without replacement

Type(s)

\Joomla\Input\Input

maps

An array of rules, each rule being an associative array('regex'=> $regex, 'vars' => $vars, 'controller' => $controller) for routing the request.

deprecated
since

1.0

deprecated

2.0 Deprecated without replacement

Type(s)

array