Ferreteria/v0.6/clade/Sys/Data/Things/Array/ifaces/ARoot

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | Sys‎ | Data‎ | Things‎ | Array
Jump to navigation Jump to search
Clade Family
StandardBase ARoot QStor
Clade Aliases
Alias Clade
Base* [c,i] StandardBase
Root* [i] Array
Self* [i] ARoot

Code

as of 2025-09-16

interface iARoot extends BaseIface, ArrayIface {}
abstract class caARoot extends BaseClass implements SelfIface {

    // ++ SETUP ++ //

    public static function AsNew() : ArrayIface {
        $oThis = new static;
        $oThis->SetStore([]);
        return $oThis;
    }
    public static function FromVArray(array $ar) : ArrayIface {
        $oThis = new static;
        $oThis->WithVArray($ar);
        return $oThis;
    }

    // ++ SETUP: dynamic ++ //

    abstract protected function WithVArray(array $ar) : void;

    // -- SETUP -- //
    // ++ R/W: storage ++ //

    protected array $ar=[];

    public function SetStore(array $ar) { $this->ar = $ar; }
    public function &GetStore() : array {
        if (!isset($this->ar)) {
            $this->ar = []; // 2025-07-07 For unknown reasons, can't be auto-initialized.
        }
        return $this->ar;
    }
    public function ZapStore() { $this->ar = []; }

    // -- R/W -- //

}