]> git.mxchange.org Git - core.git/blob - framework/main/classes/application/class_BaseApplication.php
fe844a21dae06bd8602bd7cecf5d70caaa6e83dc
[core.git] / framework / main / classes / application / class_BaseApplication.php
1 <?php
2 // Own namespace
3 namespace Org\Mxchange\CoreFramework\Application;
4
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;
10
11 /**
12  * A general application class for the ApplicationHelper classes.
13  *
14  * @author              Roland Haeder <webmaster@shipsimu.org>
15  * @version             0.0.0
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
19  *
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.
24  *
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.
29  *
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/>.
32  */
33 abstract class BaseApplication extends BaseFrameworkSystem {
34         /**
35          * The version number of this application
36          */
37         private $appVersion = '';
38
39         /**
40          * The human-readable name for this application
41          */
42         private $appName = '';
43
44         /**
45          * The short uni*-like name for this application
46          */
47         private $shortName = '';
48
49         /**
50          * Own singleton instance of this application helper
51          */
52         private static $applicationInstance = NULL;
53
54         /**
55          * A controller instance
56          */
57         private $controllerInstance = NULL;
58
59         /**
60          * Protected constructor
61          *
62          * @param       $className      Name of the class
63          * @return      void
64          */
65         protected function __construct (string $className) {
66                 // Call parent constructor
67                 parent::__construct($className);
68
69                 // Set this instance as application instance
70                 GenericRegistry::getRegistry()->addInstance('application', $this);
71         }
72
73         /**
74          * Getter for own instance
75          *
76          * @return      $applicationInstance    An instance of a ManageableApplication class
77          */
78         public static final function getApplicationInstance () {
79                 return self::$applicationInstance;
80         }
81
82         /**
83          * Setter for own instance
84          *
85          * @param       $applicationInstance    An instance of a ManageableApplication class
86          */
87         public static final function setApplicationInstance (ManageableApplication $applicationInstance) {
88                 self::$applicationInstance = $applicationInstance;
89         }
90
91         /**
92          * Setter for controller instance (this surely breaks a bit the MVC patterm)
93          *
94          * @param       $controllerInstance             An instance of the controller
95          * @return      void
96          */
97         public final function setControllerInstance (Controller $controllerInstance) {
98                 $this->controllerInstance = $controllerInstance;
99         }
100
101         /**
102          * Getter for controller instance (this surely breaks a bit the MVC patterm)
103          *
104          * @return      $controllerInstance             An instance of the controller
105          */
106         public final function getControllerInstance () {
107                 return $this->controllerInstance;
108         }
109
110         /**
111          * Getter for the version number
112          *
113          * @return      $appVersion     The application's version number
114          */
115         public final function getAppVersion () {
116                 return $this->appVersion;
117         }
118
119         /**
120          * Setter for the version number
121          *
122          * @param       $appVersion     The application's version number
123          * @return      void
124          */
125         public final function setAppVersion (string $appVersion) {
126                 // Cast and set it
127                 $this->appVersion = $appVersion;
128         }
129
130         /**
131          * Getter for human-readable name
132          *
133          * @return      $appName        The application's human-readable name
134          */
135         public final function getAppName () {
136                 return $this->appName;
137         }
138
139         /**
140          * Setter for human-readable name
141          *
142          * @param       $appName        The application's human-readable name
143          * @return      void
144          */
145         public final function setAppName (string $appName) {
146                 // Cast and set it
147                 $this->appName = $appName;;
148         }
149
150         /**
151          * Getter for short uni*-like name
152          *
153          * @return      $shortName      The application's short uni*-like name
154          */
155         public final function getAppShortName () {
156                 return $this->shortName;
157         }
158
159         /**
160          * Setter for short uni*-like name
161          *
162          * @param       $shortName      The application's short uni*-like name
163          * @return      void
164          */
165         public final function setAppShortName (string $shortName) {
166                 // Cast and set it
167                 $this->shortName = (string) $shortName;
168         }
169
170 }