Continued:
[core.git] / framework / main / classes / language / class_LanguageSystem.php
index 6e77500..6dfbe3b 100644 (file)
@@ -1,12 +1,15 @@
 <?php
 // Own namespace
-namespace CoreFramework\Localization;
+namespace Org\Mxchange\CoreFramework\Localization;
 
 // Import framework stuff
-use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Object\BaseFrameworkSystem;
-use CoreFramework\Registry\Registerable;
-use CoreFramework\Registry\Registry;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+
+// Import SPL stuff
+use \InvalidArgumentException;
 
 /**
  * The language sub-system for handling language strings being used in the
@@ -67,7 +70,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
         *
         * @param       $languageBasePath       The local base path for all language strings or emty for auto-detection
         * @return      $langInstance   An instance of LanguageSystem
-        * @throws      LanguagePathIsEmptyException    If the provided $languageBasePath is empty
+        * @throws      InvalidArgumentException        If languageBasePath remains empty (@TODO Get rid of that old-lost code)
         * @throws      InvalidLanguagePathStringException      If $languageBasePath is no string
         * @throws      LanguagePathIsNoDirectoryException      If $languageBasePath is no
         *                                                                              directory or not found
@@ -82,7 +85,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
                if (empty($languageBasePath)) {
                        // No, then attempt "auto-dection":
                        // 1) Get application
-                       $applicationInstance = Registry::getRegistry()->getInstance('app');
+                       $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
 
                        // 2) Try to build it
                        $languageBasePath = sprintf('%s%s/language/',
@@ -94,7 +97,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
                // Is the base path valid?
                if (empty($languageBasePath)) {
                        // Language path is empty
-                       throw new LanguagePathIsEmptyException($langInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('languageBasePath is still empty');
                } elseif (!is_string($languageBasePath)) {
                        // Is not a string
                        throw new InvalidLanguagePathStringException(array($langInstance, $languageBasePath), self::EXCEPTION_INVALID_STRING);
@@ -113,7 +116,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
                $langInstance->initLanguageStrings();
 
                // Set language code from default config
-               $langInstance->setLanguageCode(FrameworkConfiguration::getSelfInstance()->getConfigEntry('default_lang'));
+               $langInstance->setLanguageCode(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('default_lang'));
 
                // Remember this instance
                self::$selfInstance = $langInstance;