Ferreteria/v0.6/clade/Sys/FileSys/Aspect/Ident/stringer/Chain/@removed/Root

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | Sys‎ | FileSys‎ | Aspect‎ | Ident‎ | stringer‎ | Chain‎ | @removed
Jump to navigation Jump to search
Retired Clade: Sys\FileSys\Aspect\Ident\stringer\Chain\Root

Full Code: 2025-12-15

/**::::
  PURPOSE: the root segment of a path-chain; has no parent-folder
  HISTORY:
    2023-11-03 moved from ...\File\cPathRoot -> ...\File\Path\cRoot
    2023-12-13 now implemens iSpec
    2024-12-24 moved from [WF]Data/Stored/File/Path -> [WF]IO/fsys/Path/Piece
    2024-12-31 moved again, renamed, reparented; see Chain.
*/

use Woozalia\Ferret\Data\Mem\QVar\cStr as QStrClass;
use Woozalia\Ferret\Data\Mem\QVar\iStr as QStrIface;

#use Woozalia\Ferret\Sys\Data\Request\iUser as UserReqIface;
// stringer (parent) namespace
use Woozalia\Ferret\Sys\FileSys\Aspect\Ident\stringer\{
    aux\cStatus as StatusClass,
    aux\iStatus as StatusIface,
    caChain as BaseClass,
    iChain as BaseIface,
    Chain\iRoot as SelfIface,
};

/* 2025-11-07 retiring, probably
// 2025-11-03 I feel like this should be consolidated into Nested...
interface iRoot extends BaseIface {
    #function GetBase() : BaseIface;
    #function HasBase() : bool;
    function GetBasePath() : string;
    function PathStatus() : StatusIface;
    #function AddToRequest(UserReqIface $oReq) : void;
}

class cRoot extends BaseClass implements SelfIface {

    // ++ SETUP ++ //

    protected function __construct(){}

    static public function FromSpec(string $fpBase) : SelfIface {
        $oThis = new static;
        $oThis->QBaseSpec()->SetIt($fpBase);
        return $oThis;
    }

    // -- SETUP -- //
    // ++ ACCESS: iface ++ //

    // CEMENT: Ident (uses Piece)
    public function QSFullSpec() : QStrIface { return $this->GetSpec(); }

    /*
    // CEMENT: iSpec
    public function GetBase() : BaseIface   { return NULL; }
    // CEMENT: iSpec
    public function HasBase() : bool      { return FALSE; }
    * /
    // CEMENT: iSpec
    public function GetBasePath() : string  { return $this->QBaseSpec()->GetIt(); }

    /*----
      CEMENT caPathHandler
      THINKING:
        2023-12-07 Although $this->fpBase is always set by the constructor,
          this is not the case in ancestor classes - so we do still need
          to implement this method.
      HISTORY:
        2022-09-29 revised how cPathStatus (now Path\cStatus) works
    * /
    public function PathStatus() : StatusIface {
        $oStat = new StatusClass;
        $oStat->QSRoot()->SetIt($this->GetBasePath());
        return $oStat;
    }

    // ++ ACCESS: internal ++ //

    private $osFS = NULL;
    protected function QBaseSpec() : QStrIface { return $this->osFS ?? ($this->osFS = QStrClass::AsNew()); }

    // -- ACCESS -- //

    /* 2025-11-03 This API method appears to be unused.
    // ACTION: This is the root, has no name: add nothing
    public function AddToRequest(UserReqIface $oReq) : void {}
    * /
}
*/