summaryrefslogtreecommitdiff
path: root/src/lib/Singleton.class.php
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-10-27 19:44:10 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-10-27 19:44:10 -0400
commit29a3ffb99435827d5a7ea6886ac22bd2ee18d593 (patch)
tree511928e110e52d210c9707ab22e952b01b3368b1 /src/lib/Singleton.class.php
parent40bef9550687ed2b5a0c55feafc0b0dd015177e2 (diff)
I think this fixes everything, but it now depends on PHP 5.3+
The introduction of the dependency on PHP 5.3 is that lib/Singleton.class uses `get_called_class()'
Diffstat (limited to 'src/lib/Singleton.class.php')
-rw-r--r--src/lib/Singleton.class.php10
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];
}
}