Static method getInstance() conflicts with getInstance() in class BaseRegistry,
authorRoland Häder <roland@mxchange.org>
Tue, 8 Nov 2011 06:35:06 +0000 (06:35 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 8 Nov 2011 06:35:06 +0000 (06:35 +0000)
better it gets renamed to something else.

19 files changed:
inc/classes.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/console/class_ConsoleTools.php
inc/classes/main/crypto/class_CryptoHelper.php
inc/classes/main/factories/objects/class_ObjectFactory.php
inc/classes/main/language/class_LanguageSystem.php
inc/classes/main/output/class_ConsoleOutput.php
inc/classes/main/registry/class_BaseRegistry.php
inc/classes/middleware/database/class_DatabaseConnection.php
inc/classes/middleware/debug/class_DebugMiddleware.php
inc/classes/middleware/io/class_FileIoHandler.php
inc/config.php
inc/config/class_FrameworkConfiguration.php
inc/config/config-hubmaster.php
inc/database.php
inc/includes.php
inc/loader/class_ClassLoader.php
inc/output.php
inc/selector.php

index ac3940a..6084add 100644 (file)
@@ -32,7 +32,7 @@ $lowerClasses = array(
 );
 
 // Cache loader instance
-$loaderInstance = ClassLoader::getInstance();
+$loaderInstance = ClassLoader::getSelfInstance();
 
 // Load all classes
 foreach ($lowerClasses as $className) {
index 34c10ef..fcd7dab 100644 (file)
@@ -313,7 +313,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Set configuration instance if no registry ...
                if (!$this instanceof Register) {
                        // ... because registries doesn't need to be configured
-                       $this->setConfigInstance(FrameworkConfiguration::getInstance());
+                       $this->setConfigInstance(FrameworkConfiguration::getSelfInstance());
                } // END - if
 
                // Is the startup time set? (0 cannot be true anymore)
@@ -893,7 +893,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                ApplicationEntryPoint::app_die(sprintf("<div class=\"debug_header\">%s debug output:</div><div class=\"debug_content\">%s</div>\nLoaded includes: <div class=\"debug_include_list\">%s</div>",
                        $this->__toString(),
                        $content,
-                       ClassLoader::getInstance()->getPrintableIncludeList()
+                       ClassLoader::getSelfInstance()->getPrintableIncludeList()
                ));
        }
 
index 825f5fa..e43c969 100644 (file)
@@ -127,7 +127,7 @@ class ConsoleTools extends BaseFrameworkSystem {
                }
 
                // Set it in configuration
-               FrameworkConfiguration::getInstance()->setServerAddress($ip);
+               FrameworkConfiguration::getSelfInstance()->setServerAddress($ip);
        }
 
        /**
index 0c626bb..61df314 100644 (file)
@@ -75,7 +75,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
         *
         * @return      $selfInstance   An instance of this crypto helper class
         */
-       public static final function getInstance () {
+       public static final function getSelfInstance () {
                // Is no instance there?
                if (is_null(self::$selfInstance)) {
                        // Then get a new one
index b84f55a..c089ba3 100644 (file)
@@ -81,7 +81,7 @@ class ObjectFactory extends BaseFactory {
         */
        public static final function createObjectByConfiguredName ($configEntry, array $args=array()) {
                // Read the configuration entry
-               $className = FrameworkConfiguration::getInstance()->getConfigEntry($configEntry);
+               $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry($configEntry);
 
                // Send this to the other factory...
                $objectInstance = self::createObjectByName($className, $args);
index df1fe42..3cde530 100644 (file)
@@ -91,7 +91,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
                $langInstance->initLanguageStrings();
 
                // Set language code from default config
-               $langInstance->setLanguageCode(FrameworkConfiguration::getInstance()->getConfigEntry('default_lang'));
+               $langInstance->setLanguageCode(FrameworkConfiguration::getSelfInstance()->getConfigEntry('default_lang'));
 
                // Remember this instance
                self::$thisInstance = $langInstance;
@@ -105,7 +105,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
         *
         * @return      $thisInstance   An instance of this class
         */
-       public static final function getInstance () {
+       public static final function getSelfInstance () {
                return self::$thisInstance;
        }
 
index af45aaa..3fc2bcc 100644 (file)
@@ -72,7 +72,7 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
        public static final function getInstance() {
                // Is the self-instance already set?
                if (is_null(self::$consoleInstance)) {
-                       $contentType = FrameworkConfiguration::getInstance()->getConfigEntry('web_content_type');
+                       $contentType = FrameworkConfiguration::getSelfInstance()->getConfigEntry('web_content_type');
                        self::$consoleInstance = ConsoleOutput::createConsoleOutput($contentType);
                } // END - if
 
index 390d2c6..718f0a4 100644 (file)
@@ -74,7 +74,7 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable {
        }
 
        /**
-        * Getter for whole instanceregistry
+        * Getter for whole instance registry
         *
         * @return      $instanceRegistry       The whole instance registry array
         */
index 84b8cc2..0a688c3 100644 (file)
@@ -67,7 +67,7 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re
        }
 
        // Get an instance of this class
-       public static final function getInstance () {
+       public static final function getSelfInstance () {
                return self::$thisInstance;
        }
 
index 4d70703..1490116 100644 (file)
@@ -84,7 +84,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
         *
         * @return      $thisInstance           An instance of this class
         */
-       public static final function getInstance() {
+       public static final function getSelfInstance() {
                return self::$thisInstance;
        }
 
index 22dff80..70afeef 100644 (file)
@@ -74,7 +74,7 @@ class FileIoHandler extends BaseMiddleware {
         *
         * @return      $thisInstance   An instance of this class
         */
-       public static final function getInstance () {
+       public static final function getSelfInstance () {
                return self::$thisInstance;
        }
 
index 441e0ca..8e9c3d4 100644 (file)
@@ -30,7 +30,7 @@ require(ApplicationEntryPoint::detectCorePath() . '/inc/classes/interfaces/regis
 require(ApplicationEntryPoint::detectCorePath() . '/inc/config/class_FrameworkConfiguration.php');
 
 // Get a new configuration instance
-$cfg = FrameworkConfiguration::getInstance();
+$cfg = FrameworkConfiguration::getSelfInstance();
 
 // CFG: SERVER-PATH
 $cfg->setConfigEntry('base_path', ApplicationEntryPoint::detectCorePath() . '/');
index 938b67b..5006ea4 100644 (file)
@@ -65,7 +65,7 @@ class FrameworkConfiguration implements Registerable {
         *
         * @return      $configInstance An instance of this class
         */
-       public static final function getInstance () {
+       public static final function getSelfInstance () {
                // is the instance there?
                if (is_null(self::$configInstance))  {
                        // Create a config instance
index 9e06c50..be3267b 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 // Get the configuration instance
-$cfg = FrameworkConfiguration::getInstance();
+$cfg = FrameworkConfiguration::getSelfInstance();
 
 // CFG: HUB-BOOTSTRAP-NODES
 $cfg->setConfigEntry('hub_bootstrap_nodes', '188.138.90.169:9060');
index 54329fd..badcd35 100644 (file)
@@ -28,7 +28,7 @@
 $databaseInstance = NULL;
 
 // Generate FQFN for the database layer
-$fqfn = FrameworkConfiguration::getInstance()->getConfigEntry('base_path') . 'inc/database/lib-' . FrameworkConfiguration::getInstance()->getConfigEntry('db_type') . '.php';
+$fqfn = FrameworkConfiguration::getSelfInstance()->getConfigEntry('base_path') . 'inc/database/lib-' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('db_type') . '.php';
 
 // Load the database layer include
 if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) {
@@ -37,7 +37,7 @@ if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) {
 } else {
        // Layer is missing!
        ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer is missing! (%s) -&gt; R.I.P.",
-               FrameworkConfiguration::getInstance()->getConfigEntry('db_type')
+               FrameworkConfiguration::getSelfInstance()->getConfigEntry('db_type')
        ));
 }
 
@@ -45,7 +45,7 @@ if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) {
 unset($fqfn);
 
 // Prepare database instance
-$connectionInstance = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $databaseInstance);
+$connectionInstance = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getSelfInstance(), $databaseInstance);
 
 // Is the app variable there and valid?
 // @TODO Rewrite this
index 38ec9ee..95d8086 100644 (file)
  */
 
 // Include the class loader function
-require(FrameworkConfiguration::getInstance()->getConfigEntry('base_path') . 'inc/loader/class_ClassLoader.php');
+require(FrameworkConfiguration::getSelfInstance()->getConfigEntry('base_path') . 'inc/loader/class_ClassLoader.php');
 
 // Shall we include additional configs where you can configure some things? Then
 // Load matching config
-ClassLoader::getInstance()->loadExtraConfigs();
+ClassLoader::getSelfInstance()->loadExtraConfigs();
 
 // Register hooks here
-require(FrameworkConfiguration::getInstance()->getConfigEntry('base_path') . 'inc/hooks.php');
+require(FrameworkConfiguration::getSelfInstance()->getConfigEntry('base_path') . 'inc/hooks.php');
 
 // Does the user has an application specified?
 // @TODO Find a nicer OOP-ed way for this
@@ -48,11 +48,11 @@ if (!empty($_GET['app'])) {
                $application = trim($app[1]);
        } else {
                // Invalid entry found, first must be "app"!
-               $application = FrameworkConfiguration::getInstance()->getConfigEntry('default_application');
+               $application = FrameworkConfiguration::getSelfInstance()->getConfigEntry('default_application');
        }
 } else {
        // Set the "application selector" application
-       $application = FrameworkConfiguration::getInstance()->getConfigEntry('default_application');
+       $application = FrameworkConfiguration::getSelfInstance()->getConfigEntry('default_application');
 }
 
 // Secure it, by keeping out tags
@@ -62,7 +62,7 @@ $application = htmlentities(strip_tags($application), ENT_QUOTES);
 $application = preg_replace('/([^a-z0-9_-])+/i', '', $application);
 
 // Set the application name for later usage
-FrameworkConfiguration::getInstance()->setConfigEntry('app_name', $application);
+FrameworkConfiguration::getSelfInstance()->setConfigEntry('app_name', $application);
 
 // [EOF]
 ?>
index 18b9244..ae5eb6f 100644 (file)
@@ -25,7 +25,7 @@
  * 1.3
  *  - Constructor is now empty and factory method 'createClassLoader' is created
  *  - renamed loadClasses to scanClassPath
- *  - Added initLoader(), $configInstance renamed to $configInstance
+ *  - Added initLoader()
  * 1.2
  *  - ClassLoader rewritten to PHP SPL's own RecursiveIteratorIterator class
  * 1.1
@@ -98,12 +98,12 @@ class ClassLoader {
 
        /**
         * The protected constructor. Please use the factory method below, or use
-        * getInstance() for singleton
+        * getSelfInstance() for singleton
         *
         * @return      void
         */
        protected function __construct () {
-               // Is Currently empty
+               // Is currently empty
        }
 
        /**
@@ -179,7 +179,9 @@ class ClassLoader {
                self::$selfInstance = $this;
 
                // Skip here if no dev-mode
-               if (defined('DEVELOPER')) return;
+               if (defined('DEVELOPER')) {
+                       return;
+               } // END - if
 
                // IS the cache there?
                if (file_exists($this->listCacheFQFN)) {
@@ -211,19 +213,19 @@ class ClassLoader {
         */
        public static function autoLoad ($className) {
                // Try to include this class
-               self::getInstance()->includeClass($className);
+               self::getSelfInstance()->includeClass($className);
        }
 
        /**
-        * Getter for an instance of this class
+        * Singleton getter for an instance of this class
         *
-        * @return      $selfInstance           An instance of this class
+        * @return      $selfInstance           A singleton instance of this class
         */
-       public static final function getInstance () {
+       public static final function getSelfInstance () {
                // Is the instance there?
                if (is_null(self::$selfInstance)) {
                        // Get a new one
-                       self::$selfInstance = ClassLoader::createClassLoader(FrameworkConfiguration::getInstance());
+                       self::$selfInstance = ClassLoader::createClassLoader(FrameworkConfiguration::getSelfInstance());
                } // END - if
 
                // Return the instance
index 1e67056..6dbafaf 100644 (file)
  */
 
 // Get a debugger instance
-$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->getConfigEntry('debug_class'));
+$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getSelfInstance()->getConfigEntry('debug_class'));
 
 // Empty string should be ignored and used for testing the middleware
-DebugMiddleware::getInstance()->output('');
+DebugMiddleware::getSelfInstance()->output('');
 
 // [EOF]
 ?>
index 00b1dff..38f7656 100644 (file)
@@ -26,7 +26,7 @@
 
 // Try to load these includes in the given order
 $configAppIncludes = array(
-       'class_' . FrameworkConfiguration::getInstance()->getConfigEntry('app_helper_class'), // The ApplicationHelper class
+       'class_' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class'), // The ApplicationHelper class
        'debug',                // Some debugging stuff
        'exceptions',   // The application's own exception handler
        'loader',               // The application's class loader
@@ -38,12 +38,12 @@ $configAppIncludes = array(
 );
 
 // Cache base path/file here
-$basePathFile = FrameworkConfiguration::getInstance()->getConfigEntry('application_path') . FrameworkConfiguration::getInstance()->getConfigEntry('app_name');
+$basePathFile = FrameworkConfiguration::getSelfInstance()->getConfigEntry('application_path') . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_name');
 
 // Is the directory there?
 if (!is_dir($basePathFile)) {
        // Not found.
-       trigger_error('Application ' . FrameworkConfiguration::getInstance()->getConfigEntry('app_name') . ' not found.');
+       trigger_error('Application ' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_name') . ' not found.');
 } // END - if
 
 // Load them all (try only)
@@ -63,7 +63,7 @@ foreach ($configAppIncludes as $appInc) {
                //* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - START\n";
                require($appFqFn);
                //* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - END\n";
-       } elseif (FrameworkConfiguration::getInstance()->getConfigEntry('verbose_level') > 0) {
+       } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('verbose_level') > 0) {
                // File is missing
                trigger_error(sprintf("Cannot load application script %s.php! File is missing or read-protected.",
                        $appInc