oModelReflectionRuntime = new ModelReflectionRuntime(); } final public static function GetInstance(): DashletFactory { if (!isset(static::$oInstance)) { static::$oInstance = new DashletFactory(); } return static::$oInstance; } public function SetModelReflectionRuntime(ModelReflectionRuntime $oModelReflectionRuntime): void { $this->oModelReflectionRuntime = $oModelReflectionRuntime; } public function CreateDashlet(string $sClass, string $sId): Dashlet { if (!DashletService::GetInstance()->IsDashletAvailable($sClass)) { throw new DashletException("Dashlet ".json_encode($sClass)." is not available"); } /** @var Dashlet $oDashlet */ $oDashlet = new $sClass($this->oModelReflectionRuntime, $sId); $oDashlet->SetDashletType($sClass); return $oDashlet; } }