Ferreteria/v0.6/clade/IO/Aspect/Connx/Plug/Chain

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | IO‎ | Aspect‎ | Connx‎ | Plug
Revision as of 00:17, 23 October 2025 by Woozle (talk | contribs) (Created page with "{{page/clade/v2 |fam= {{!}} align=right {{!}} {{l/ver/clade|IO\Aspect\Connx|Plug}} {{!}} align=center {{!}} → {{l/ver/clade|IO\Aspect\Connx\Plug|Chain}} → {{!}} align=left {{!}} ''(none?)'' |alia= {{!-!}} '''ActionIface {{!!}} {{l/ver/clade/full|p=ferreteria|Sys\Events|ItWent}} {{!-!}} '''Base'''* [ca,i] {{!!}} {{l/ver/clade/full|p=ferreteria|IO\Aspect\Connx|Plug}} {{!-!}} '''BufferIface''' {{!!}} {{l/ver/clade/full|p=ferreteria|IO\Aspect\Connx|Buffer}...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
clade: IO\Aspect\Connx\Plug\Chain
Clade Family
Plug Chain (none?)
Clade Aliases
Alias Clade
ActionIface Sys\Events\ItWent
Base* [ca,i] IO\Aspect\Connx\Plug
BufferIface IO\Aspect\Connx\Buffer
CommOpIface Sys\Events\ItWent\CommOp
SelfIface IO\Aspect\Connx\Plug\Chain
SockIface IO\Aspect\Socket
Subpages

About

  • PURPOSE: A that goes through another socket (for e.g. tunnels)

History

Code

as of 2025-10-22

interface iChain extends BaseIface {}
class cChain extends BaseClass implements SelfIface {

    // ++ LIFECYCLE ++ //

    // ACTION: Pass the event on to the Plug.
    protected function ActualOpen() : ActionIface {
        $oPlug = $this->OSock()->OPlug();
        if ($oPlug === $this) {
            echo $this->Inspect()->ReflectThis()->Report();
            #echo 'THIS: '.$this->Inspect()->RenderInLine().CRLF;
            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() : ActionIface {
        $oPlug = $this->OSock()->OPlug();
        return $oPlug->ActualShut();
    }

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

    public function DoCommand(string|array $saCmd, BufferIface $oBuff, ?CommOpIface $oAct=NULL) : CommOpIface {
        return $this->ForwardCommand($saCmd,$oBuff,$oAct);
    }
    protected function ForwardCommand(string|array $saCmd, BufferIface $oBuff, ?CommOpIface $oAct=NULL) : CommOpIface {
        return $this->OSock()->OPlug()->DoCommand($saCmd,$oBuff,$oAct);
    }

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

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