Repository navigation
Internals Runtime Runtime
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/runtime/Runtime.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.
use event\EventDispatcher;
use package\model\InstalledPackage;
use runtime\enums\ERuntimeStatus;
use runtime\interface\IRuntime;class Runtime implements IRuntimeSource description (behavioral corrections are recorded in Known discrepancies):
Execution state for one installed package, independent of its package API.
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 |
|---|---|---|
| $rootPath | public string $rootPath = ''; |
Used by __construct(), getRootPath(). |
| $waitFor | public array $waitFor = []; |
Used by setWaitFor(), getWaitFor(). |
| $flags | public array $flags = []; |
Used by setFlags(), getFlags(). |
| $shared | public array $shared = []; |
Used by setSharedRegistry(), getSharedRegistry(). |
| $passables | public array $passables = []; |
Used by setPassable(), getPassable(). |
| $eventDispatcher | public ?EventDispatcher $eventDispatcher = null; |
Used by setEventDispatcher(), getEventDispatcher(). |
| $status | public ERuntimeStatus $status = ERuntimeStatus::NOT_STARTED; |
Used by setRuntimeStatus(), getRuntimeStatus(). |
| Constructor-promoted | public function __construct(private readonly ?InstalledPackage $package = null) |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Method | Signature |
|---|---|
| __construct | public function __construct(private readonly ?InstalledPackage $package = null) |
| create | public static function create(?InstalledPackage $package = null): self |
| setEventDispatcher | public function setEventDispatcher(EventDispatcher $dispatcher): void |
| getEventDispatcher | public function getEventDispatcher(): EventDispatcher |
| setRuntimeStatus | public function setRuntimeStatus(ERuntimeStatus $status): void |
| getRuntimeStatus | public function getRuntimeStatus(): ERuntimeStatus |
| getPackage | public function getPackage(): InstalledPackage |
| getRuntimeId | public function getRuntimeId(): int |
| getRuntimeName | public function getRuntimeName(): string |
| getRootPath | public function getRootPath(): string |
| setFlags | public function setFlags(array $flags): void |
| getFlags | public function getFlags(): array |
| setWaitFor | public function setWaitFor(array $packages): void |
| getWaitFor | public function getWaitFor(): array |
| setPassable | public function setPassable(array $passables): void |
| getPassable | public function getPassable(string $name): array |
| setSharedRegistry | public function setSharedRegistry(array $shared): void |
| getSharedRegistry | public function getSharedRegistry(): array |
public function __construct(private readonly ?InstalledPackage $package = null)| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$package |
private readonly ?InstalledPackage $package = null |
Package identifier or InstalledPackage metadata as indicated by the declared type. |
State writes: $this->rootPath.
Implementation, validation guards and interaction order
public function __construct(private readonly ?InstalledPackage $package = null)
{
if ($package !== null) {
$this->rootPath = $package->getPackagePath() . DIRECTORY_SEPARATOR;
}
}public static function create(?InstalledPackage $package = null): self| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$package |
?InstalledPackage $package = null |
Package identifier or InstalledPackage metadata as indicated by the declared type. |
Return expressions (including local callbacks): new self($package).
Implementation, validation guards and interaction order
public static function create(?InstalledPackage $package = null): self { return new self($package); }public function setEventDispatcher(EventDispatcher $dispatcher): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$dispatcher |
EventDispatcher $dispatcher |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
State writes: $this->eventDispatcher.
Implementation, validation guards and interaction order
public function setEventDispatcher(EventDispatcher $dispatcher): void { $this->eventDispatcher = $dispatcher; }public function getEventDispatcher(): EventDispatcherReturn expressions (including local callbacks): $this->eventDispatcher ?? throw new \LogicException('Runtime event dispatcher has not been initialized.').
Explicit exceptions: \LogicException. The guards in the implementation below show when each is raised; exceptions from collaborators also propagate unless caught.
Implementation, validation guards and interaction order
public function getEventDispatcher(): EventDispatcher
{
return $this->eventDispatcher ?? throw new \LogicException('Runtime event dispatcher has not been initialized.');
}public function setRuntimeStatus(ERuntimeStatus $status): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$status |
ERuntimeStatus $status |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
State writes: $this->status.
Implementation, validation guards and interaction order
public function setRuntimeStatus(ERuntimeStatus $status): void { $this->status = $status; }public function getRuntimeStatus(): ERuntimeStatusReturn expressions (including local callbacks): $this->status.
Implementation, validation guards and interaction order
public function getRuntimeStatus(): ERuntimeStatus { return $this->status; }public function getPackage(): InstalledPackageReturn expressions (including local callbacks): $this->package ?? throw new \LogicException('Runtime has no installed package.').
Explicit exceptions: \LogicException. The guards in the implementation below show when each is raised; exceptions from collaborators also propagate unless caught.
Implementation, validation guards and interaction order
public function getPackage(): InstalledPackage
{
return $this->package ?? throw new \LogicException('Runtime has no installed package.');
}public function getRuntimeId(): intReturn expressions (including local callbacks): $this->getPackage()->getId().
Implementation, validation guards and interaction order
public function getRuntimeId(): int { return $this->getPackage()->getId(); }public function getRuntimeName(): stringReturn expressions (including local callbacks): $this->getPackage()->getName().
Implementation, validation guards and interaction order
public function getRuntimeName(): string { return $this->getPackage()->getName(); }public function getRootPath(): stringReturn expressions (including local callbacks): $this->rootPath.
Implementation, validation guards and interaction order
public function getRootPath(): string { return $this->rootPath; }public function setFlags(array $flags): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$flags |
array $flags |
List of runtime flag cases; invalid non-enum entries fail normalization. |
State writes: $this->flags.
Implementation, validation guards and interaction order
public function setFlags(array $flags): void { $this->flags = $flags; }public function getFlags(): arrayReturn expressions (including local callbacks): $this->flags.
Implementation, validation guards and interaction order
public function getFlags(): array { return $this->flags; }public function setWaitFor(array $packages): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$packages |
array $packages |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
State writes: $this->waitFor.
Implementation, validation guards and interaction order
public function setWaitFor(array $packages): void { $this->waitFor = $packages; }public function getWaitFor(): arrayReturn expressions (including local callbacks): $this->waitFor.
Implementation, validation guards and interaction order
public function getWaitFor(): array { return $this->waitFor; }public function setPassable(array $passables): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$passables |
array $passables |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
State writes: $this->passables.
Implementation, validation guards and interaction order
public function setPassable(array $passables): void { $this->passables = $passables; }public function getPassable(string $name): array| 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. |
Return expressions (including local callbacks): $this->passables[$name] ?? [].
Implementation, validation guards and interaction order
public function getPassable(string $name): array { return $this->passables[$name] ?? []; }public function setSharedRegistry(array $shared): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$shared |
array $shared |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
State writes: $this->shared.
Implementation, validation guards and interaction order
public function setSharedRegistry(array $shared): void { $this->shared = $shared; }public function getSharedRegistry(): arrayReturn expressions (including local callbacks): $this->shared.
Implementation, validation guards and interaction order
public function getSharedRegistry(): array { return $this->shared; }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