Repository navigation
Internals Router Facade Router
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/router/facade/Router.php · Snapshot 8411f4287706.
Routing separates definition, HTTP request snapshot, matching, method policy, execution and error responses. Collaborators can be replaced through constructor injection.
use controller\Controller;
use object\ObjectFactory;
use router\factory\RouteFactory;
use router\interface\IRoute;
use router\interface\IRouteFactory;final class RouterSource description (behavioral corrections are recorded in Known discrepancies):
Static entry point; creation is delegated to a replaceable instance factory.
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 |
|---|---|---|
| $factory | private static ?IRouteFactory $factory = null; |
Used by setFactory(), make(). |
| Method | Signature |
|---|---|
| __construct | private function __construct() |
| setFactory | public static function setFactory(?IRouteFactory $factory): void |
| make | public static function make(string $path, string $action, ObjectFactory|Controller $controller, bool $service = false): IRoute |
private function __construct();Concrete no-op/default hook: this method performs no work. Override it where the lifecycle or extension contract calls for behavior.
public static function setFactory(?IRouteFactory $factory): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$factory |
?IRouteFactory $factory |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
State writes: self::$factory.
Implementation, validation guards and interaction order
public static function setFactory(?IRouteFactory $factory): void
{
self::$factory = $factory;
}public static function make(string $path, string $action, ObjectFactory|Controller $controller, bool $service = false): IRoute| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$path |
string $path |
Filesystem or route path as defined by the owning component; no universal path normalization is implied. |
$action |
string $action |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$controller |
ObjectFactory|Controller $controller |
Controller instance or lazy ObjectFactory depending on the union type. |
$service |
bool $service = false |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
State writes: self::$factory.
Return expressions (including local callbacks): (self::$factory ??= new RouteFactory())->make($path, $action, $controller, $service).
Implementation, validation guards and interaction order
public static function make(string $path, string $action, ObjectFactory|Controller $controller, bool $service = false): IRoute
{
return (self::$factory ??= new RouteFactory())->make($path, $action, $controller, $service);
}AWT Framework Wiki · Home · Installation Guide · Developer Guide · Framework Internals
Philosophy · Architecture · Known discrepancies · Verification
Installation Guide
Developer Guide
- Learning sequence
- First package
- Package structure
- Lifecycle
- Runtimes
- Events and objects
- Routing and controllers
- Views and resources
- Database and models
- Storage and caching
- Configuration and CLI
- Responses and errors
- Extension points
Framework Internals
- Architecture
- Bootstrap
- Packages
- Runtime
- Events and context
- Objects
- HTTP routing and controllers
- Rendering
- Blade integration
- Database
- Models
- Storage and caching
- Settings
- CLI
- Identity and sessions
- Responses
- Errors
- Complete source inventory
Documentation notes