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

From Woozle Writes Code
Jump to navigation Jump to search
The item documented here has been removed and is no longer in use.
This is the entire file as of removal on 2026-01-31. The only difference from the previous revision appears to be that OPlug() calls were renamed to OJack().
<?php namespace Woozalia\Ferret\IO\Aspect\Connx\Stream;

/* Base*  [ca,i] */ use Woozalia\Ferret\IO\Aspect\Connx\{ caStream as BaseClass, iStream as BaseIface };
/* CLineIface    */ use Woozalia\Ferret\Sys\Data\Codec\aux\iCmdLine as CLineIface;
/* CommOp* [c,i] */ use Woozalia\Ferret\IO\Aspect\Connx\aux\itWent\{ cCommOp as CommOpClass, iCommOp as CommOpIface };
/* Result* [c,i] */ use Woozalia\Ferret\IO\Aspect\Connx\aux\itWent\{ cProcOp as ResultClass, iProcOp as ResultIface };
/* SelfIface     */ use Woozalia\Ferret\IO\Aspect\Connx\Stream\iChain as SelfIface;

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()->OJack();
        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()->OJack();
        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()->OJack()->DoCommand($oCmd);  // e.g. Shell\Remote\cSSH->DoCommand()
    }

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

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

    // -- UI -- //
}