Ferreteria/v0.6/clade/Aux/StandardBase/Objectory: Difference between revisions
< Ferreteria | v0.6 | clade | Aux/StandardBase
Jump to navigation
Jump to search
m (Woozle moved page Ferreteria/v0.6/clade/Aux/StandardBase/Objectorium to Ferreteria/v0.6/clade/Aux/StandardBase/Objectory: clade renamed) |
(updates) |
||
| Line 4: | Line 4: | ||
|- | |- | ||
| align=right | {{l/ver/clade|Aux|StandardBase}} | | align=right | {{l/ver/clade|Aux|StandardBase}} | ||
| → {{l/ver/clade|Aux\StandardBase| | | → {{l/ver/clade|Aux\StandardBase|Objectory}} | ||
| | | | ||
→ {{l/ver/clade|Sys\Events|InputRq}}<br> | → {{l/ver/clade|Sys\Events|InputRq}}<br> | ||
| Line 10: | Line 10: | ||
|} | |} | ||
==Code== | ==Code== | ||
''as of 2025-09- | ''as of 2025-09-29'' | ||
{{fmt/php/block|1= | {{fmt/php/block|1= | ||
interface | interface iObjectory extends BaseIface { | ||
// SETUP | // SETUP | ||
static function FromSlug(string $sSlug) : self; | static function FromSlug(string $sSlug) : self; // create a new object with a name-slug | ||
// SETTING | |||
function ObjectSlug() : string; | |||
} | } | ||
class | class cObjectory extends BaseClass implements iObjectory { | ||
static protected function RegisterClass() : string { return RegClass::class; } | |||
#static protected function ManifestClass() : string { return MfsClass::class; } | |||
static protected function ClassSlug() : string { echo self::PromptForMethod('Must define ClassSlug() for this | static protected function ClassSlug() : string { echo self::PromptForMethod('Must define ClassSlug() for this clade.').CRLF; die(); } | ||
// -- CONFIG -- // | // -- CONFIG -- // | ||
// ++ SETUP ++ // | // ++ SETUP ++ // | ||
protected function __construct(){} | |||
static public function FromSlug(string $sSlug) : iObjectory { ($oThis = new static)->WithSlug($sSlug); return $oThis; } | |||
private $sSlug; | private $sSlug; | ||
public function ObjectSlug() : string { return $this->sSlug; } | |||
// ++ SETUP: dynamic ++ // | // ++ SETUP: dynamic ++ // | ||
// Remember the slug, and self-register with it. | |||
protected function WithSlug(string $sSlug) { | protected function WithSlug(string $sSlug) { | ||
$this->sSlug = $sSlug; | $this->sSlug = $sSlug; | ||
$this-> | $this->SignThisUp(); | ||
} | } | ||
// -- SETUP -- // | // -- SETUP -- // | ||
// ++ REGISTRY ++ // | // ++ REGISTRY ++ // | ||
static private array $arObjRegs = []; | static private array $arObjRegs = []; | ||
static protected function Register() : RegIface { | static protected function Register() : RegIface { die('Use SignUpList()'); | ||
static protected function Classifest() : ArrayIface { // clade-specific manifest (sub-array) | |||
$sCSlug = static::ClassSlug(); | $sCSlug = static::ClassSlug(); | ||
if (array_key_exists($sCSlug,self::$arObjRegs)) { | if (array_key_exists($sCSlug,self::$arObjRegs)) { | ||
| Line 73: | Line 59: | ||
} | } | ||
protected function SelfRegister() { | protected function SelfRegister() { die('Use SignThisUp()'); } | ||
protected function SignThisUp() { | |||
$sSlug = $this->ObjectSlug(); | $sSlug = $this->ObjectSlug(); | ||
static:: | static::Classifest()->SetIt($sSlug,$this); | ||
} | } | ||
Revision as of 15:10, 29 September 2025
| Clade Family | ||
|---|---|---|
| StandardBase | → Objectory | |
Code
as of 2025-09-29
interface iObjectory extends BaseIface {
// SETUP
static function FromSlug(string $sSlug) : self; // create a new object with a name-slug
// SETTING
function ObjectSlug() : string;
}
class cObjectory extends BaseClass implements iObjectory {
static protected function RegisterClass() : string { return RegClass::class; }
#static protected function ManifestClass() : string { return MfsClass::class; }
static protected function ClassSlug() : string { echo self::PromptForMethod('Must define ClassSlug() for this clade.').CRLF; die(); }
// -- CONFIG -- //
// ++ SETUP ++ //
protected function __construct(){}
static public function FromSlug(string $sSlug) : iObjectory { ($oThis = new static)->WithSlug($sSlug); return $oThis; }
private $sSlug;
public function ObjectSlug() : string { return $this->sSlug; }
// ++ SETUP: dynamic ++ //
// Remember the slug, and self-register with it.
protected function WithSlug(string $sSlug) {
$this->sSlug = $sSlug;
$this->SignThisUp();
}
// -- SETUP -- //
// ++ REGISTRY ++ //
static private array $arObjRegs = [];
static protected function Register() : RegIface { die('Use SignUpList()');
static protected function Classifest() : ArrayIface { // clade-specific manifest (sub-array)
$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() { die('Use SignThisUp()'); }
protected function SignThisUp() {
$sSlug = $this->ObjectSlug();
static::Classifest()->SetIt($sSlug,$this);
}
// -- REGISTRY -- //
}