From: Roland Häder Date: Tue, 8 Nov 2011 06:44:03 +0000 (+0000) Subject: Renamed getInstance() to getSelfInstance(), conflicts BaseRegistry versus several... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d3ac3088a75edd47f1b2a6f635fe2116129ecfd5;p=shipsimu.git Renamed getInstance() to getSelfInstance(), conflicts BaseRegistry versus several other classes --- diff --git a/application/selector/config.php b/application/selector/config.php index 587eccc..bade6cb 100644 --- a/application/selector/config.php +++ b/application/selector/config.php @@ -23,7 +23,7 @@ */ // Get a configuration instance for shorter lines -$cfg = FrameworkConfiguration::getInstance(); +$cfg = FrameworkConfiguration::getSelfInstance(); // CFG: HEADER-CHARSET $cfg->setConfigEntry('header_charset', 'utf-8'); diff --git a/application/selector/data.php b/application/selector/data.php index 99b3159..aca64d9 100644 --- a/application/selector/data.php +++ b/application/selector/data.php @@ -26,7 +26,7 @@ */ // Get config instance -$cfg = FrameworkConfiguration::getInstance(); +$cfg = FrameworkConfiguration::getSelfInstance(); // Get an instance of the helper $app = call_user_func_array( diff --git a/application/selector/exceptions.php b/application/selector/exceptions.php index ef9e845..1184f43 100644 --- a/application/selector/exceptions.php +++ b/application/selector/exceptions.php @@ -26,8 +26,8 @@ function __exceptionHandler (FrameworkException $e) { // Call the app_die() method ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s (%s) has terminated due to an uncaught exception: %s [%s]: %s Backtrace:
%s
", - ApplicationHelper::getInstance()->getAppName(), - ApplicationHelper::getInstance()->getAppShortName(), + ApplicationHelper::getSelfInstance()->getAppName(), + ApplicationHelper::getSelfInstance()->getAppShortName(), $e->__toString(), $e->getHexCode(), $e->getMessage(), diff --git a/application/selector/init.php b/application/selector/init.php index 00ce006..a77ca0d 100644 --- a/application/selector/init.php +++ b/application/selector/init.php @@ -26,7 +26,7 @@ */ // Get config instance -$cfg = FrameworkConfiguration::getInstance(); +$cfg = FrameworkConfiguration::getSelfInstance(); // Initialize output system require($cfg->getConfigEntry('base_path') . 'inc/output.php'); diff --git a/application/selector/loader.php b/application/selector/loader.php index a6b49bb..abe4534 100644 --- a/application/selector/loader.php +++ b/application/selector/loader.php @@ -22,10 +22,10 @@ */ // Get config instance -$cfg = FrameworkConfiguration::getInstance(); +$cfg = FrameworkConfiguration::getSelfInstance(); // Load all classes -ClassLoader::getInstance()->scanClassPath(sprintf("%s/%s/", $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'))); +ClassLoader::getSelfInstance()->scanClassPath(sprintf("%s/%s/", $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'))); // Clean up the global namespace unset($lowerClasses); diff --git a/application/selector/starter.php b/application/selector/starter.php index 9336b4a..c0923bf 100644 --- a/application/selector/starter.php +++ b/application/selector/starter.php @@ -24,30 +24,30 @@ // Is there an application helper instance? We need the method main() for // maining the application -$app = call_user_func_array(array(FrameworkConfiguration::getInstance()->getConfigEntry('app_helper_class'), 'getInstance'), array()); +$app = call_user_func_array(array(FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class'), 'getInstance'), array()); // Some sanity checks if ((empty($app)) || (is_null($app))) { // Something went wrong! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because the helper class %s is not loaded.", $application, - FrameworkConfiguration::getInstance()->getConfigEntry('app_helper_class') + FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class') )); } elseif (!is_object($app)) { // No object! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because 'app' is not an object.", $application )); -} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->getConfigEntry('entry_method'))) { +} elseif (!method_exists($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method'))) { // Method not found! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because the method %s is missing.", $application, - FrameworkConfiguration::getInstance()->getConfigEntry('entry_method') + FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method') )); } // Call the entry point method -call_user_func_array(array($app, FrameworkConfiguration::getInstance()->getConfigEntry('entry_method')), array()); +call_user_func_array(array($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')), array()); // [EOF] ?> diff --git a/application/ship-simu/config.php b/application/ship-simu/config.php index bdf71c8..e9a8f79 100644 --- a/application/ship-simu/config.php +++ b/application/ship-simu/config.php @@ -23,7 +23,7 @@ */ // Get a configuration instance for shorter lines -$cfg = FrameworkConfiguration::getInstance(); +$cfg = FrameworkConfiguration::getSelfInstance(); // CFG: HEADER-CHARSET $cfg->setConfigEntry('header_charset', 'utf-8'); diff --git a/application/ship-simu/data.php b/application/ship-simu/data.php index c4249c4..86f6ab6 100644 --- a/application/ship-simu/data.php +++ b/application/ship-simu/data.php @@ -34,7 +34,7 @@ */ // Get config instance -$cfg = FrameworkConfiguration::getInstance(); +$cfg = FrameworkConfiguration::getSelfInstance(); // Get an instance of the helper $app = call_user_func_array( diff --git a/application/ship-simu/exceptions.php b/application/ship-simu/exceptions.php index ef9e845..1184f43 100644 --- a/application/ship-simu/exceptions.php +++ b/application/ship-simu/exceptions.php @@ -26,8 +26,8 @@ function __exceptionHandler (FrameworkException $e) { // Call the app_die() method ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s (%s) has terminated due to an uncaught exception: %s [%s]: %s Backtrace:
%s
", - ApplicationHelper::getInstance()->getAppName(), - ApplicationHelper::getInstance()->getAppShortName(), + ApplicationHelper::getSelfInstance()->getAppName(), + ApplicationHelper::getSelfInstance()->getAppShortName(), $e->__toString(), $e->getHexCode(), $e->getMessage(), diff --git a/application/ship-simu/init.php b/application/ship-simu/init.php index 32108c9..906cdf9 100644 --- a/application/ship-simu/init.php +++ b/application/ship-simu/init.php @@ -34,7 +34,7 @@ */ // Get config instance -$cfg = FrameworkConfiguration::getInstance(); +$cfg = FrameworkConfiguration::getSelfInstance(); // Initialize output system require($cfg->getConfigEntry('base_path') . 'inc/output.php'); diff --git a/application/ship-simu/loader.php b/application/ship-simu/loader.php index 4679037..c0786aa 100644 --- a/application/ship-simu/loader.php +++ b/application/ship-simu/loader.php @@ -23,12 +23,12 @@ */ // Get config instance -$cfg = FrameworkConfiguration::getInstance(); +$cfg = FrameworkConfiguration::getSelfInstance(); // Load all classes for the application foreach ($lowerClasses as $className) { // Load the application classes - ClassLoader::getInstance()->scanClassPath(sprintf("%s/%s/%s", $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'), $className)); + ClassLoader::getSelfInstance()->scanClassPath(sprintf("%s/%s/%s", $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'), $className)); } // END - if // Clean up the global namespace diff --git a/application/ship-simu/starter.php b/application/ship-simu/starter.php index 3a18849..30280b5 100644 --- a/application/ship-simu/starter.php +++ b/application/ship-simu/starter.php @@ -24,30 +24,30 @@ // Is there an application helper instance? We need the method main() for // maining the application -$app = call_user_func_array(array(FrameworkConfiguration::getInstance()->getConfigEntry('app_helper_class'), 'getInstance'), array()); +$app = call_user_func_array(array(FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class'), 'getInstance'), array()); // Some sanity checks if ((empty($app)) || (is_null($app))) { // Something went wrong! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because the helper class %s is not loaded.", $application, - FrameworkConfiguration::getInstance()->getConfigEntry('app_helper_class') + FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class') )); } elseif (!is_object($app)) { // No object! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because 'app' is not an object.", $application )); -} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->getConfigEntry('entry_method'))) { +} elseif (!method_exists($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method'))) { // Method not found! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because the method %s is missing.", $application, - FrameworkConfiguration::getInstance()->getConfigEntry('entry_method') + FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method') )); } // Call user function -call_user_func_array(array($app, FrameworkConfiguration::getInstance()->getConfigEntry('entry_method')), array()); +call_user_func_array(array($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')), array()); // [EOF] ?> diff --git a/index.php b/index.php index 3950334..66a45e5 100644 --- a/index.php +++ b/index.php @@ -34,8 +34,6 @@ final class ApplicationEntryPoint { /** * The instances we want to remove after all is done - * - * @return void */ private static $instances = array ( 'cfg', // The configuration system @@ -75,7 +73,7 @@ final class ApplicationEntryPoint { } // END - if // Get config instance - $configInstance = FrameworkConfiguration::getInstance(); + $configInstance = FrameworkConfiguration::getSelfInstance(); // Do we have debug installation? if (($configInstance->getConfigEntry('product_install_mode') == 'productive') || ($silentMode === true)) { @@ -84,14 +82,14 @@ final class ApplicationEntryPoint { } // END - if // Get some instances - $tpl = FrameworkConfiguration::getInstance()->getConfigEntry('web_template_class'); - $languageInstance = LanguageSystem::getInstance(); + $tpl = FrameworkConfiguration::getSelfInstance()->getConfigEntry('web_template_class'); + $languageInstance = LanguageSystem::getSelfInstance(); // Initialize template instance here to avoid warnings in IDE - $templateInstance = null; + $templateInstance = NULL; // Get response instance - $responseInstance = ApplicationHelper::getInstance()->getResponseInstance(); + $responseInstance = ApplicationHelper::getSelfInstance()->getResponseInstance(); // Is the template engine loaded? if ((class_exists($tpl)) && (is_object($languageInstance))) { @@ -130,12 +128,12 @@ final class ApplicationEntryPoint { } // END - foreach // Init application instance - $applicationInstance = null; + $applicationInstance = NULL; // Is the class there? if (class_exists('ApplicationHelper')) { // Get application instance - $applicationInstance = ApplicationHelper::getInstance(); + $applicationInstance = ApplicationHelper::getSelfInstance(); // Assign application data $templateInstance->assignApplicationData($applicationInstance); @@ -148,7 +146,7 @@ final class ApplicationEntryPoint { $templateInstance->assignVariable('code', $code); $templateInstance->assignVariable('extra', $extraData); $templateInstance->assignVariable('backtrace', $backtrace); - $templateInstance->assignVariable('total_includes', ClassLoader::getInstance()->getTotal()); + $templateInstance->assignVariable('total_includes', ClassLoader::getSelfInstance()->getTotal()); $templateInstance->assignVariable('total_objects', ObjectFactory::getTotal()); $templateInstance->assignVariable('title', $languageInstance->getMessage('emergency_exit_title'));