Repository navigation
Internals Router Factory RouteFactory
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/router/factory/RouteFactory.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\execution\RouteExecutor;
use router\http\GlobalsRequestProvider;
use router\http\HttpMethod;
use router\interface\IMethodPolicy;
use router\interface\IPathMatcher;
use router\interface\IRequestProvider;
use router\interface\IRoute;
use router\interface\IRouteExecutor;
use router\interface\IRouteFactory;
use router\matching\SegmentPathMatcher;
use router\Router;final class RouteFactory implements IRouteFactoryDeclarations 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 |
|---|---|---|
| $executor | private readonly IRouteExecutor $executor; |
Used by __construct(), make(). |
| Constructor-promoted | private readonly IPathMatcher $pathMatcher = new SegmentPathMatcher() |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | private readonly IRequestProvider $requests = new GlobalsRequestProvider() |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Constructor-promoted | private readonly IMethodPolicy $methods = new HttpMethod() |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Method | Signature |
|---|---|
| __construct | public function __construct( private readonly IPathMatcher $pathMatcher = new SegmentPathMatcher(), ?IRouteExecutor $executor = null, private readonly IRequestProvider $requests = new GlobalsRequestProvider(), private readonly IMethodPolicy $methods = new HttpMethod(), ) |
| make | public function make(string $path, string $action, ObjectFactory|Controller $controller, bool $service = false): IRoute |
public function __construct(
private readonly IPathMatcher $pathMatcher = new SegmentPathMatcher(),
?IRouteExecutor $executor = null,
private readonly IRequestProvider $requests = new GlobalsRequestProvider(),
private readonly IMethodPolicy $methods = new HttpMethod(),
)| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$pathMatcher |
private readonly IPathMatcher $pathMatcher = new SegmentPathMatcher() |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$executor |
?IRouteExecutor $executor = null |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$requests |
private readonly IRequestProvider $requests = new GlobalsRequestProvider() |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$methods |
private readonly IMethodPolicy $methods = new HttpMethod() |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
State writes: $this->executor.
Implementation, validation guards and interaction order
public function __construct(
private readonly IPathMatcher $pathMatcher = new SegmentPathMatcher(),
?IRouteExecutor $executor = null,
private readonly IRequestProvider $requests = new GlobalsRequestProvider(),
private readonly IMethodPolicy $methods = new HttpMethod(),
) {
$this->executor = $executor ?? new RouteExecutor(methods: $this->methods);
}public 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. |
Return expressions (including local callbacks): new Router($path, $action, $controller, $service, $this->pathMatcher, $this->executor, $this->requests, $this->methods).
Implementation, validation guards and interaction order
public function make(string $path, string $action, ObjectFactory|Controller $controller, bool $service = false): IRoute
{
return new Router($path, $action, $controller, $service,
$this->pathMatcher, $this->executor, $this->requests, $this->methods);
}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