thin-pdo-wrapper icon indicating copy to clipboard operation
thin-pdo-wrapper copied to clipboard

Private construct

Open CodersBrothers opened this issue 11 years ago • 1 comments

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;

CodersBrothers avatar Apr 09 '13 18:04 CodersBrothers

These all sound pretty good to me @CodersBrothers. Any chance you'd want to do a pull request to fix these issues?

mikehenrty avatar Apr 14 '13 00:04 mikehenrty