Skip to content

Internals Runtime Api RuntimeRouterAPI

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

runtime\api\RuntimeRouterAPI

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/runtime/api/RuntimeRouterAPI.php · Snapshot 8411f4287706.

Runtime state, package API classes, loader, executor and orchestrator have separate responsibilities. Dependency validation precedes package code and nested execution restores context.

Imports and dependencies

use router\interface\IRoute;
use router\interface\IRouter;
use runtime\enums\ERuntimeFlags;
use runtime\interface\api\IRuntimeRouterCapabilities;

RuntimeRouterAPI

Declaration and architectural role

abstract class RuntimeRouterAPI extends RuntimeAPI implements IRuntimeRouterCapabilities, IRouter

Constants, enum cases, traits and properties

Declarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.

Member Declaration Purpose or source contract
$routers public array $routers = []; Used by addRouter(), getRouters().

Method index

Method Signature
environmentSetup public function environmentSetup(): void
addRouter public function addRouter(IRoute $router): void
getRouters public function getRouters(): array

environmentSetup

Source line 10

public function environmentSetup(): void

Delegates to setRuntimeFlag().

Implementation, validation guards and interaction order
public function environmentSetup(): void
    {
        parent::environmentSetup();
        foreach ([ERuntimeFlags::Router, ERuntimeFlags::CreatePassable, ERuntimeFlags::AccessOtherInstances, ERuntimeFlags::EventDispatcher] as $flag) {
            $this->setRuntimeFlag($flag);
        }
    }

addRouter

Source line 17

public function addRouter(IRoute $router): void

Parameters

Parameter Type, modifiers and default Purpose
$router IRoute $router Operation input; the exact use, validation and propagation are shown in the implementation trace.

State writes: $this->routers[].

Implementation, validation guards and interaction order
public function addRouter(IRoute $router): void
    {
        $router->addEventDispatcher($this->eventDispatcher);
        $this->routers[] = $router;
    }

getRouters

Source line 22

public function getRouters(): array

Return expressions (including local callbacks): $this->routers.

Implementation, validation guards and interaction order
public function getRouters(): array { return $this->routers; }

Related types

Clone this wiki locally