mikehenrty / thin-pdo-wrapper

A simple database client utilizing PHP PDO.
MIT License
68 stars 32 forks source link

Private construct #6

Open CodersBrothers opened 11 years ago

CodersBrothers commented 11 years ago

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;

mikehenrty commented 11 years ago

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