Properties

$controller

$controller : mixed

Controller object

Type

mixed

$action

$action : mixed

Action

Type

mixed

$controllerClass

$controllerClass : string

Controller class

Type

string

Methods

__construct()

__construct(array  $routes = null, \Pop\Router\Match\AbstractMatch  $match = null) 

Constructor

Instantiate the router object

Parameters

array $routes
\Pop\Router\Match\AbstractMatch $match

addRoute()

addRoute(string  $route, mixed  $controller) : \Pop\Router\Router

Add a route

Parameters

string $route
mixed $controller

Returns

\Pop\Router\Router

addRoutes()

addRoutes(array  $routes) : \Pop\Router\Router

Add multiple controller routes

Parameters

array $routes

Returns

\Pop\Router\Router

name()

name(string  $routeName) : \Pop\Router\Router

Add a route name

Parameters

string $routeName

Returns

\Pop\Router\Router

hasName()

hasName(string  $routeName) : boolean

Has a route name

Parameters

string $routeName

Returns

boolean

getUrl()

getUrl(string  $routeName, mixed  $params = null, boolean  $fqdn = false) : string

Get URL for the named route

Parameters

string $routeName
mixed $params
boolean $fqdn

Throws

\Pop\Router\Exception

Returns

string

addControllerParams()

addControllerParams(string  $controller, mixed  $params) : \Pop\Router\Router

Add controller params to be passed into a new controller instance

Parameters

string $controller
mixed $params

Returns

\Pop\Router\Router

appendControllerParams()

appendControllerParams(string  $controller, mixed  $params) : \Pop\Router\Router

Append controller params to be passed into a new controller instance

Parameters

string $controller
mixed $params

Returns

\Pop\Router\Router

getControllerParams()

getControllerParams(string  $controller) : mixed

Get the params assigned to the controller

Parameters

string $controller

Returns

mixed

hasControllerParams()

hasControllerParams(string  $controller) : boolean

Determine if the controller has params

Parameters

string $controller

Returns

boolean

removeControllerParams()

removeControllerParams(string  $controller) : \Pop\Router\Router

Remove controller params

Parameters

string $controller

Returns

\Pop\Router\Router

getRoutes()

getRoutes() : array

Get routes

Returns

array

hasRoute()

hasRoute() : boolean

Determine if there is a route match

Returns

boolean

getRouteParams()

getRouteParams() : mixed

Get the params discovered from the route

Returns

mixed

hasRouteParams()

hasRouteParams() : boolean

Determine if the route has params

Returns

boolean

getController()

getController() : mixed

Get the current controller object

Returns

mixed

hasController()

hasController() : boolean

Determine if the router has a controller

Returns

boolean

getAction()

getAction() : mixed

Get the action

Returns

mixed

hasAction()

hasAction() : boolean

Determine if the router has an action

Returns

boolean

getControllerClass()

getControllerClass() : string

Get the current controller class name

Returns

string

isCli()

isCli() : boolean

Determine if the route is CLI

Returns

boolean

isHttp()

isHttp() : boolean

Determine if the route is HTTP

Returns

boolean

route()

route(string  $forceRoute = null) : void

Route to the correct controller

Parameters

string $forceRoute

Throws

\Pop\Router\Exception
\ReflectionException

noRouteFound()

noRouteFound(boolean  $exit = true) : void

Method to process if a route was not found

Parameters

boolean $exit