]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/loader/class_ClassLoader.php
ToDo tags now all lower-case
[shipsimu.git] / inc / loader / class_ClassLoader.php
index 348a8e039672328820b9a12c785c7890a3890fbd..2d36b78a337014782b06d50b8988f34fb24da2a7 100644 (file)
@@ -6,7 +6,7 @@
  * @version            0.0.0
  * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.ship-simu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -102,6 +102,11 @@ class ClassLoader {
         */
        private $classCacheFQFN = "";
 
+       /**
+        * Counter for loaded include files
+        */
+       private $total = 0;
+
        /**
         * The *public* constructor
         *
@@ -235,7 +240,7 @@ class ClassLoader {
 
                // If the basePath is false it is invalid
                if ($basePath2 === false) {
-                       // TODO: Do not die here.
+                       /* @todo: Do not die here. */
                        die("Cannot read {$basePath} !");
                } else {
                        // Set base path
@@ -306,11 +311,14 @@ class ClassLoader {
                        // File is found so load it only once
                        require($this->classes[$fileName]);
 
+                       // Count this include
+                       $this->total++;
+
+                       // Mark this class as loaded
+                       $this->loadedClasses[] = $this->classes[$fileName];
+
                        // Developer mode excludes caching (better debugging)
                        if (!defined('DEVELOPER')) {
-                               // Mark this class as loaded
-                               $this->loadedClasses[] = $this->classes[$fileName];
-
                                // Reset cache
                                $this->classesCached = false;
                        } // END - if
@@ -335,6 +343,31 @@ class ClassLoader {
                        } // END - if
                } // END - foreach
        }
+
+       /**
+        * Getter for total include counter
+        *
+        * @return      $total  Total loaded include files
+        */
+       public final function getTotal () {
+               return $this->total;
+       }
+
+       /**
+        * Getter for a printable list of included classes/interfaces/exceptions
+        *
+        * @param       $includeList    A printable include list
+        */
+       public function getPrintableIncludeList () {
+               // Prepare the list
+               $includeList = "";
+               foreach ($this->loadedClasses as $classFile) {
+                       $includeList .= basename($classFile)."<br />\n";
+               } // END - foreach
+
+               // And return it
+               return $includeList;
+       }
 }
 
 // [EOF]