Singleton patron permit __construct as protected or private?
And maybe will be good block clone method as
public function __clone()
{
trigger_error("Cant clone ". get_class($this) ." class.", E_USER_ERROR );
}
And solution for serialize:
public function __wakeup()
{
trigger_error("Cant unserialize". get_class($this) ." class.");
}
And instance method
if ( !self::$instance instanceof self) {
self::$instance = new self;
}
return self::$instance;
Singleton patron permit __construct as protected or private?
And maybe will be good block clone method as
public function __clone()
{
trigger_error("Cant clone ". get_class($this) ." class.", E_USER_ERROR );
}
And solution for serialize:
public function __wakeup()
{
trigger_error("Cant unserialize". get_class($this) ." class.");
}
And instance method
if ( !self::$instance instanceof self) {
self::$instance = new self;
}
return self::$instance;