Ferreteria/v0.6/clade/Sys/Events/InputRq/aux/InArgs/@code

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

Just before modifying FetchItQ():

interface iInArgs extends BaseIface {
    function QADefaults() : QObjIface;
    function FetchItQ(string $sKey) : QStrIface;
}
class cInArgs extends BaseClass implements SelfIface {

    // ++ SETTINGS ++ //

    private $ooDef=NULL;
    public function QADefaults() : QObjIface { return $this->ooDef ?? ($this->ooDef = QObjClass::AsNew()); }

    // -- SETTINGS -- //
    // ++ ACCESS ++ //

    public function FetchItQ(string $sKey) : QStrIface {
        $os = $this->GetItQ($sKey);
        if ($os->HasIt()) {
            // This is a bit of a kluge...
            if ($os->GetIt() === '') {
                $os->ZapIt();
            }
        }
        if (!$os->HasIt()) {
            // value not set locally, so check defaults if available:
            $ooDef = $this->QADefaults();
            #echo $ooDef->ReflectThis()->Report();
            #$this->AmHere("CHECKING DEFAULT for [$sKey]: [".$ooDef->HasIt().']');
            if ($ooDef->HasIt()) {
                // we have defaults, so see if they have the value:
              #$this->AmHere('DEFAULTS FOUND');
                $os = $ooDef->GetIt()->FetchItQ($sKey); // 2025-09-18 may need updating here
                #echo 'found -- ';
            } else {
                $this->AmHere("NO defaults for [$sKey]");
            }
        }
        return $os;
    }

    // -- ACCESS -- //

}