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

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | IO‎ | Aspect
Jump to navigation Jump to search
clade: IO\Aspect\Entry
Clade Family
Aspect Entry (none)
Clade Aliases
Alias Clade
Base* [ca,i] IO\Aspect
CredIface IO\Aspect\Creds
HostIface IO\Aspect\Host
SelfIface IO\Aspect\Entry
Subpages

About

  • Purpose: encapsulates all the pieces for entering the next point in a connection-series
  • Contains:
    • Host: an object specifying the target address (and, optionally, port)
    • Cred: an object specifying the access credentials (user and possibly password)

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
  • 2026-01-23 renamed SocketEntry
  • 2026-01-31
    • commented out OJack()
    • made OCred() and OHost() settable
    • replaced {constructor with parameters} with protected empty constructor and AsNew()

Functions

Code

interface iEntry extends BaseIface {
    // ACCESS
    function OHost() : HostIface; // where we are connecting
    function OCred() : CredIface; // how to gain access
    function OJack() : JackIface; // code to talk to once admitted
}
class cEntry extends BaseClass implements SelfIface {

    // ++ CONFIG ++ //

    public function SType()             : string { return 'entry-guide'; }

    // -- CONFIG -- //
    // ++ SETUP ++ //

    public function __construct(private HostIface $oHost, private CredIface $oCred, private JackIface $oJack){
        #$oJack->DefaultSocket($this);
    }
    public function OHost() : HostIface { return $this->oHost; }
    public function OCred() : CredIface { return $this->oCred; }
    public function OJack() : JackIface { return $this->oJack; }

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

    public function DescribeInline() : string {
        #$oScrn = self::Screen();
        $sUser = $this->OCred()->DescribeInline();
        $sHost = $this->OHost()->DescribeInline();
        #$sOut = "$sUser@$sHost (".$this->ObjectInfo().')';
        $sOut = "$sUser@$sHost";
        $oPlug = $this->OJack();
        if (is_object($oPlug)) {
            #$sOut .= ' from plug '.$oPlug->ObjectInfo();
            $sOut .= ' <- '.$oPlug->DescribeInline();
        }
        return $sOut;
    }

    // -- OUTPUT -- //
}