'public static final' is correct
[core.git] / inc / classes / main / registry / generic / class_Registry.php
1 <?php
2 /**
3  * A registry for several data types and objects. Objects should be added by
4  * addInstance() and therefore must implement the interface Registerable.
5  *
6  * @author              Roland Haeder <webmaster@ship-simu.org>
7  * @version             0.0.0
8  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Core Developer Team
9  * @license             GNU GPL 3.0 or any newer version
10  * @link                http://www.ship-simu.org
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  */
25 class Registry extends BaseRegistry implements Register {
26         /**
27          * Instance of this class
28          */
29         private static $registryInstance = null;
30
31         /**
32          * Protected constructor
33          *
34          * @return      void
35          */
36         protected function __construct () {
37                 // Call parent constructor
38                 parent::__construct(__CLASS__);
39         }
40
41         /**
42          * Singleton getter for self instance. This class has no factory pattern
43          * because here is no need for special parameters.
44          *
45          * @return      $registryInstance       Instance of this class
46          */
47         public static final function getRegistry () {
48                 // Is an instance there?
49                 if (is_null(self::$registryInstance)) {
50                         // Not yet, so create one
51                         self::$registryInstance = new Registry();
52                 } // END - if
53
54                 // Return the instance
55                 return self::$registryInstance;
56         }
57 }
58
59 // [EOF]
60 ?>