Ferreteria/v0.6/clade/Aux/StandardBase/Objectory: Difference between revisions
< Ferreteria | v0.6 | clade | Aux/StandardBase
Jump to navigation
Jump to search
(Created page with "{{page/clade}} {| style="border: solid 1px black; float: right;" ! colspan=3 | Clade Family |- | align=right | {{l/ver/clade|Aux|StandardBase}} | → {{l/ver/clade|Aux\StandardBase|Objectorium}} | → {{l/ver/clade|Sys/Events|InputRq}} |}") |
No edit summary |
||
| Line 5: | Line 5: | ||
| align=right | {{l/ver/clade|Aux|StandardBase}} | | align=right | {{l/ver/clade|Aux|StandardBase}} | ||
| → {{l/ver/clade|Aux\StandardBase|Objectorium}} | | → {{l/ver/clade|Aux\StandardBase|Objectorium}} | ||
| → {{l/ver/clade|Sys | | | ||
→ {{l/ver/clade|Sys\Events|InputRq}}<br> | |||
→ {{l/ver/clade|Data\Base\Result|Player}} | |||
|} | |} | ||
==Code== | |||
''as of 2025-09-26'' | |||
{{fmt/php/block|1= | |||
interface iObjectorium extends BaseIface { | |||
// SETUP | |||
static function FromSlug(string $sSlug) : self; | |||
function ObjectSlug() : string; | |||
} | |||
class cObjectorium extends BaseClass implements iObjectorium { | |||
// ++ CONFIG ++ // | |||
static protected function ClassSlug() : string { echo self::PromptForMethod('Must define ClassSlug() for this class family.').CRLF; die(); } | |||
static protected function RegisterClass() : string { return RegClass::class; } | |||
static protected function ManifestClass() : string { return MfsClass::class; } | |||
// -- CONFIG -- // | |||
// ++ SETUP ++ // | |||
private $sSlug; | |||
protected function __construct(){} | |||
static public function FromSlug(string $sSlug) : iObjectorium { ($oThis = new static)->WithSlug($sSlug); return $oThis; } | |||
public function ObjectSlug() : string { return $this->sSlug; } | |||
// ++ SETUP: dynamic ++ // | |||
protected function WithSlug(string $sSlug) { | |||
$this->sSlug = $sSlug; | |||
$this->SelfRegister(); | |||
} | |||
// -- SETUP -- // | |||
// ++ MANIFEST ++ // | |||
static private array $arObjMfss = []; | |||
static protected function Manifest() : MfsIface { | |||
$sCSlug = static::ClassSlug(); | |||
if (array_key_exists($sCSlug,self::$arObjMfss)) { | |||
$o = self::$arObjMfss[$sCSlug]; | |||
} else { | |||
$cs = static::ManifestClass(); | |||
$o = $cs::AsNew(); | |||
self::$arObjMfss[$sCSlug] = $o; | |||
} | |||
return $o; | |||
} | |||
// -- MANIFEST -- // | |||
// ++ REGISTRY ++ // | |||
static private array $arObjRegs = []; | |||
static protected function Register() : RegIface { | |||
$sCSlug = static::ClassSlug(); | |||
if (array_key_exists($sCSlug,self::$arObjRegs)) { | |||
$oReg = self::$arObjRegs[$sCSlug]; | |||
} else { | |||
$csReg = static::RegisterClass(); | |||
$oReg = $csReg::AsNew(); | |||
self::$arObjRegs[$sCSlug] = $oReg; | |||
} | |||
return $oReg; | |||
} | |||
protected function SelfRegister() { | |||
$sSlug = $this->ObjectSlug(); | |||
static::Register()->SetIt($sSlug,$this); | |||
} | |||
// -- REGISTRY -- // | |||
} | |||
}} | |||
Revision as of 16:27, 26 September 2025
| Clade Family | ||
|---|---|---|
| StandardBase | → Objectorium | |
Code
as of 2025-09-26
interface iObjectorium extends BaseIface {
// SETUP
static function FromSlug(string $sSlug) : self;
function ObjectSlug() : string;
}
class cObjectorium extends BaseClass implements iObjectorium {
// ++ CONFIG ++ //
static protected function ClassSlug() : string { echo self::PromptForMethod('Must define ClassSlug() for this class family.').CRLF; die(); }
static protected function RegisterClass() : string { return RegClass::class; }
static protected function ManifestClass() : string { return MfsClass::class; }
// -- CONFIG -- //
// ++ SETUP ++ //
private $sSlug;
protected function __construct(){}
static public function FromSlug(string $sSlug) : iObjectorium { ($oThis = new static)->WithSlug($sSlug); return $oThis; }
public function ObjectSlug() : string { return $this->sSlug; }
// ++ SETUP: dynamic ++ //
protected function WithSlug(string $sSlug) {
$this->sSlug = $sSlug;
$this->SelfRegister();
}
// -- SETUP -- //
// ++ MANIFEST ++ //
static private array $arObjMfss = [];
static protected function Manifest() : MfsIface {
$sCSlug = static::ClassSlug();
if (array_key_exists($sCSlug,self::$arObjMfss)) {
$o = self::$arObjMfss[$sCSlug];
} else {
$cs = static::ManifestClass();
$o = $cs::AsNew();
self::$arObjMfss[$sCSlug] = $o;
}
return $o;
}
// -- MANIFEST -- //
// ++ REGISTRY ++ //
static private array $arObjRegs = [];
static protected function Register() : RegIface {
$sCSlug = static::ClassSlug();
if (array_key_exists($sCSlug,self::$arObjRegs)) {
$oReg = self::$arObjRegs[$sCSlug];
} else {
$csReg = static::RegisterClass();
$oReg = $csReg::AsNew();
self::$arObjRegs[$sCSlug] = $oReg;
}
return $oReg;
}
protected function SelfRegister() {
$sSlug = $this->ObjectSlug();
static::Register()->SetIt($sSlug,$this);
}
// -- REGISTRY -- //
}