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