middag_interface
interface middag_interface
Central contract for the Middag entrypoint singleton.
Exposes kernel lifecycle operations, routing helpers, and service locator access for legacy contexts that cannot rely on constructor injection.
Methods
Initialize the application kernel.
Shutdown the kernel and reset the singleton.
Handle the current HTTP request and dispatch it to the appropriate controller.
Retrieve a service from the DI container.
Access the Route Manager directly.
Singleton Accessor (Factory Method).
Check if running in PHPUnit test environment.
Check if running in development environment.
Check if running in production environment.
Generate a Moodle URL from a Symfony route name and parameters.
Generate a webhook URL (helper for callbacks).
Register a new route manually.
Register routes from PHP 8 Attributes (#[Route]) in a class.
Details
at line 36
static void
init()
Initialize the application kernel.
Idempotent: safe to call multiple times.
at line 42
static void
shutdown()
Shutdown the kernel and reset the singleton.
Useful for testing isolation.
at line 47
static void
handle()
Handle the current HTTP request and dispatch it to the appropriate controller.
at line 58
static object
get(string $id)
Retrieve a service from the DI container.
at line 63
static router_interface
routing()
Access the Route Manager directly.
at line 69
static middag_interface
get_instance()
Singleton Accessor (Factory Method).
Used by the Container to register 'middag' as a service.
at line 74
static bool
is_testing()
Check if running in PHPUnit test environment.
at line 79
static bool
is_development()
Check if running in development environment.
at line 84
static bool
is_production()
Check if running in production environment.
at line 95
static moodle_url
url_generator(string $route, array $parameters = [], int $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH)
Generate a Moodle URL from a Symfony route name and parameters.
at line 110
static moodle_url
webhook_url_generator(string $route, array $parameters = [], int $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH)
Generate a webhook URL (helper for callbacks).
at line 125
static void
register_route(string $name, string $path, string $controller_class, string $method, array $requirements = [])
Register a new route manually.
at line 140
static void
register_routes_from_annotations(string $class_name)
Register routes from PHP 8 Attributes (#[Route]) in a class.
Must be called BEFORE the container is compiled.