Topics
Singleton pattern trait
The SingletonTrait trait adds a static, unique instance of the owning class.
class Manager
{
use SingletonTrait;
function text () { echo $text; }
public function __construct () { $this->text = "Useless class member"; }
private $text;
}
Manager::getInstance()->text ();