diff options
Diffstat (limited to 'src/lib/Singleton.class.php')
-rw-r--r-- | src/lib/Singleton.class.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/Singleton.class.php b/src/lib/Singleton.class.php index 4eb3bb3..2f8c74f 100644 --- a/src/lib/Singleton.class.php +++ b/src/lib/Singleton.class.php @@ -1,12 +1,12 @@ <?php abstract class Singleton { - private static $obj; + private static $instances = array(); public static function getInstance() { - if (!isset(self::$obj)) { - $class = get_called_class(); - self::$obj = new $class; + $class = get_called_class(); + if (!isset(self::$instances[$class])) { + self::$instances[$class] = new $class; } - return self::$obj; + return self::$instances[$class]; } } |