]> git.mxchange.org Git - core.git/blobdiff - index.php
Continued:
[core.git] / index.php
index bc2faf43ddb258a277fbd85e2ab58b31c7660a05..51a9f4758ec3a2fbdf28195223f7046ea98c1062 100644 (file)
--- a/index.php
+++ b/index.php
@@ -4,10 +4,11 @@ namespace Org\Mxchange\CoreFramework\EntryPoint;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
 use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
 use Org\Mxchange\CoreFramework\Localization\LanguageSystem;
+use Org\Mxchange\CoreFramework\Localization\ManageableLanguage;
 use Org\Mxchange\CoreFramework\Loader\ClassLoader;
 use Org\Mxchange\CoreFramework\Generic\FrameworkException;
 
@@ -24,7 +25,7 @@ use \Exception;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2021 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -83,7 +84,7 @@ final class ApplicationEntryPoint {
                }
 
                // Get some instances
-               $tpl = $configInstance->getConfigEntry('html_template_class');
+               $templateClassName = $configInstance->getConfigEntry('html_template_class');
                $languageInstance = LanguageSystem::getSelfInstance();
 
                // Initialize template instance here to avoid warnings in IDE
@@ -93,11 +94,11 @@ final class ApplicationEntryPoint {
                $responseInstance = FrameworkBootstrap::getResponseInstance();
 
                // Is the template engine loaded?
-               if ((class_exists($tpl)) && (is_object($languageInstance))) {
+               if ((class_exists($templateClassName)) && ($languageInstance instanceof ManageableLanguage)) {
                        // Use the template engine for putting out (nicer look) the message
                        try {
                                // Get the template instance from our object factory
-                               $templateInstance = ObjectFactory::createObjectByName($tpl);
+                               $templateInstance = ObjectFactory::createObjectByName($templateClassName);
                        } catch (FrameworkException $e) {
                                exit(sprintf('[Main:] Could not initialize template engine for reason: <span class="exception_reason">%s</span>',
                                        $e->getMessage()
@@ -130,7 +131,13 @@ final class ApplicationEntryPoint {
                        // Init application instance
                        $applicationInstance = NULL;
 
-                       // Is the class there?
+                       /*
+                        * The following class may NOT be loaded at all times. For example,
+                        * it might be the (rare) case that an error has happened BEFORE
+                        * that class had been loaded and cannot be loaded or else an
+                        * infinte loop in invoking this method will take place resulting in
+                        * a stack-overflow error.
+                        */
                        if (class_exists('Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper')) {
                                // Get application instance
                                $applicationInstance = ApplicationHelper::getSelfInstance();
@@ -142,13 +149,13 @@ final class ApplicationEntryPoint {
                        // We only try this
                        try {
                                // Assign variables
-                               $templateInstance->assignVariable('message', $message);
-                               $templateInstance->assignVariable('code', $code);
-                               $templateInstance->assignVariable('extra', $extraData);
-                               $templateInstance->assignVariable('backtrace', $backtrace);
+                               $templateInstance->assignVariable('message'       , $message);
+                               $templateInstance->assignVariable('code'          , $code);
+                               $templateInstance->assignVariable('extra'         , $extraData);
+                               $templateInstance->assignVariable('backtrace'     , $backtrace);
                                $templateInstance->assignVariable('total_includes', ClassLoader::getSelfInstance()->getTotal());
-                               $templateInstance->assignVariable('total_objects', ObjectFactory::getTotal());
-                               $templateInstance->assignVariable('title', $languageInstance->getMessage('emergency_exit_title'));
+                               $templateInstance->assignVariable('total_objects' , ObjectFactory::getTotal());
+                               $templateInstance->assignVariable('title'         , $languageInstance->getMessage('emergency_exit_title'));
 
                                // Load the template
                                $templateInstance->loadCodeTemplate('emergency_exit');