3 namespace Org\Mxchange\CoreFramework\Registry;
6 * A registry for several data types and objects. Objects should be added by
7 * addInstance() and therefore must implement the interface Registerable.
9 * @author Roland Haeder <webmaster@shipsimu.org>
11 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
12 * @license GNU GPL 3.0 or any newer version
13 * @link http://www.shipsimu.org
15 * This program is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 class GenericRegistry extends BaseRegistry implements Register {
30 * Instance of this class
32 private static $registryInstance = NULL;
35 * Protected constructor
39 private function __construct () {
40 // Call parent constructor
41 parent::__construct(__CLASS__);
45 * Singleton getter for self instance. This class has no factory pattern
46 * because here is no need for special parameters.
48 * @return $registryInstance Instance of this class
50 public static final function getRegistry () {
51 // Is an instance there?
52 if (is_null(self::$registryInstance)) {
53 // Not yet, so create one
54 self::$registryInstance = new GenericRegistry();
57 // Return the instance
58 return self::$registryInstance;