use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
/**
* A class holding general data about the application and some methods for
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ApplicationHelper extends BaseApplication implements ManageableApplication, Registerable {
- /**
- * The version number of this application
- */
- private $appVersion = '';
-
- /**
- * The human-readable name for this application
- */
- private $appName = '';
-
- /**
- * The short uni*-like name for this application
- */
- private $shortName = '';
-
- /**
- * An instance of this class
- */
- private static $selfInstance = NULL;
-
/**
* Private constructor
*
*/
public static final function getSelfInstance () {
// Is the instance there?
- if (is_null(self::$selfInstance)) {
- self::$selfInstance = new ApplicationHelper();
- } // END - if
+ if (is_null(self::getApplicationInstance())) {
+ // Set it
+ self::setApplicationInstance(new ApplicationHelper());
+ }
// Return the instance
- return self::$selfInstance;
- }
-
- /**
- * Getter for the version number
- *
- * @return $appVersion The application's version number
- */
- public final function getAppVersion () {
- return $this->appVersion;
- }
- /**
- * Setter for the version number
- *
- * @param $appVersion The application's version number
- * @return void
- */
- public final function setAppVersion ($appVersion) {
- // Cast and set it
- $this->appVersion = (string) $appVersion;
- }
-
- /**
- * Getter for human-readable name
- *
- * @return $appName The application's human-readable name
- */
- public final function getAppName () {
- return $this->appName;
- }
-
- /**
- * Setter for human-readable name
- *
- * @param $appName The application's human-readable name
- * @return void
- */
- public final function setAppName ($appName) {
- // Cast and set it
- $this->appName = (string) $appName;;
- }
-
- /**
- * Getter for short uni*-like name
- *
- * @return $shortName The application's short uni*-like name
- */
- public final function getAppShortName () {
- return $this->shortName;
- }
-
- /**
- * Setter for short uni*-like name
- *
- * @param $shortName The application's short uni*-like name
- * @return void
- */
- public final function setAppShortName ($shortName) {
- // Cast and set it
- $this->shortName = (string) $shortName;
+ return self::getApplicationInstance();
}
/**
// Get a controller resolver
$resolverClass = sprintf(
'Org\Mxchange\City\Resolver\Controller\%s',
- self::convertToClassName(sprintf(
+ StringUtils::convertToClassName(sprintf(
'%s_%s_controller_resolver',
$this->getAppShortName(),
FrameworkBootstrap::getRequestTypeFromSystem()
*/
public function updateCityData () {
// Set some dummy configuration entries, e.g. city_status
- $this->getConfigInstance()->setConfigEntry('city_status', $this->getStateInstance()->getStateName());
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('city_status', $this->getStateInstance()->getStateName());
}
/**
*/
public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
// Which login type do we have?
- switch ($this->getConfigInstance()->getConfigEntry('login_type')) {
+ switch (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_type')) {
case 'username': // Login via username
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter_class'));
break;
$applicationInstance = $registryInstance->getInstance('application');
// Default action is the one from configuration
- $this->actionName = $this->convertDashesToUnderscores($applicationInstance->getAppShortName()) . '_login_' . $this->getConfigInstance()->getConfigEntry('login_default_action');
+ $this->actionName = $this->convertDashesToUnderscores($applicationInstance->getAppShortName()) . '_login_' . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_default_action');
// Get "action" from request
$actReq = $requestInstance->getRequestElement('action');
namespace Org\Mxchange\City\Command;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Command\BaseCommand;
use Org\Mxchange\CoreFramework\Command\Commandable;
use Org\Mxchange\CoreFramework\Controller\Controller;
$userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, $hashedString);
// Re-set config entry to mailer engine
- $this->getConfigInstance()->setConfigEntry('html_template_class', $this->getConfigInstance()->getConfigEntry('mail_template_class'));
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('html_template_class', FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('mail_template_class'));
// Prepare the template engine
$templateInstance = $this->prepareTemplateInstance($applicationInstance);
namespace Org\Mxchange\City\Database\Frontend\Sections;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\Registerable;
*
* totalInitialSections = (radius + 1) * (radius + 1)
*/
- $radius = $this->getConfigInstance()->getConfigEntry('city_max_initial_xy_expansion_radius');
+ $radius = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_xy_expansion_radius');
// Max up and down ...
- $maxUp = $this->getConfigInstance()->getConfigEntry('city_max_initial_up_expansion');
- $maxDown = $this->getConfigInstance()->getConfigEntry('city_max_initial_down_expansion');
+ $maxUp = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_up_expansion');
+ $maxDown = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_down_expansion');
// Calculate total sections
$totalSections = (($radius + 1) * ($radius + 1) * $maxUp * ($maxDown + 1));
namespace Org\Mxchange\City\Daemon\Factory;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Request\Requestable;
$cityInstance = GenericRegistry::getRegistry()->getInstance('city');
} elseif (($requestInstance instanceof Requestable) && ($responseInstance instanceof Responseable)) {
// The default city-mode is from our configuration
- $cityMode = $factoryInstance->getConfigInstance()->getConfigEntry('city_default_mode');
+ $cityMode = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_default_mode');
// Is the city 'mode' parameter set?
if ($requestInstance->isRequestElementSet('mode')) {
$requestInstance->setRequestElement('mode', $cityMode);
}
- // Now convert the city-mode in a class name
- $className = 'Org\Mxchange\City\Daemon\Simulation\Simulation' . $factoryInstance->convertToClassName($cityMode) . 'CityDaemon';
+ // Now convert the city-mode in a configuration entry
+ $configEntry = sprintf('city_%s_daemon_mode_class', $cityMode);
// Get the city instance
- $cityInstance = ObjectFactory::createObjectByName($className, array($requestInstance));
+ $cityInstance = ObjectFactory::createObjectByConfiguredName($configEntry, array($requestInstance));
// Get a registry
$applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
* @return void
*/
protected function setDefaultAuthMethod () {
- $this->authMethod = $this->getConfigInstance()->getConfigEntry('auth_method_class');
+ $this->authMethod = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('auth_method_class');
}
/**
$configEntry = 'user_status_unconfirmed';
// Is the confirmation process entirely disabled?
- if ($this->getConfigInstance()->getConfigEntry('confirm_email_enabled') === 'N') {
+ if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('confirm_email_enabled') === 'N') {
// No confirmation of email needed
$configEntry = 'user_status_confirmed';
} // END - if
}
// Is this a guest account?
- if ((($element == 'username') || ($alias == 'username')) && (FrameworkBootstrap::getRequestInstance()->getRequestElement($element) == $this->getConfigInstance()->getConfigEntry('guest_login_user'))) {
+ if ((($element == 'username') || ($alias == 'username')) && (FrameworkBootstrap::getRequestInstance()->getRequestElement($element) == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('guest_login_user'))) {
// Yes, then set the config entry to guest status
$configEntry = 'user_status_guest';
} // END - if
// CFG: DEFAULT-CITY-CONSOLE-CONTROLLER
$cfg->setConfigEntry('default_city_console_controller', 'daemon');
+// CFG: CITY-DEFAULT-DAEMON-MODE-CLASS
+$cfg->setConfigEntry('city_default_daemon_mode_class', 'Org\Mxchange\City\Daemon\Simulation\SimulationDefaultCityDaemon');
+
// CFG: CITY-CONSOLE-CMD-DAEMON-RESOLVER-CLASS
$cfg->setConfigEntry('city_console_cmd_daemon_resolver_class', 'Org\Mxchange\City\Resolver\Command\CityConsoleCommandResolver');
-Subproject commit c15d02389e67a880e7b4c6b19f2b06722efa4e6f
+Subproject commit 513812814a5a17022d414727e5a4c6d0823fe5f6