From: Roland Häder Date: Fri, 13 Mar 2009 13:35:21 +0000 (+0000) Subject: initLoader() should do that X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=2d739818a3217d1e685b2464a7faf08659b0c86f initLoader() should do that --- diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index aa592e11..775abf6b 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -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;