Ferreteria/v0.6/clade/IO/Aspect/Connx/Stream/Chain/@revision/2026/01/20

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | IO‎ | Aspect‎ | Connx‎ | Stream‎ | Chain
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-20.
interface iChain extends BaseIface {}
class cChain extends BaseClass implements SelfIface {

    // ++ CONFIG ++ //

    public function SType()             : string { return 'plug-chain'; }

    // -- CONFIG -- //
    // ++ LIFECYCLE ++ //

    // ACTION: Pass the event on to the Plug.
    protected function ActualOpen() : CommOpIface {
        $oPlug = $this->OSock()->OPlug();
        if ($oPlug === $this) {
            echo $this->Inspect()->ReflectThis()->Report();
            echo 'THIS: '.$this->DescribeInline().CRLF;
            echo 'PLUG: '.$oPlug->DescribeInline().CRLF;
            $oStk = $this->StackFromCurrent();
            echo 'CONFIG ERROR: Plug is $this; halting to prevent infinite loop.'.CRLF.$oStk->Render();
            die();
        }

        return $oPlug->ActualOpen();
    }
    // ACTION: Pass the event on to the Plug.
    protected function ActualShut() : CommOpIface {
        $oPlug = $this->OSock()->OPlug();
        return $oPlug->ActualShut();
    }

    // -- LIFECYCLE -- //
    // ++ I/O ++ //

    public function DoCommand(CLineIface $oCmd) : ResultIface {
        return $this->ForwardCommand($oCmd);
    }
    protected function ForwardCommand(CLineIface $oCmd) : ResultIface {
        return $this->OSock()->OPlug()->DoCommand($oCmd);  // e.g. Shell\Remote\cSSH->DoCommand()
    }

    // -- I/O -- //
    // ++ UI ++ //

    public function DescribeInline() : string { return $this->SType().' to '.$this->OSock()->DescribeInline(); }

    // -- UI -- //
}