trait SingletonTrait {
protected static $instance = null;
public function __construct(){}
public function __clone(){}
public function __wakeup(){}
public final static function getInstance() {
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
}
abstract class Singleton {
protected static $instance = null;
public function __construct(){}
public function __clone(){}
public function __wakeup(){}
public final static function getInstance() {
if (null === static::$instance) {
static::$instance = new static();
}
return static::$instance;
}
}