<?php
namespace App\GenDocument\SpecialObjectConfig;

abstract class GeneralAbstract
{
	static protected $instance = [];

	static public function getInstance()
	{
		$className = stripClassNamespace(get_called_class());
		if (self::$instance[$className]) {
			return self::$instance[$className];
		}

		self::$instance[$className] = new static();
		return self::$instance[$className];
	}

	/**
	 * Defined for Singleton, made final for phpstan
	 */
	final protected function __construct()
	{ }

	public function getConfigs()
	{
		$className = stripClassNamespace(get_called_class());
		\Engine\Loader_Cfg::getInstance()->loadCustomFile("DTM/specialObjects/{$className}.cfg.php");

		$CFG = \Engine\Loader_Cfg::getInstance()->getGlobal();
		$cfg = $CFG['DTM']['specialObjectsDefinitions'][$className];
		return $cfg;
	}


}
