Ferreteria/v0.6/clade/IO/Aspect/Connx/Plug/@revision/2026/01/19
Jump to navigation
Jump to search
|
The item documented here has been removed and is no longer in use. This is the core code as of 2026-01-19.
|
interface iPlug extends BaseIface {
// SETUP
static function FromSocket(SockIface $oSock) : self;
static function ForSocket() : self;
// SETUP: dynamic
function DefaultSocket(SockIface $o) : void;
// I/O
function DoCommand(CLineIface $oCmd) : ResultIface;
// OBJECTS
function OProcess() : ProcIface;
function OSock(?SockIface $o=NULL) : SockIface;
function WrapAction(CommOpIface $oActIn) : CommOpIface;
}
abstract class caPlug extends BaseClass implements SelfIface {
// ++ SETUP ++ //
protected function __construct(){}
// ++ SETUP: dynamic ++ //
static public function FromSocket(SockIface $oSock) : SelfIface {
$oThis = new static;
$oThis->WithSocket($oSock);
return $oThis;
}
static public function ForSocket() : SelfIface { return new static; }
// -- SETUP -- //
// ++ OBJECTS ++ //
public function OProcess() : ProcIface { return $this->OSock()->OPlug()->OProcess(); }
private $oSock=NULL;
protected function WithSocket(SockIface $o) : void { $this->oSock = $o; }
public function DefaultSocket(SockIface $o) : void { if (is_null($this->oSock)) $this->oSock = $o; }
public function OSock(?SockIface $o=NULL) : SockIface { return is_null($o) ? $this->oSock : ($this->oSock = $o); }
// 2025-12-04 TODO: Maybe this should just *always* CopyFrom()?
public function WrapAction(CommOpIface $oActIn) : CommOpIface {
if (is_a($oActIn,$this->StatusClass())) {
$oActOut = $oActIn;
} else {
$oActOut = $this->HowItWent();
$oActOut->CopyFrom($oActIn);
}
return $oActOut;
}
// -- OBJECTS -- //
}