]> git.mxchange.org Git - core.git/blobdiff - framework/loader/class_ClassLoader.php
Continued:
[core.git] / framework / loader / class_ClassLoader.php
index 247975faf5640c335da12165346b658cfde27677..8ce8488a5f2b12ef4c88b28fc571e924b61ad5b1 100644 (file)
@@ -66,6 +66,11 @@ final class ClassLoader {
         */
        private static $selfInstance = NULL;
 
+       /**
+        * Cached configuration entry 'developer_mode_enabled'
+        */
+       private static $developerModeEnabled = false;
+
        /**
         * Array with all valid but pending for loading file names (class,
         * interfaces, traits must start with below prefix).
@@ -152,7 +157,8 @@ final class ClassLoader {
         * @return      void
         */
        private function __construct () {
-               // This is empty for now
+               // Cache config entry
+               self::$developerModeEnabled = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled');
        }
 
        /**
@@ -162,7 +168,7 @@ final class ClassLoader {
         */
        public function __destruct () {
                // Skip here if dev-mode
-               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
+               if (self::$developerModeEnabled) {
                        return;
                }
 
@@ -504,7 +510,7 @@ final class ClassLoader {
         */
        private function initClassLoader () {
                // Construct the FQFN for the cache
-               if (!FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
+               if (!self::$developerModeEnabled) {
                        // Init cache instances
                        $this->listCacheFile  = new SplFileInfo(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('local_database_path') . 'list-' . FrameworkBootstrap::getDetectedApplicationName() . '.cache');
                        $this->classCacheFile = new SplFileInfo(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('local_database_path') . 'class-' . FrameworkBootstrap::getDetectedApplicationName() . '.cache');
@@ -518,7 +524,7 @@ final class ClassLoader {
                self::$selfInstance = $this;
 
                // Skip here if no dev-mode
-               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
+               if (self::$developerModeEnabled) {
                        return;
                }
 
@@ -580,7 +586,7 @@ final class ClassLoader {
                        unset($this->pendingFiles[$fileName]);
 
                        // Developer mode excludes caching (better debugging)
-                       if (!FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('developer_mode_enabled')) {
+                       if (!self::$developerModeEnabled) {
                                // Reset cache
                                //* NOISY-DEBUG: */ printf('[%s:%d] classesCached=false' . PHP_EOL, __METHOD__, __LINE__);
                                $this->classesCached = false;