|
Moodle PHP Documentation 4.5
Moodle 4.5.5+ (Build: 20250711) (ce34e8ff087)
|
RouteCollector is used to collect routes and route groups as well as generate paths and URLs relative to its environment. More...
Public Member Functions | ||||||||||
| __construct (ResponseFactoryInterface $responseFactory, CallableResolverInterface $callableResolver, ?ContainerInterface $container=null, ?InvocationStrategyInterface $defaultInvocationStrategy=null, ?RouteParserInterface $routeParser=null, ?string $cacheFile=null) | ||||||||||
| getBasePath () | ||||||||||
| {Get the base path used in pathFor()} | ||||||||||
| getCacheFile () | ||||||||||
| {Get path to FastRoute cache file.} | ||||||||||
| getDefaultInvocationStrategy () | ||||||||||
| Get default route invocation strategy. | ||||||||||
| getNamedRoute (string $name) | ||||||||||
{Get named route object.
| ||||||||||
| getRouteParser () | ||||||||||
| Get the route parser. | ||||||||||
| getRoutes () | ||||||||||
{Get route objects.
| ||||||||||
| group (string $pattern, $callable) | ||||||||||
{Add route group.
| ||||||||||
| lookupRoute (string $identifier) | ||||||||||
{Lookup a route via the route's unique identifier.
| ||||||||||
| map (array $methods, string $pattern, $handler) | ||||||||||
{Add route.
| ||||||||||
| removeNamedRoute (string $name) | ||||||||||
{Remove named route.
| ||||||||||
| setBasePath (string $basePath) | ||||||||||
| Set the base path used in urlFor() | ||||||||||
| setCacheFile (string $cacheFile) | ||||||||||
{Set path to FastRoute cache file.
| ||||||||||
| setDefaultInvocationStrategy (InvocationStrategyInterface $strategy) | ||||||||||
| Set default route invocation strategy. | ||||||||||
Protected Member Functions | |
| createGroup (string $pattern, $callable) | |
| createProxy (string $pattern) | |
| createRoute (array $methods, string $pattern, $callable) | |
Protected Attributes | |
| string | $basePath = '' |
| Base path used in pathFor() | |
| string | $cacheFile = null |
| Path to fast route cache file. | |
| CallableResolverInterface | $callableResolver |
| ContainerInterface | $container = null |
| InvocationStrategyInterface | $defaultInvocationStrategy |
| ResponseFactoryInterface | $responseFactory |
| int | $routeCounter = 0 |
| Route counter incrementer. | |
| RouteGroupInterface[] array | $routeGroups = [] |
| Route groups. | |
| RouteParserInterface | $routeParser |
| RouteInterface[] array | $routes = [] |
| Routes. | |
| RouteInterface[] array | $routesByName = [] |
| Routes indexed by name. | |
RouteCollector is used to collect routes and route groups as well as generate paths and URLs relative to its environment.
|
protected |
| string | callable | $callable |
|
protected |
| string[] | $methods | |
| callable | string | $callable |
| Slim\Routing\RouteCollector::getBasePath | ( | ) |
{Get the base path used in pathFor()}
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::getCacheFile | ( | ) |
{Get path to FastRoute cache file.}
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::getDefaultInvocationStrategy | ( | ) |
Get default route invocation strategy.
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::getNamedRoute | ( | string | $name | ) |
{Get named route object.
| string | $name | Route name |
| RuntimeException | If named route does not exist |
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::getRouteParser | ( | ) |
Get the route parser.
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::getRoutes | ( | ) |
{Get route objects.
| RouteInterface[] |
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::group | ( | string | $pattern, |
| $callable ) |
{Add route group.
| string | callable | $callable |
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::lookupRoute | ( | string | $identifier | ) |
{Lookup a route via the route's unique identifier.
| RuntimeException | If route of identifier does not exist |
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::map | ( | array | $methods, |
| string | $pattern, | ||
| $handler ) |
{Add route.
| string[] | $methods | Array of HTTP methods |
| string | $pattern | The route pattern |
| callable | string | $handler | The route callable |
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::removeNamedRoute | ( | string | $name | ) |
{Remove named route.
| string | $name | Route name |
| RuntimeException | If named route does not exist |
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::setBasePath | ( | string | $basePath | ) |
Set the base path used in urlFor()
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::setCacheFile | ( | string | $cacheFile | ) |
{Set path to FastRoute cache file.
| InvalidArgumentException | |
| RuntimeException |
Implements Slim\Interfaces\RouteCollectorInterface.
| Slim\Routing\RouteCollector::setDefaultInvocationStrategy | ( | InvocationStrategyInterface | $strategy | ) |
Set default route invocation strategy.
Implements Slim\Interfaces\RouteCollectorInterface.
|
protected |
Path to fast route cache file.
Set to null to disable route caching