Moodle PHP Documentation 5.0
Moodle 5.0.1+ (Build: 20250711) (61af040cd5f)
Slim\Routing\RouteCollector Class Reference

RouteCollector is used to collect routes and route groups as well as generate paths and URLs relative to its environment. More...

Inheritance diagram for Slim\Routing\RouteCollector:
Slim\Interfaces\RouteCollectorInterface

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.
Parameters
string$nameRoute name
Exceptions
RuntimeExceptionIf named route does not exist
}
 
 getRouteParser ()
 Get the route parser.
 
 getRoutes ()
 {Get route objects.
Return values
RouteInterface[]
}
 
 group (string $pattern, $callable)
 {Add route group.
Parameters
string | callable$callable
}
 
 lookupRoute (string $identifier)
 {Lookup a route via the route's unique identifier.
Exceptions
RuntimeExceptionIf route of identifier does not exist
}
 
 map (array $methods, string $pattern, $handler)
 {Add route.
Parameters
string[]$methodsArray of HTTP methods
string$patternThe route pattern
callable | string$handlerThe route callable
}
 
 removeNamedRoute (string $name)
 {Remove named route.
Parameters
string$nameRoute name
Exceptions
RuntimeExceptionIf named route does not exist
}
 
 setBasePath (string $basePath)
 Set the base path used in urlFor()
 
 setCacheFile (string $cacheFile)
 {Set path to FastRoute cache file.
Exceptions
InvalidArgumentException
RuntimeException
}
 
 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.
 

Detailed Description

RouteCollector is used to collect routes and route groups as well as generate paths and URLs relative to its environment.

Member Function Documentation

◆ createGroup()

Slim\Routing\RouteCollector::createGroup ( string $pattern,
$callable )
protected
Parameters
string | callable$callable

◆ createRoute()

Slim\Routing\RouteCollector::createRoute ( array $methods,
string $pattern,
$callable )
protected
Parameters
string[]$methods
callable | string$callable

◆ getBasePath()

Slim\Routing\RouteCollector::getBasePath ( )

{Get the base path used in pathFor()}

Implements Slim\Interfaces\RouteCollectorInterface.

◆ getCacheFile()

Slim\Routing\RouteCollector::getCacheFile ( )

{Get path to FastRoute cache file.}

Implements Slim\Interfaces\RouteCollectorInterface.

◆ getDefaultInvocationStrategy()

Slim\Routing\RouteCollector::getDefaultInvocationStrategy ( )

Get default route invocation strategy.

Implements Slim\Interfaces\RouteCollectorInterface.

◆ getNamedRoute()

Slim\Routing\RouteCollector::getNamedRoute ( string $name)

{Get named route object.

Parameters
string$nameRoute name
Exceptions
RuntimeExceptionIf named route does not exist
}

Implements Slim\Interfaces\RouteCollectorInterface.

◆ getRouteParser()

Slim\Routing\RouteCollector::getRouteParser ( )

Get the route parser.

Implements Slim\Interfaces\RouteCollectorInterface.

◆ getRoutes()

Slim\Routing\RouteCollector::getRoutes ( )

{Get route objects.

Return values
RouteInterface[]
}

Implements Slim\Interfaces\RouteCollectorInterface.

◆ group()

Slim\Routing\RouteCollector::group ( string $pattern,
$callable )

{Add route group.

Parameters
string | callable$callable
}

Implements Slim\Interfaces\RouteCollectorInterface.

◆ lookupRoute()

Slim\Routing\RouteCollector::lookupRoute ( string $identifier)

{Lookup a route via the route's unique identifier.

Exceptions
RuntimeExceptionIf route of identifier does not exist
}

Implements Slim\Interfaces\RouteCollectorInterface.

◆ map()

Slim\Routing\RouteCollector::map ( array $methods,
string $pattern,
$handler )

{Add route.

Parameters
string[]$methodsArray of HTTP methods
string$patternThe route pattern
callable | string$handlerThe route callable
}

Implements Slim\Interfaces\RouteCollectorInterface.

◆ removeNamedRoute()

Slim\Routing\RouteCollector::removeNamedRoute ( string $name)

{Remove named route.

Parameters
string$nameRoute name
Exceptions
RuntimeExceptionIf named route does not exist
}

Implements Slim\Interfaces\RouteCollectorInterface.

◆ setBasePath()

Slim\Routing\RouteCollector::setBasePath ( string $basePath)

Set the base path used in urlFor()

Implements Slim\Interfaces\RouteCollectorInterface.

◆ setCacheFile()

Slim\Routing\RouteCollector::setCacheFile ( string $cacheFile)

{Set path to FastRoute cache file.

Exceptions
InvalidArgumentException
RuntimeException
}

Implements Slim\Interfaces\RouteCollectorInterface.

◆ setDefaultInvocationStrategy()

Slim\Routing\RouteCollector::setDefaultInvocationStrategy ( InvocationStrategyInterface $strategy)

Set default route invocation strategy.

Implements Slim\Interfaces\RouteCollectorInterface.

Member Data Documentation

◆ $cacheFile

string Slim\Routing\RouteCollector::$cacheFile = null
protected

Path to fast route cache file.

Set to null to disable route caching


The documentation for this class was generated from the following file: