| Clade Aliases
|
| Alias |
Clade
|
| Base* [c,i] |
Aux\StandardBase
|
| HasStatus* [i,t] |
Sys\Events\has\ItWent
|
| InRqData* [c,i] |
Sys\Events\InputRq\aux\InRqData
|
| Item* [i] |
Sys\Events\InputItem
|
| Piece* [i] |
Sys\Data\Things\Array\aux\Piece
|
|
in repo: doccode
Functions
This requires the following to be defined by podlings:
- Describe() - usually defined at the application-input level (e.g. DoExportDb)
- ParseInputArgs()
- typically defined at the application level (e.g. InReq)
- also defined by Setting for inputs that map directly to value-names
- ParseInputString()
- typically defined at the application level (e.g. InReq)
- also defined by Setting for inputs that map directly to value-names
Code
as of 2025-10-16
interface iInputRq extends BaseIface, HasStatusIface {
// CONFIG
function NameOfInput() : string;
// SETUP
function Item(ItemIface $o=NULL) : ItemIface;
// ACTION
function Go();
// INFO
function Describe() : string;
}
abstract class caInputRq extends BaseClass implements SelfIface {
use HasStatusTrait;
// ++ CONFIG ++ //
// OVERRIDE
protected function QVarClass(int|string $snKey) : string { return InDataClass::class; }
// This tells the clade where to store the Singleton object for this podling-class-family.
static protected function InputClass() : string { die(self::PromptForMethod('Define this in the root InputRq for the command.')); } // DEFAULT
public function NameOfInput() : string { return $this->Item()->SName(); }
// -- CONFIG -- //
// ++ SETUP ++ //
protected function __construct(){}
static public function FromItemPiece(ItemIface $oItem, PieceIface $oPiece) : SelfIface {
$oThis = new static;
$oThis->WithItemPiece($oItem,$oPiece);
return $oThis;
}
// ++ SETUP: dynamic ++ //
protected function WithItemValue(ItemIface $oItem, string $sValue) : void {
$this->Item($oItem);
$this->ParseInputString($sValue);
}
protected function WithItemPiece(ItemIface $oItem, PieceIface $oPiece) : void {
if ($oPiece->HasValue()) {
$sVal = $oPiece->Value();
#self::GotToHere();
$this->ParseInputArgs($oPiece->GetExtras());
} else {
// check for default (used if request is present but with no value):
$osDef = $oItem->SDefault(); // TODO: Implement as $this->Attrs()->QryIt('valdef');
if ($osDef->HasIt()) {
$sVal = $osDef->GetIt();
} else {
$sVal = '';
}
}
$this->WithItemValue($oItem,$sVal);
}
// NOTE: Basically identical to Events/Actor/Option::Item()
private $oItem = NULL;
public function Item(ItemIface $o=NULL) : ItemIface {
if (is_object($o)) {
self::HardAssert(is_null($this->oItem),'changing the item-object on an already-configured Action (should probably never happen)');
// If we ever actually need to do this, we need to un-register and re-register.
$this->oItem = $o;
} else {
$o = $this->oItem; // return previously-set object
}
return $o;
}
// -- SETUP -- //
// ++ DATA ++ //
static private $oaInThis = NULL;
protected function OAUserInput() : InDataIface { return self::$oaInThis ?? (self::$oaInThis = $this->NewUserInput()); }
protected function NewUserInput() : InDataIface {
$oa = (static::InputClass())::AsNew();
return $oa;
}
abstract protected function ParseInputString(string $s) : void;
abstract protected function ParseInputArgs(array $ar);
// -- DATA -- //
}