]> git.mxchange.org Git - core.git/commitdiff
initLoader() should do that
authorRoland Häder <roland@mxchange.org>
Fri, 13 Mar 2009 13:35:21 +0000 (13:35 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 13 Mar 2009 13:35:21 +0000 (13:35 +0000)
inc/loader/class_ClassLoader.php

index aa592e1127b8744c9c66002e7a9ff6db85229eb3..775abf6b947e81693c57af3a872c648185480c8c 100644 (file)
@@ -25,6 +25,7 @@
  * 1.3
  *  - Constructor is now empty and factory method 'createClassLoader' is created
  *  - renamed loadClasses to scanClassPath
+ *  - Added initLoader(), $cfgInstance renamed to $configInstance
  * 1.2
  *  - ClassLoader rewritten to PHP SPL's own RecursiveIteratorIterator class
  * 1.1
@@ -113,12 +114,29 @@ class ClassLoader {
        /**
         * Our renamed factory method
         *
-        * @param       $cfgInstance    Configuration class instance
+        * @param       $configInstance Configuration class instance
         * @return      void
         */
-       public final static function createClassLoader (FrameworkConfiguration $cfgInstance) {
+       public final static function createClassLoader (FrameworkConfiguration $configInstance) {
+               // Get a new instance
+               $loaderInstance = new ClassLoader();
+
+               // Init the instance
+               $loaderInstance->initLoader($configInstance);
+
+               // Return the prepared instance
+               return $loaderInstance;
+       }
+
+       /**
+        * Initializes our loader class
+        *
+        * @param       $configInstance Configuration class instance
+        * @return      void
+        */
+       protected function initLoader (FrameworkConfiguration $configInstance) {
                // Set configuration instance
-               $this->cfgInstance = $cfgInstance;
+               $this->cfgInstance = $configInstance;
 
                // Construct the FQFN for the cache
                if (!defined('DEVELOPER')) {
@@ -127,8 +145,8 @@ class ClassLoader {
                } // END - if
 
                // Set suffix and prefix from configuration
-               $this->suffix = $cfgInstance->readConfig('class_suffix');
-               $this->prefix = $cfgInstance->readConfig('class_prefix');
+               $this->suffix = $configInstance->readConfig('class_suffix');
+               $this->prefix = $configInstance->readConfig('class_prefix');
 
                // Set own instance
                self::$selfInstance = $this;