LILO route chain implementation.
Aggregates routes and lookups the first route that matches the request without an explicit RouteException.
Use ChainedRouter::route() for filling the chain with your own common application-wide routes.
Example:
$router->route("blogEntry", "/blog:controller/entry:action/?id");
Definition at line 34 of file ChainedRouter.class.php.

Public Member Functions | |
| __construct (IRouteDispatcher $dispatcher) | |
| addRoute ($name, Route $route) | |
| Appends the Route to the chain. | |
| addRoutes (array $routes) | |
| Appends the set of named routes to the chain. | |
| appendRoute ($name, Route $route) | |
| Appends the Route to the chain. | |
| getDefaultDispatcher () | |
| Gets the default dispatcher for newly created routes. | |
| getFallbackTrace (Trace $parentTrace) | |
| Gets the Trace suitable for situation when the matched Trace was unable to handle the IWebContext. | |
| getRoute ($name) | |
| Gets the named Route. | |
| getTrace (IWebContext $webContext) | |
| Gets the Trace that can handle IWebContext, or null if no Route found that matches the IWebContext. | |
| prependRoute ($name, Route $route) | |
| Prepends the Route to the chain. | |
| route ($name, $uri=null, array $parameters=array()) | |
| Smart route assembler. | |
| setFallbackRoute (Route $route) | |
| Sets the fallback Route. | |
| ChainedRouter::__construct | ( | IRouteDispatcher $ | dispatcher | ) |
| IRouteDispatcher | $dispatcher a default dispatcher for routes |
Definition at line 59 of file ChainedRouter.class.php.
| ChainedRouter::addRoute | ( | $ | name, | |
| Route $ | route | |||
| ) |
Appends the Route to the chain.
Definition at line 168 of file ChainedRouter.class.php.
References appendRoute().
Referenced by addRoutes(), and route().
| ChainedRouter::addRoutes | ( | array $ | routes | ) |
Appends the set of named routes to the chain.
Definition at line 196 of file ChainedRouter.class.php.
References addRoute().
| ChainedRouter::appendRoute | ( | $ | name, | |
| Route $ | route | |||
| ) |
Appends the Route to the chain.
Definition at line 213 of file ChainedRouter.class.php.
References Assert::isFalse(), and Assert::isScalar().
Referenced by addRoute().
| ChainedRouter::getDefaultDispatcher | ( | ) |
Gets the default dispatcher for newly created routes.
Definition at line 69 of file ChainedRouter.class.php.
| ChainedRouter::getFallbackTrace | ( | Trace $ | parentTrace | ) |
Gets the Trace suitable for situation when the matched Trace was unable to handle the IWebContext.
| Trace | $parentTrace trace that was unable to handle the IWebContext |
Implements IRouter.
Definition at line 151 of file ChainedRouter.class.php.
References Trace::getWebContext().
| ChainedRouter::getRoute | ( | $ | name | ) |
Gets the named Route.
| string | $name name of the Route |
| ArgumentException | if named route not found |
Implements IRouteTable.
Definition at line 243 of file ChainedRouter.class.php.
References Assert::isScalar().
| ChainedRouter::getTrace | ( | IWebContext $ | webContext | ) |
Gets the Trace that can handle IWebContext, or null if no Route found that matches the IWebContext.
| IWebContext | $webContext the route should be matched against |
Implements IRouter.
Definition at line 130 of file ChainedRouter.class.php.
| ChainedRouter::prependRoute | ( | $ | name, | |
| Route $ | route | |||
| ) |
Prepends the Route to the chain.
Definition at line 232 of file ChainedRouter.class.php.
References Assert::isFalse(), and Assert::isScalar().
| ChainedRouter::route | ( | $ | name, | |
| $ | uri = null, |
|||
| array $ | parameters = array() | |||
| ) |
Smart route assembler.
Accepts the name of the route to be assembled, URI to be used as a template for the rules.
Example:
$router->route("blogEntry", "/blog:controller/entry:action/?id");
In future, the third parameter will be allowed to contain various objects that will be smartly mapped to appropriate rules.
| string | $name name of the route | |
| string | $uri URI that will be used as request variables template | |
| array | $parameters array of parameters to be appended to Trace |
Definition at line 92 of file ChainedRouter.class.php.
References addRoute(), WebRequestPart::GET, Assert::isScalar(), and Assert::isScalarOrNull().
| ChainedRouter::setFallbackRoute | ( | Route $ | route | ) |
Sets the fallback Route.
Fallback Route will be used to handle situation when no Route matched an IWebContext
Definition at line 182 of file ChainedRouter.class.php.