Skip to content

Internals Router Events EDynamicRouteListener

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

router\events\EDynamicRouteListener

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/router/events/EDynamicRouteListener.php · Snapshot 8411f4287706.

Routing separates definition, HTTP request snapshot, matching, method policy, execution and error responses. Collaborators can be replaced through constructor injection.

Imports and dependencies

use event\interfaces\IEvent;
use event\interfaces\IEventListener;
use router\manager\RouterManager;
use router\interface\IRouterManager;

EDynamicRouteListener

Declaration and architectural role

final class EDynamicRouteListener implements IEventListener

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
$routerManager private IRouterManager $routerManager; Used by addManager(), handle().
Constructor-promoted public function __construct(?IRouterManager $routerManager = null) Initialized from the constructor argument; default expression is evaluated when the argument is omitted.

Method index

Method Signature
__construct public function __construct(?IRouterManager $routerManager = null)
addManager public function addManager(?IRouterManager $routerManager): void
handle public function handle(IEvent $event): array

__construct

Source line 15

public function __construct(?IRouterManager $routerManager = null)

Parameters

Parameter Type, modifiers and default Purpose
$routerManager ?IRouterManager $routerManager = null Operation input; the exact use, validation and propagation are shown in the implementation trace.

Delegates to addManager().

Implementation, validation guards and interaction order
public function __construct(?IRouterManager $routerManager = null)
    {
        $this->addManager($routerManager);
    }

addManager

Source line 20

public function addManager(?IRouterManager $routerManager): void

Parameters

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

State writes: $this->routerManager.

Implementation, validation guards and interaction order
public function addManager(?IRouterManager $routerManager): void
    {
        if($routerManager === null) {
            $this->routerManager = new RouterManager();
        } else {
            $this->routerManager = $routerManager;
        }
    }

handle

Source line 28

public function handle(IEvent $event): array

Parameters

Parameter Type, modifiers and default Purpose
$event IEvent $event Event object; its name selects listeners and its bundle carries their payload.

Return expressions (including local callbacks): [].

Implementation, validation guards and interaction order
public function handle(IEvent $event): array
    {
        $this->routerManager->loadRouters($event->bundle());
        return [];
    }

Related types

Clone this wiki locally