ILIAS
Release_4_4_x_branch Revision 61816
|
Public Member Functions | |
__construct ($pattern, $callable) | |
Constructor. | |
getPattern () | |
Get route pattern. | |
setPattern ($pattern) | |
Set route pattern. | |
getCallable () | |
Get route callable. | |
setCallable ($callable) | |
Set route callable. | |
getConditions () | |
Get route conditions. | |
setConditions (array $conditions) | |
Set route conditions. | |
getName () | |
Get route name. | |
setName ($name) | |
Set route name. | |
getParams () | |
Get route parameters. | |
setHttpMethods () | |
Add supported HTTP method(s) | |
getHttpMethods () | |
Get supported HTTP methods. | |
appendHttpMethods () | |
Append supported HTTP methods. | |
via () | |
Append supported HTTP methods (alias for Route::appendHttpMethods) | |
supportsHttpMethod ($method) | |
Detect support for an HTTP method. | |
getRouter () | |
Get router. | |
setRouter (Slim_Router $router) | |
Set router. | |
getMiddleware () | |
Get middleware. | |
setMiddleware ($middleware) | |
Set middleware. | |
matches ($resourceUri) | |
Matches URI? | |
name ($name) | |
Set route name. | |
conditions (array $conditions) | |
Merge route conditions. | |
dispatch () | |
Dispatch route. |
Static Public Member Functions | |
static | setDefaultConditions (array $defaultConditions) |
Set default route conditions for all instances. | |
static | getDefaultConditions () |
Get default route conditions for all instances. |
Protected Member Functions | |
convertPatternToRegex ($matches) | |
Convert a URL parameter (ie. |
Protected Attributes | |
$pattern | |
$callable | |
$conditions = array() | |
$name | |
$params = array() | |
$methods = array() | |
$router | |
$middleware = array() |
Static Protected Attributes | |
static | $defaultConditions = array() |
Slim_Route::__construct | ( | $pattern, | |
$callable | |||
) |
Constructor.
string | $pattern | The URL pattern (ie. "/books/:id") |
mixed | $callable | Anything that returns TRUE for is_callable() |
Definition at line 92 of file Route.php.
References $callable, $pattern, setCallable(), setConditions(), and setPattern().
Slim_Route::appendHttpMethods | ( | ) |
Slim_Route::conditions | ( | array | $conditions | ) |
Merge route conditions.
array | $conditions | Key-value array of URL parameter conditions |
Definition at line 354 of file Route.php.
Referenced by convertPatternToRegex(), and setConditions().
|
protected |
Convert a URL parameter (ie.
":id") into a regular expression
array | URL parameters |
Definition at line 330 of file Route.php.
References conditions().
Slim_Route::dispatch | ( | ) |
Dispatch route.
This method invokes this route's callable. If middleware is registered for this route, each callable middleware is invoked in the order specified.
This method is smart about trailing slashes on the route pattern. If this route's pattern is defined with a trailing slash, and if the current request URI does not have a trailing slash but otherwise matches this route's pattern, a Slim_Exception_RequestSlash will be thrown triggering an HTTP 301 Permanent Redirect to the same URI with a trailing slash. This Exception is caught in the Slim::run
loop. If this route's pattern is defined without a trailing slash, and if the current request URI does have a trailing slash, this route will not be matched and a 404 Not Found response will be sent if no subsequent matching routes are found.
Slim_Exception_RequestSlash |
Definition at line 380 of file Route.php.
References getCallable().
Slim_Route::getCallable | ( | ) |
Get route callable.
Definition at line 136 of file Route.php.
References $callable.
Referenced by dispatch().
Slim_Route::getConditions | ( | ) |
Get route conditions.
Definition at line 153 of file Route.php.
References $conditions.
|
static |
Get default route conditions for all instances.
Definition at line 111 of file Route.php.
References $defaultConditions.
Slim_Route::getHttpMethods | ( | ) |
Slim_Route::getMiddleware | ( | ) |
Get middleware.
Definition at line 257 of file Route.php.
References $middleware.
Slim_Route::getName | ( | ) |
Slim_Route::getParams | ( | ) |
Slim_Route::getPattern | ( | ) |
Slim_Route::getRouter | ( | ) |
Slim_Route::matches | ( | $resourceUri | ) |
Matches URI?
Parse this route's pattern, and then compare it to an HTTP resource URI This method was modeled after the techniques demonstrated by Dan Sosedoff at:
http://blog.sosedoff.com/2009/09/20/rails-like-php-url-router/
string | $resourceUri | A Request URI |
Definition at line 298 of file Route.php.
Slim_Route::name | ( | $name | ) |
Slim_Route::setCallable | ( | $callable | ) |
Set route callable.
mixed | $callable |
Definition at line 145 of file Route.php.
References $callable.
Referenced by __construct().
Slim_Route::setConditions | ( | array | $conditions | ) |
Set route conditions.
array | $conditions |
Definition at line 162 of file Route.php.
References $conditions, and conditions().
Referenced by __construct().
|
static |
Set default route conditions for all instances.
array | $defaultConditions |
Definition at line 103 of file Route.php.
References $defaultConditions.
Slim_Route::setHttpMethods | ( | ) |
Slim_Route::setMiddleware | ( | $middleware | ) |
Set middleware.
This method allows middleware to be assigned to a specific Route. If the method argument is_callable
(including callable arrays!), we directly append the argument to $this->middleware
. Else, we assume the argument is an array of callables and merge the array with $this->middleware
. Even if non-callables are included in the argument array, we still merge them; we lazily check each item against is_callable
during Route::dispatch().
Callable|array[Callable] |
InvalidArgumentException | If argument is not callable or not an array |
Definition at line 276 of file Route.php.
References $middleware.
Slim_Route::setName | ( | $name | ) |
Slim_Route::setPattern | ( | $pattern | ) |
Set route pattern.
string | $pattern |
Definition at line 128 of file Route.php.
References $pattern.
Referenced by __construct().
Slim_Route::setRouter | ( | Slim_Router | $router | ) |
Set router.
Slim_Router | $router |
Definition at line 249 of file Route.php.
References $router.
Slim_Route::supportsHttpMethod | ( | $method | ) |
Slim_Route::via | ( | ) |
Append supported HTTP methods (alias for Route::appendHttpMethods)
Definition at line 222 of file Route.php.
|
protected |
Definition at line 50 of file Route.php.
Referenced by __construct(), getCallable(), and setCallable().
|
protected |
Definition at line 55 of file Route.php.
Referenced by getConditions(), and setConditions().
|
staticprotected |
Definition at line 60 of file Route.php.
Referenced by getDefaultConditions(), and setDefaultConditions().
|
protected |
Definition at line 75 of file Route.php.
Referenced by getHttpMethods().
|
protected |
Definition at line 85 of file Route.php.
Referenced by getMiddleware(), and setMiddleware().
|
protected |
|
protected |
Definition at line 70 of file Route.php.
Referenced by getParams().
|
protected |
Definition at line 45 of file Route.php.
Referenced by __construct(), getPattern(), and setPattern().
|
protected |
Definition at line 80 of file Route.php.
Referenced by getRouter(), and setRouter().