]> git.mxchange.org Git - core.git/commitdiff
Introduced scanFrameworkClasses().
authorRoland Haeder <roland@mxchange.org>
Wed, 14 May 2014 19:38:59 +0000 (21:38 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 14 May 2014 19:38:59 +0000 (21:38 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes.php
inc/loader/class_ClassLoader.php

index b1455d1b91db3d65405b9ad3100294e40e327ee7..b80779e492244cc9aa0f3c686d841a1b0b800427 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-// Lower framework classes
-$lowerClasses = array(
-       'exceptions', // Exceptions
-       'interfaces', // Interfaces
-       'main',       // General main classes
-       'middleware'  // The middleware
-);
-
-// Cache loader instance
-$loaderInstance = ClassLoader::getSelfInstance();
-
-// Load all classes
-foreach ($lowerClasses as $className) {
-       // Try to load the framework classes
-       $loaderInstance->scanClassPath('inc/classes/' . $className . '/');
-} // END - foreach
-
-// Clean up the global namespace
-unset($lowerClasses[3]); // Applications shall not have any middleware
-unset($className);
+// Scan for all framework classes, exceptions and interfaces
+ClassLoader::scanFrameworkClasses();
 
 ////// Until here the framework classes are loaded //////
 
index 8b48d60acc16239d7dda8698955acec36c83ccab..dce3df9c9fa5832bf258906ccb83531146c5565f 100644 (file)
@@ -157,6 +157,30 @@ class ClassLoader {
                return $loaderInstance;
        }
 
+       /**
+        * Scans for all framework classes, exceptions and interfaces.
+        *
+        * @return      void
+        */
+       public static function scanFrameworkClasses () {
+               // Lower framework classes
+               $lowerClasses = array(
+                       'exceptions', // Exceptions
+                       'interfaces', // Interfaces
+                       'main',       // General main classes
+                       'middleware'  // The middleware
+               );
+
+               // Cache loader instance
+               $loaderInstance = self::getSelfInstance();
+
+               // Load all classes
+               foreach ($lowerClasses as $className) {
+                       // Try to load the framework classes
+                       $loaderInstance->scanClassPath('inc/classes/' . $className . '/');
+               } // END - foreach
+       }
+
        /**
         * Initializes our loader class
         *