diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-01-08 17:45:50 -0800 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-01-08 17:45:50 -0800 |
commit | 4c58c41d818918b1690b56f05876d9af642354c0 (patch) | |
tree | b07c0f2925a5753ab3c34379db5c90c5dc38bad1 /lpf/lib | |
parent | 83e460cdc3fc09867a3adb48c3d0894579dd3050 (diff) | |
parent | 3d64793a1ee45857856be1cd71c3a0a040a3e869 (diff) |
Diffstat (limited to 'lpf/lib')
-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]; + } +} |