Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
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.
 
string const ROUTE_GROUP_PAGE = '/'
 The route path prefix to use for API calls.
 
string const ROUTE_GROUP_SHIM = 'shim'
 The route path prefix to use for API calls.
 

Protected Member Functions

 configure_api_routes (App $app, string $path)
 Configure all API routes.
 
 configure_shim_routes (App $app)
 Configure all route shims.
 
 configure_standard_routes (App $app)
 Configure all standard 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, ?callable $filtercallback=null,)
 Get all routes in the namespace.
 
 get_all_shimmed_routes ()
 Fetch all shimmed routes.
 
 get_all_standard_routes ()
 Fetch all standard routes.
 
 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.

◆ configure_shim_routes()

core\router\route_loader::configure_shim_routes ( App $app)
protected

Configure all route shims.

Parameters
App$app
Return values
RouteGroupInterface

◆ configure_standard_routes()

core\router\route_loader::configure_standard_routes ( App $app)
protected

Configure all standard routes.

Parameters
App$app
Return values
RouteGroupInterface

◆ 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,
?callable $filtercallback = null )
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
null | callable$filtercallbackA callback to use to filter routes before they are added
Return values
array[]

◆ get_all_shimmed_routes()

core\router\route_loader::get_all_shimmed_routes ( )
protected

Fetch all shimmed routes.

Shimmed routes are routes that are not part of the standard route namespace but allow backwards compatibility with pages which have been moved to the new routing system.

Note: This method caches results in MUC.

Return values
array|bool|mixed

◆ get_all_standard_routes()

core\router\route_loader::get_all_standard_routes ( )
protected

Fetch all standard routes.

Note: This method caches results in MUC.

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: