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

From WoozleCodes
Jump to navigation Jump to search
Code Snapshots & Removals

This was just before I merged tEntry into cEntry.

interface iEntry extends BaseIface {
    // SETUP
    static function AsNew() : SelfIface;
    static function FromObjects(CredIface $oCred, HostIface $oHost) : SelfIface;
    // ACCESS
    function OHost() : HostIface; // where we are connecting
    function OCred() : CredIface; // how to gain access
}
trait tEntry {
    use BaseTrait;

    // ++ CONFIG ++ //

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

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

    protected function __construct(){}

    public static function AsNew() : SelfIface { return new static; }

    public static function FromObjects(CredIface $oCred, HostIface $oHost) : SelfIface {
        $oThis = new static;
        $oThis->OCred($oCred);
        $oThis->OHost($oHost);
        return $oThis;
    }

    private $oCred;
    public function OCred(?CredIface $o=NULL) : CredIface { return is_null($o) ? $this->oCred : ($this->oCred = $o); }
    private $oHost;
    public function OHost(?HostIface $o=NULL) : HostIface { return is_null($o) ? $this->oHost : ($this->oHost = $o); }

    #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 -- //
}

class cEntry extends BaseClass implements iEntry { use tEntry; }