Repository navigation
Internals Cli Commands HelloCommand
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/cli/commands/HelloCommand.php · Snapshot 8411f4287706.
The CLI registers command objects and executes one command, then returns to a readline loop. Help and clear have special handling in the loop.
use cli\interfaces\CLICommand;class HelloCommand implements CLICommandDeclarations 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 |
|---|---|---|
| $lastResult | private string $lastResult = ''; |
Used by execute(), result(). |
| Method | Signature |
|---|---|
| getCommand | public function getCommand(): string |
| getHelp | public function getHelp(): string |
| getArguments | public function getArguments(): array |
| execute | public function execute(string $command, array $args = []): void |
| result | public function result(): string |
public function getCommand(): stringReturn expressions (including local callbacks): 'hello'.
Implementation, validation guards and interaction order
public function getCommand(): string
{
return 'hello';
}public function getHelp(): stringReturn expressions (including local callbacks): "hello [name]\nPrints 'Hello <name>' or 'Hello World' if name not given.".
Implementation, validation guards and interaction order
public function getHelp(): string
{
return "hello [name]\nPrints 'Hello <name>' or 'Hello World' if name not given.";
}public function getArguments(): arrayReturn expressions (including local callbacks): ['name' => 'optional name to greet'].
Implementation, validation guards and interaction order
public function getArguments(): array
{
return ['name' => 'optional name to greet'];
}public function execute(string $command, array $args = []): void| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$command |
string $command |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$args |
array $args = [] |
Ordered arguments passed to the command or method. |
State writes: $this->lastResult.
Implementation, validation guards and interaction order
public function execute(string $command, array $args = []): void
{
$name = $args[0] ?? 'World';
$this->lastResult = "Hello {$name}!";
}public function result(): stringReturn expressions (including local callbacks): $this->lastResult.
Implementation, validation guards and interaction order
public function result(): string
{
return $this->lastResult;
}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