Ferreteria/v0.6/clade/IO/Aspect/Socket

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | IO‎ | Aspect
Revision as of 14:50, 31 October 2025 by Woozle (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
clade: IO\Aspect\Socket
Clade Family
Aspect Socket (none)
Clade Aliases
Alias Clade
Base* [ca,i] IO\Aspect
PlugIface IO\Aspect\Connx\Plug
CredIface IO\Aspect\Creds
HostIface IO\Aspect\Host
SelfIface IO\Aspect\Socket
Subpages

About

  • PURPOSE: encapsulates all the pieces of a connection from one point to another

This is kind of the "umbrella" class for managing objects of the other classes.

History

  • 2025-05-26 started, as part of separating out the different pieces so I can define multiple users on a Host
  • 2025-05-27 re-namespacing

Functions

Code

as of 2025-10-21

interface iSocket extends BaseIface {
    // SETUP
    // ACCESS
    function OHost() : HostIface;
    function OCred() : CredIface;
    function OPlug() : PlugIface;
}
class cSocket extends BaseClass implements SelfIface {

    // ++ SETUP ++ //

    public function __construct(private HostIface $oHost, private CredIface $oCred, private PlugIface $oPlug){
        $oPlug->DefaultSocket($this);
    }
    public function OHost() : HostIface { return $this->oHost; }
    public function OCred() : CredIface { return $this->oCred; }
    public function OPlug() : PlugIface { return $this->oPlug; }

    // -- SETUP -- //
    // ++ OUTPUT ++ //

    public function DescribeInline() : string {
        #$oScrn = self::Screen();
        $sUser = $this->OCred()->DescribeInline();
        $sHost = $this->OHost()->DescribeInline();
        return "$sUser@$sHost";
    }

    // -- OUTPUT -- //
}

Removed

2025-06-04

Commented out yesterday:

// 2025-06-03 old
    static public function FromObjects(HostIface $oHost, CredsIface $oCreds) : SelfIface {
    #static public function FromObjects(HostIface $oHost, CredsIface $oCreds, ConnxIface $oConnx) : SelfIface {
        $oThis = new static;
        #$oThis->WithHost($oHost);
        #$oThis->WithCreds($oCreds);
        #$oThis->WithConnx($oConnx);
        #$oThis->QOConnx()->SetIt($oConnx);
        $oThis->QOCreds()->SetIt($oCreds);
        $oThis->QOHost()->SetIt($oHost);
        return $oThis;
    }

    // -- SETUP -- //
    // ++ ACCESS ++ //

    private $ooCred = NULL; public function QOCreds() : QObjIface { return $this->ooCred ?? ($this->ooCred = QObjClass::AsNew()); }
    #private $ooCnnx = NULL; public function QOConnx() : QObjIface { return $this->ooCnnx ?? ($this->ooCnnx = QObjClass::AsNew()); }
    private $ooHost = NULL; public function QOHost()  : QObjIface { return $this->ooHost ?? ($this->ooHost = QObjClass::AsNew()); }

    // -- ACCESS -- //