ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Public Member Functions | |
__construct (RouteParser $parser=null) | |
Create new router. More... | |
setBasePath ($basePath) | |
Set the base path used in pathFor() More... | |
setCacheFile ($cacheFile) | |
Set path to fast route cache file. More... | |
setContainer (ContainerInterface $container) | |
map ($methods, $pattern, $handler) | |
Add route. More... | |
dispatch (ServerRequestInterface $request) | |
Dispatch router for HTTP request. More... | |
setDispatcher (Dispatcher $dispatcher) | |
getRoutes () | |
Get route objects. More... | |
getNamedRoute ($name) | |
Get named route object. More... | |
removeNamedRoute ($name) | |
Remove named route. More... | |
pushGroup ($pattern, $callable) | |
Add a route group to the array. More... | |
popGroup () | |
Removes the last route group from the array. More... | |
lookupRoute ($identifier) | |
relativePathFor ($name, array $data=[], array $queryParams=[]) | |
Build the path for a named route excluding the base path. More... | |
pathFor ($name, array $data=[], array $queryParams=[]) | |
Build the path for a named route including the base path. More... | |
urlFor ($name, array $data=[], array $queryParams=[]) | |
Build the path for a named route. More... | |
Protected Member Functions | |
createRoute ($methods, $pattern, $callable) | |
Create a new Route object. More... | |
createDispatcher () | |
processGroups () | |
Process route groups. More... | |
Protected Attributes | |
$container | |
$routeParser | |
$basePath = '' | |
$cacheFile = false | |
$routes = [] | |
$routeCounter = 0 | |
$routeGroups = [] | |
$dispatcher | |
Additional Inherited Members | |
Data Fields inherited from Slim\Interfaces\RouterInterface | |
const | DISPATCH_STATUS = 0 |
const | ALLOWED_METHODS = 1 |
This class organizes Slim application route objects. It is responsible for registering route objects, assigning names to route objects, finding routes that match the current HTTP request, and creating URLs for a named route.
Definition at line 31 of file Router.php.
Slim\Router::__construct | ( | RouteParser | $parser = null | ) |
Create new router.
RouteParser | $parser |
Definition at line 91 of file Router.php.
References $parser.
|
protected |
|
protected |
Create a new Route object.
string[] | $methods Array of HTTP methods | |
string | $pattern | The route pattern |
callable | $callable | The route callable |
Definition at line 206 of file Router.php.
Slim\Router::dispatch | ( | ServerRequestInterface | $request | ) |
Dispatch router for HTTP request.
ServerRequestInterface | $request | The current HTTP request object |
https://github.com/nikic/FastRoute/blob/master/src/Dispatcher.php
Implements Slim\Interfaces\RouterInterface.
Definition at line 187 of file Router.php.
References Psr\Http\Message\RequestInterface\getMethod(), and Psr\Http\Message\RequestInterface\getUri().
Slim\Router::getNamedRoute | ( | $name | ) |
Get named route object.
string | $name | Route name |
RuntimeException | If named route does not exist |
Implements Slim\Interfaces\RouterInterface.
Definition at line 272 of file Router.php.
References $name.
Slim\Router::getRoutes | ( | ) |
Slim\Router::lookupRoute | ( | $identifier | ) |
$identifier |
Implements Slim\Interfaces\RouterInterface.
Definition at line 341 of file Router.php.
Slim\Router::map | ( | $methods, | |
$pattern, | |||
$handler | |||
) |
Add route.
string[] | $methods Array of HTTP methods | |
string | $pattern | The route pattern |
callable | $handler | The route callable |
InvalidArgumentException | if the route pattern isn't a string |
Implements Slim\Interfaces\RouterInterface.
Definition at line 156 of file Router.php.
References $handler.
Slim\Router::pathFor | ( | $name, | |
array | $data = [] , |
||
array | $queryParams = [] |
||
) |
Build the path for a named route including the base path.
string | $name | Route name |
array | $data | Named argument replacement data |
array | $queryParams | Optional query string parameters |
RuntimeException | If named route does not exist |
InvalidArgumentException | If required data not provided |
Implements Slim\Interfaces\RouterInterface.
Definition at line 425 of file Router.php.
References $data, $name, and $url.
Slim\Router::popGroup | ( | ) |
Removes the last route group from the array.
Implements Slim\Interfaces\RouterInterface.
Definition at line 331 of file Router.php.
|
protected |
Process route groups.
Definition at line 302 of file Router.php.
Slim\Router::pushGroup | ( | $pattern, | |
$callable | |||
) |
Add a route group to the array.
string | $pattern | |
callable | $callable |
Implements Slim\Interfaces\RouterInterface.
Definition at line 319 of file Router.php.
Slim\Router::relativePathFor | ( | $name, | |
array | $data = [] , |
||
array | $queryParams = [] |
||
) |
Build the path for a named route excluding the base path.
string | $name | Route name |
array | $data | Named argument replacement data |
array | $queryParams | Optional query string parameters |
RuntimeException | If named route does not exist |
InvalidArgumentException | If required data not provided |
Implements Slim\Interfaces\RouterInterface.
Definition at line 361 of file Router.php.
References $data, $name, and $url.
Slim\Router::removeNamedRoute | ( | $name | ) |
Remove named route.
string | $name | Route name |
RuntimeException | If named route does not exist |
Definition at line 289 of file Router.php.
References $name.
Slim\Router::setBasePath | ( | $basePath | ) |
Set the base path used in pathFor()
string | $basePath |
Definition at line 103 of file Router.php.
Slim\Router::setCacheFile | ( | $cacheFile | ) |
Set path to fast route cache file.
If this is false then route caching is disabled.
string | false | $cacheFile |
Definition at line 121 of file Router.php.
Slim\Router::setContainer | ( | ContainerInterface | $container | ) |
ContainerInterface | $container |
Definition at line 140 of file Router.php.
References $container.
Slim\Router::setDispatcher | ( | Dispatcher | $dispatcher | ) |
Slim\Router::urlFor | ( | $name, | |
array | $data = [] , |
||
array | $queryParams = [] |
||
) |
Build the path for a named route.
This method is deprecated. Use pathFor() from now on.
string | $name | Route name |
array | $data | Named argument replacement data |
array | $queryParams | Optional query string parameters |
RuntimeException | If named route does not exist |
InvalidArgumentException | If required data not provided |
Definition at line 450 of file Router.php.
|
protected |
Definition at line 52 of file Router.php.
|
protected |
Definition at line 59 of file Router.php.
|
protected |
Definition at line 38 of file Router.php.
|
protected |
Definition at line 84 of file Router.php.
|
protected |
Definition at line 72 of file Router.php.
|
protected |
Definition at line 79 of file Router.php.
|
protected |
Definition at line 45 of file Router.php.
|
protected |
Definition at line 66 of file Router.php.