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 34
static void
init()
Initialize the application kernel.
Idempotent: safe to call multiple times.
at line 40
static void
shutdown()
Shutdown the kernel and reset the singleton.
Useful for testing isolation.
at line 45
static void
handle()
Handle the current HTTP request and dispatch it to the appropriate controller.
at line 56
static object
get(string $id)
Retrieve a service from the DI container.
at line 61
static router_interface
routing()
Access the Route Manager directly.
at line 67
static middag_interface
get_instance()
Singleton Accessor (Factory Method).
Used by the Container to register 'middag' as a service.
at line 72
static bool
is_testing()
Check if running in PHPUnit test environment.
at line 77
static bool
is_development()
Check if running in development environment.
at line 82
static bool
is_production()
Check if running in production environment.
at line 93
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 108
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 123
static void
register_route(string $name, string $path, string $controller_class, string $method, array $requirements = [])
Register a new route manually.
at line 138
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.