3 namespace Org\Mxchange\CoreFramework\Application;
5 // Import framework stuff
6 use Org\Mxchange\CoreFramework\Controller\Controller;
7 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
8 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
9 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
12 * A general application class for the ApplicationHelper classes.
14 * @author Roland Haeder <webmaster@shipsimu.org>
16 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
17 * @license GNU GPL 3.0 or any newer version
18 * @link http://www.shipsimu.org
20 * This program is free software: you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation, either version 3 of the License, or
23 * (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program. If not, see <http://www.gnu.org/licenses/>.
33 abstract class BaseApplication extends BaseFrameworkSystem {
35 * The version number of this application
37 private $appVersion = '';
40 * The human-readable name for this application
42 private $appName = '';
45 * The short uni*-like name for this application
47 private $shortName = '';
50 * Own singleton instance of this application helper
52 private static $applicationInstance = NULL;
55 * A controller instance
57 private $controllerInstance = NULL;
60 * Protected constructor
62 * @param $className Name of the class
65 protected function __construct (string $className) {
66 // Call parent constructor
67 parent::__construct($className);
69 // Set this instance as application instance
70 GenericRegistry::getRegistry()->addInstance('application', $this);
74 * Getter for own instance
76 * @return $applicationInstance An instance of a ManageableApplication class
78 public static final function getApplicationInstance () {
79 return self::$applicationInstance;
83 * Setter for own instance
85 * @param $applicationInstance An instance of a ManageableApplication class
87 public static final function setApplicationInstance (ManageableApplication $applicationInstance) {
88 self::$applicationInstance = $applicationInstance;
92 * Setter for controller instance (this surely breaks a bit the MVC patterm)
94 * @param $controllerInstance An instance of the controller
97 public final function setControllerInstance (Controller $controllerInstance) {
98 $this->controllerInstance = $controllerInstance;
102 * Getter for controller instance (this surely breaks a bit the MVC patterm)
104 * @return $controllerInstance An instance of the controller
106 public final function getControllerInstance () {
107 return $this->controllerInstance;
111 * Getter for the version number
113 * @return $appVersion The application's version number
115 public final function getAppVersion () {
116 return $this->appVersion;
120 * Setter for the version number
122 * @param $appVersion The application's version number
125 public final function setAppVersion (string $appVersion) {
127 $this->appVersion = $appVersion;
131 * Getter for human-readable name
133 * @return $appName The application's human-readable name
135 public final function getAppName () {
136 return $this->appName;
140 * Setter for human-readable name
142 * @param $appName The application's human-readable name
145 public final function setAppName (string $appName) {
147 $this->appName = $appName;;
151 * Getter for short uni*-like name
153 * @return $shortName The application's short uni*-like name
155 public final function getAppShortName () {
156 return $this->shortName;
160 * Setter for short uni*-like name
162 * @param $shortName The application's short uni*-like name
165 public final function setAppShortName (string $shortName) {
167 $this->shortName = (string) $shortName;