Moodle PHP Documentation 4.5
Moodle 4.5.5+ (Build: 20250711) (ce34e8ff087)
core\router\route_loader Class Reference
Inheritance diagram for core\router\route_loader:
core\router\abstract_route_loader core\router\route_loader_interface

Public Member Functions

 configure_routes (App $app)
 Configure all routes for the Application.
 

Public Attributes

string const ROUTE_GROUP_API = '/api/rest/v2'
 The route path prefix to use for API calls.
 

Protected Member Functions

 configure_api_routes (App $app, string $path)
 Configure all API routes.
 
 get_all_api_routes ()
 Fetch all API routes.
 
 get_all_routes_in_class (string $componentpath, ReflectionClass $classinfo,)
 Get all routes in a class.
 
 get_all_routes_in_namespace (string $namespace, callable $componentpathcallback,)
 Get all routes in the namespace.
 
 get_route_attribute_for_method (ReflectionClass $classinfo, ReflectionMethod $methodinfo,)
 Get the route attribute for the specified method.
 
 get_route_data_for_method (string $componentpath, ReflectionClass $classinfo, ReflectionMethod $methodinfo,)
 Get route data for a single method in a class.
 
 normalise_component_path (string $component,)
 Normalise the component for use as part of the path.
 
 set_route_name_for_callable (RouteInterface $slimroute, string|array|callable $callable,)
 Set a route name for the specified callable.
 

Member Function Documentation

◆ configure_api_routes()

core\router\route_loader::configure_api_routes ( App $app,
string $path )
protected

Configure all API routes.

Parameters
App$app
string$path
Return values
RouteGroupInterface

◆ configure_routes()

core\router\route_loader::configure_routes ( App $app)

Configure all routes for the Application.

This method returns a set of RouteGroupInterface instances for each route prefix.

Parameters
App$appThe application to configure routes for
Return values
RouteInterface[]|RouteGroupInterface

Implements core\router\route_loader_interface.

◆ get_all_api_routes()

core\router\route_loader::get_all_api_routes ( )
protected

Fetch all API routes.

Note: This method caches results in MUC.

Return values
array[]

◆ get_all_routes_in_class()

core\router\abstract_route_loader::get_all_routes_in_class ( string $componentpath,
ReflectionClass $classinfo )
protectedinherited

Get all routes in a class.

Parameters
string$componentpathThe path to the component that the class belongs to
ReflectionClass$classinfoThe class to get the routes for
Return values
array[]

◆ get_all_routes_in_namespace()

core\router\abstract_route_loader::get_all_routes_in_namespace ( string $namespace,
callable $componentpathcallback )
protectedinherited

Get all routes in the namespace.

Parameters
string$namespaceThe namespace to get the routes for
callable$componentpathcallbackA callback to get the component path for a class
Return values
array[]

◆ get_route_attribute_for_method()

core\router\abstract_route_loader::get_route_attribute_for_method ( ReflectionClass $classinfo,
ReflectionMethod $methodinfo )
protectedinherited

Get the route attribute for the specified method.

Note: If a parent has a route, but the method does not, no route will be returned.

Parameters
ReflectionClass$classinfoThe class to get the route attribute for
ReflectionMethod$methodinfoThe method to get the route attribute for
Return values
null|route

◆ get_route_data_for_method()

core\router\abstract_route_loader::get_route_data_for_method ( string $componentpath,
ReflectionClass $classinfo,
ReflectionMethod $methodinfo )
protectedinherited

Get route data for a single method in a class.

Parameters
string$componentpathThe path to the component that the class belongs to
ReflectionClass$classinfoThe class to get the route data for
ReflectionMethod$methodinfoThe method to get the route data for
Return values
null|array[]

◆ normalise_component_path()

core\router\abstract_route_loader::normalise_component_path ( string $component)
protectedinherited

Normalise the component for use as part of the path.

If the component is a subsystem, the core_ prefix will be removed. If the component is 'core', it will be kept. All other components will use their frankenstyle name.

Parameters
string$component
Return values
string

◆ set_route_name_for_callable()

core\router\abstract_route_loader::set_route_name_for_callable ( RouteInterface $slimroute,
string|array|callable $callable )
protectedinherited

Set a route name for the specified callable.

Parameters
RouteInterface$slimroute
string | array | callable$callable
Return values
string|nullThe name of the route if it was set, otherwise null

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