Init ci
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
abstract class Singleton {
|
||||
|
||||
protected function __construct() {}
|
||||
|
||||
final public static function getInstance() {
|
||||
static $_instances = array();
|
||||
|
||||
$class_name = get_called_class();
|
||||
|
||||
if (! isset($_instances[$class_name])) {
|
||||
$_instances[$class_name] = new $class_name();
|
||||
}
|
||||
|
||||
return $_instances[$class_name];
|
||||
}
|
||||
|
||||
final private function __clone() {}
|
||||
}
|
||||
Reference in New Issue
Block a user