X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Floader%2Fclass_ClassLoader.php;h=775abf6b947e81693c57af3a872c648185480c8c;hp=aa592e1127b8744c9c66002e7a9ff6db85229eb3;hb=2d739818a3217d1e685b2464a7faf08659b0c86f;hpb=b4b611a490a624ea38b44020fc63a1ac2f57fec3 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;