Class flRouter
flRouter Class
Class to match paths to routes and dispatch controllers and actions.
Package: fusionLib
Copyright:
Copyright (c) 2007 - 2013 fusionLib. All rights reserved.
Located at system/libs/Router/flRouter.php
Methods summary
public
|
#
__construct( flRequest $request )
Construct the router.
Parameters
- $request
- The request object.
|
public
|
#
addRoute( string $name, flRouterRoute $route )
Add a route.
Parameters
- $name
- The name of the route.
- $route
- The route to add.
|
public
flRouterRoute
|
#
getRoute( string $name )
Get the named route.
Parameters
- $name
- The name of the route to get.
Returns
|
public
string
|
#
getCurrentRouteName( )
Get the name of the current route.
Get the name of the current route.
Returns
string The current route name or null.
|
public
flRequest
|
#
route( )
Match the request against the routes and populate the action, controller and module parameters.
Match the request against the routes and populate the action, controller and module parameters.
Returns
flRequest The updated request object, if routing fails issues a 404 and never returns.
Throws
|
public
flController
|
#
getController( )
Get the controller based on the results of the previous call to flRouter::route.
Get the controller based on the results of the previous call to flRouter::route.
If the controller can't be loaded then an exception is thrown.
Returns
Throws
flExceptionNotFound.
|
public
string
|
#
getAction( )
Get the action to invoke on the controller.
Get the action to invoke on the controller.
Returns
string The action to route.
|
public
string
|
#
getModule( )
Get the module holding the controller.
Get the module holding the controller.
Returns
string The module to route to.
|
public
string
|
#
assemble( string $name, array $params, boolean $absolute = false, boolean $secure = null )
Assemble a URI using the routing information as a template.
Assemble a URI using the routing information as a template.
Parameters
- $name
- The name of the route to use.
- $params
- To populate the route template with.
- $absolute
- true to create an absolute URI else false for relative.
- $secure
- tue to use https, false for http or null for as per request.
Returns
string The composed URI.
Throws
|
public
flRouter
|
#
loadRouteFiles( string $path )
Load route information from routing files.
Load route information from routing files.
Parameters
- $path
- The path and file pattern to load route files from.
Returns
|