interface router_interface

internal  
 

Contract for the framework router responsible for route storage and URL generation.

Methods

void
initialize_context()

Initialize routing context based on current request globals.

void
register_default_routes()

Register default internal routes required by the framework.

void
scan_annotations(ContainerInterface $container, string|null $specific_class = null)

Scan controller annotations to populate route collection.

RouteCollection
get_routes()

Get the full set of registered routes.

RequestContext|null
get_context()

Get the active request context, if initialized.

moodle_url
generate_url(string $route, array $parameters, int $reference_type)

Generate a Moodle URL for the given route name.

void
register(string $name, string $path, string $controller, string $method, array $requirements = [])

Register a single route mapping to a controller action.

Details

at line 35
void initialize_context()

Initialize routing context based on current request globals.

Return Value

void

at line 40
void register_default_routes()

Register default internal routes required by the framework.

Return Value

void

at line 48
void scan_annotations(ContainerInterface $container, string|null $specific_class = null)

Scan controller annotations to populate route collection.

Parameters

ContainerInterface $container

DI container with controllers

string|null $specific_class

Optional FQCN to limit the scan

Return Value

void

at line 53
RouteCollection get_routes()

Get the full set of registered routes.

Return Value

RouteCollection

at line 58
RequestContext|null get_context()

Get the active request context, if initialized.

Return Value

RequestContext|null

at line 67
moodle_url generate_url(string $route, array $parameters, int $reference_type)

Generate a Moodle URL for the given route name.

Parameters

string $route

Route identifier

array $parameters

Route parameters

int $reference_type

Symfony reference type constant

Return Value

moodle_url

at line 78
void register(string $name, string $path, string $controller, string $method, array $requirements = [])

Register a single route mapping to a controller action.

Parameters

string $name

Unique route name

string $path

Route path

string $controller

FQCN of controller

string $method

Controller method

array $requirements

Parameter regex requirements

Return Value

void