use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
+use Org\Mxchange\CoreFramework\Localization\ManageableLanguage;
use Org\Mxchange\CoreFramework\Loader\ClassLoader;
use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Request\Requestable;
use Org\Mxchange\CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
// Import SPL stuff
use \BadMethodCallException;
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2019 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*/
private static $databaseInstance = NULL;
+ /**
+ * Language system instance
+ */
+ private static $languageInstance = NULL;
+
/*
* Includes applications may have. They will be tried in the given order,
* some will become soon deprecated.
// Load basic include files to continue bootstrapping
self::loadInclude(new SplFileInfo(sprintf('%smain%sinterfaces%sclass_FrameworkInterface.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)));
self::loadInclude(new SplFileInfo(sprintf('%smain%sclasses%sclass_BaseFrameworkSystem.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)));
- self::loadInclude(new SplFileInfo(sprintf('%smain%sclasses%sutils%sclass_StringUtils.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)));
+ self::loadInclude(new SplFileInfo(sprintf('%smain%sclasses%sutils%sstring%sclass_StringUtils.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)));
self::loadInclude(new SplFileInfo(sprintf('%smain%sinterfaces%sregistry%sclass_Registerable.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)));
self::loadInclude(new SplFileInfo(sprintf('%sconfig%sclass_FrameworkConfiguration.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR)));
$applicationInstance = call_user_func_array(
array(
'Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper', 'getSelfInstance'
- ), array()
+ ), []
);
// Some sanity checks
*
* @param $timezone The timezone string (e.g. Europe/Berlin)
* @return $success If timezone was accepted
- * @throws NullPointerException If $timezone is NULL
* @throws InvalidArgumentException If $timezone is empty
*/
- public static function setDefaultTimezone ($timezone) {
- // Is it null?
- if (is_null($timezone)) {
- // Throw NPE
- throw new NullPointerException(NULL, BaseFrameworkSystem::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_string($timezone)) {
- // Is not a string
- throw new InvalidArgumentException(sprintf('timezone[]=%s is not a string', gettype($timezone)));
- } elseif ((is_string($timezone)) && (empty($timezone))) {
+ public static function setDefaultTimezone (string $timezone) {
+ // Is it set?
+ if (empty($timezone)) {
// Entry is empty
throw new InvalidArgumentException('timezone is empty');
}
$requestType = self::getRequestTypeFromSystem();
// Create a new request object
- $requestInstance = ObjectFactory::createObjectByName(sprintf('Org\Mxchange\CoreFramework\Request\%sRequest', BaseFrameworkSystem::convertToClassName($request)));
+ $requestInstance = ObjectFactory::createObjectByName(sprintf('Org\Mxchange\CoreFramework\Request\%sRequest', StringUtils::convertToClassName($request)));
// Remember request instance here
self::setRequestInstance($requestInstance);
} // END - if
// ... and a new response object
- $responseClass = sprintf('Org\Mxchange\CoreFramework\Response\%sResponse', BaseFrameworkSystem::convertToClassName($request));
+ $responseClass = sprintf('Org\Mxchange\CoreFramework\Response\%sResponse', StringUtils::convertToClassName($request));
$responseInstance = ObjectFactory::createObjectByName($responseClass);
// Remember response instance here
return self::$databaseInstance;
}
+ /**
+ * Private getter for language instance
+ *
+ * @return $languageInstance An instance of a ManageableLanguage class
+ */
+ public static function getLanguageInstance () {
+ return self::$languageInstance;
+ }
+
+ /**
+ * Setter for language instance
+ *
+ * @param $languageInstance An instance of a ManageableLanguage class
+ * @return void
+ */
+ public static function setLanguageInstance (ManageableLanguage $languageInstance) {
+ self::$languageInstance = $languageInstance;
+ }
+
}