Skip to content

Internals Router Interface IRoute

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

router\interface\IRoute

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/router/interface/IRoute.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 controller\Controller;
use event\EventDispatcher;
use middleware\IMiddleware;
use object\ObjectFactory;
use redirect\Redirect;
use response\Response;
use view\View;

IRoute

Declaration and architectural role

interface IRoute

Constants, enum cases, traits and properties

No own constants, enum cases, traits or property declarations. Inherited members are documented on the parent reference page.

Method index

Method Signature
getName public function getName(): ?string
setName public function setName(string $name): self
getPath public function getPath(): string
getAction public function getAction(): string
getAlias public function getAlias(): ?string
setAlias public function setAlias(string $alias): self
isService public function isService(): bool
getController public function getController(): ObjectFactory|Controller
setController public function setController(ObjectFactory|Controller $controller): self
getEventDispatcher public function getEventDispatcher(): EventDispatcher
addEventDispatcher public function addEventDispatcher(EventDispatcher $eventDispatcher): self
getMiddleware public function getMiddleware(): ?IMiddleware
addMiddleware public function addMiddleware(IMiddleware $middleware): self
getMethod public function getMethod(): string
setMethod public function setMethod(string $method): self
requiresCsrf public function requiresCsrf(): bool
withoutCsrf public function withoutCsrf(): self
match public function match(string $requestPath): ?array
route public function route(array $params = [], ?IRequest $request = null): View|Redirect|Response

getName

Source line 15

public function getName(): ?string;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

setName

Source line 16

public function setName(string $name): self;

Parameters

Parameter Type, modifiers and default Purpose
$name string $name Named key/label selected by this API; its exact scope is shown by the implementation trace.

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

getPath

Source line 17

public function getPath(): string;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

getAction

Source line 18

public function getAction(): string;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

getAlias

Source line 19

public function getAlias(): ?string;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

setAlias

Source line 20

public function setAlias(string $alias): self;

Parameters

Parameter Type, modifiers and default Purpose
$alias string $alias Resource alias or route metadata alias according to this component.

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

isService

Source line 21

public function isService(): bool;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

getController

Source line 22

public function getController(): ObjectFactory|Controller;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

setController

Source line 23

public function setController(ObjectFactory|Controller $controller): self;

Parameters

Parameter Type, modifiers and default Purpose
$controller ObjectFactory|Controller $controller Controller instance or lazy ObjectFactory depending on the union type.

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

getEventDispatcher

Source line 24

public function getEventDispatcher(): EventDispatcher;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

addEventDispatcher

Source line 25

public function addEventDispatcher(EventDispatcher $eventDispatcher): self;

Parameters

Parameter Type, modifiers and default Purpose
$eventDispatcher EventDispatcher $eventDispatcher Dispatcher used for synchronous listener registration/dispatch and context propagation.

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

getMiddleware

Source line 26

public function getMiddleware(): ?IMiddleware;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

addMiddleware

Source line 27

public function addMiddleware(IMiddleware $middleware): self;

Parameters

Parameter Type, modifiers and default Purpose
$middleware IMiddleware $middleware Middleware object or class name according to the component; route and storage return handling differ.

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

getMethod

Source line 28

public function getMethod(): string;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

setMethod

Source line 29

public function setMethod(string $method): self;

Parameters

Parameter Type, modifiers and default Purpose
$method string $method HTTP method token; validation/normalization follows the method policy.

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

requiresCsrf

Source line 30

public function requiresCsrf(): bool;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

withoutCsrf

Source line 31

public function withoutCsrf(): self;

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

match

Source line 32

public function match(string $requestPath): ?array;

Parameters

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

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

route

Source line 33

public function route(array $params = [], ?IRequest $request = null): View|Redirect|Response;

Parameters

Parameter Type, modifiers and default Purpose
$params array $params = [] Operation input; the exact use, validation and propagation are shown in the implementation trace.
$request ?IRequest $request = null Request snapshot consumed by matching, method and security checks.

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

Related types

Clone this wiki locally