Some cleanups, more usage of ObjectFactory:
[core.git] / inc / loader / class_ClassLoader.php
index 79768fff9b3f196bc9df9b5ac8136a2611e3e25e..3645bf171cc850569d641b0eb04e938e68c4c57f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -38,7 +38,7 @@ class ClassLoader {
        /**
         * Instance of this class
         */
-       private static $selfInstance = null;
+       private static $selfInstance = NULL;
 
        /**
         * Array with all classes
@@ -112,7 +112,7 @@ class ClassLoader {
         * @param       $configInstance Configuration class instance
         * @return      void
         */
-       public final static function createClassLoader (FrameworkConfiguration $configInstance) {
+       public static final function createClassLoader (FrameworkConfiguration $configInstance) {
                // Get a new instance
                $loaderInstance = new ClassLoader();
 
@@ -187,7 +187,7 @@ class ClassLoader {
         *
         * @return      $selfInstance           An instance of this class
         */
-       public final static function getInstance () {
+       public static final function getInstance () {
                // Is the instance there?
                if (is_null(self::$selfInstance)) {
                        // Get a new one
@@ -205,7 +205,9 @@ class ClassLoader {
         */
        public function __destruct () {
                // Skip here if dev-mode
-               if (defined('DEVELOPER')) return;
+               if (defined('DEVELOPER')) {
+                       return;
+               } // END - if
 
                // Skip here if already cached
                if ($this->listCached === false) {
@@ -240,7 +242,7 @@ class ClassLoader {
                if ($this->listCached === true) {
                        // Abort here
                        return;
-               }
+               } // END - if
 
                // Directories which our class loader ignores by default while
                // deep-scanning the directory structure.
@@ -274,12 +276,14 @@ class ClassLoader {
                        // Get filename from iterator
                        $fileName = $entry->getFileName();
 
+                       // Get the FQFN and add it to our class list
+                       $fqfn = $entry->getRealPath();
+
                        // Is this file wanted?
                        //* DEBUG: */ echo "FOUND:{$fileName}<br />\n";
-                       if ((!in_array($fileName, $this->ignoreList)) && (substr($fileName, 0, strlen($this->prefix)) == $this->prefix) && (substr($fileName, -strlen($this->suffix), strlen($this->suffix)) == $this->suffix)) {
-                               // Get the FQFN and add it to our class list
-                               $fqfn = $entry->getRealPath();
+                       if ((!in_array($fileName, $this->ignoreList)) && (filesize($fqfn) > 100) && (substr($fileName, 0, strlen($this->prefix)) == $this->prefix) && (substr($fileName, -strlen($this->suffix), strlen($this->suffix)) == $this->suffix)) {
                                //* DEBUG: */ echo "ADD: {$fileName}<br />\n";
+                               // Add it to the list
                                $this->classes[$fileName] = $fqfn;
                        } // END - if
                } // END - foreach