Futilities/v0.6/clade/Apps/dba/InArgs/@code

From WoozleCodes
Jump to navigation Jump to search
Code Snapshots

I'm about to try reparenting this in order to normalize it against FTM's Opts, because that is still working but this somehow no longer is.

/* Base* [ca,i] */ use Woozalia\Ferret\Sys\Data\Engine\aux\{ caInReqData as BaseClass, iInReqData as BaseIface };
/* KioskIface   */ use Woozalia\Futil\Apps\dba\iKiosk as KioskIface;
/* QObj*  [c,i] */ use Woozalia\Ferret\Data\Mem\QVar\RW\{ cObj as QObjClass, iObj as QObjIface };
/* QStrIface    */ use Woozalia\Ferret\Data\Mem\QVar\RW\iStr as QStrIface;
/* SchemaIface  */ use Woozalia\Ferret\Sys\Data\Engine\aux\iSchema as SchemaIface;

interface iInArgs extends BaseIface {
    // DATA
    function OkToReplace() : bool;
}
class cInArgs extends BaseClass implements iInArgs {

    // ++ DATA ++ //

    public function QSDbase()     : QStrIface { return $this->FetchItQ(KioskIface::VAL_CONN);  }
    public function QSSchema()    : QStrIface { return $this->FetchItQ(KioskIface::VAL_SCHEMA); }
    public function QSFileName()  : QStrIface { return $this->FetchItQ(KioskIface::VAL_FILE); }
    public function QSFilePath()  : QStrIface { return $this->FetchItQ(KioskIface::VAL_PATH); }

    public function OkToReplace() : bool {
        #$sName = 'xf.replace';
        $sName = KioskIface::VAL_REPLACE;
        $obVal = $this->FetchItQ($sName);
        $bVal = $obVal->HasIt() ? $obVal->GetIt() : FALSE;
        return $bVal;
    }

    // -- DATA -- //
    // ++ OBJECTS ++ //

    // 2025-11-21 Copied from has\Schema (for now)
    public function QOSchema() : QObjIface {
        $qo = QObjClass::AsNew();
        $os = $this->QSSchema();    // Schema name
        if ($os->HasIt()) {
            $sSch = $os->GetIt();
            $qoOper = $this->QOClient();  // creates new object if needed/possible
            if ($qoOper->HasIt()) {
                $oOper = $qoOper->GetIt();
                $oSch = $oOper->GetSchema($sSch);
                $qo->SetIt($oSch);
            }
        }
        return $qo;
    }

    // ++ OUTPUT ++ //

    // OVERRIDE
    public function Debug_Render() : string {
        $ar = $this->GetVals();
        $nAr = count($ar);
        if ($nAr > 0) {
            if ($nAr > 1) {
                $sOut = $nAr.' input elements:'.CRLF;
            } else {
                $sOut = 'One input element: ';
            }
            foreach ($ar as $sKey => $sVal) {
                $sOut .= "[$sKey] => [$sVal]".CRLF;
            }
        } else {
            $sOut = 'No elements in input array.'.CRLF;
        }

        return $sOut;

    }

    // -- OUTPUT -- //
}