Answer the question
In order to leave comments, you need to log in
Method not found in trait Singleton :)?
trait TSingleton
{
private static $instance;
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
}
class Registry
{
use TSingleton;
public static $properties = [];
public function setProperty($name, $value)
{
self::$properties[$name] = $value;
}
public function getProperty($name)
{
return self::$properties[$name] ?? null;
}
public function getProperties()
{
return self::$properties;
}
}
Registry::getInstance()->getProperties();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question