1: <?php
2: /**
3: * ManiaLib - Lightweight PHP framework for Manialinks
4: *
5: * @see http://code.google.com/p/manialib/
6: * @copyright Copyright (c) 2009-2011 NADEO (http://www.nadeo.com)
7: * @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
8: * @version $Revision: 590 $:
9: * @author $Author: maximeraoust $:
10: * @date $Date: 2011-12-27 19:40:38 +0100 (mar., 27 déc. 2011) $:
11: */
12:
13: namespace ManiaLib\Utils;
14:
15: abstract class Singleton
16: {
17:
18: protected static $instances = array();
19:
20: static function getInstance()
21: {
22: $class = get_called_class();
23: if(!isset(self::$instances[$class]))
24: {
25: self::$instances[$class] = new $class();
26: }
27: return self::$instances[$class];
28: }
29:
30: protected function __construct()
31: {
32:
33: }
34:
35: final protected function __clone()
36: {
37:
38: }
39:
40: }
41:
42: ?>