X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Floader%2Fclass_ClassLoader.php;h=2d36b78a337014782b06d50b8988f34fb24da2a7;hb=1e2209b0314919177e08f7ec626e9eb2e1f90d70;hp=4eb1223473c92d6cef605a4bbe942d92d6e43693;hpb=55b327a3f5f2fe1d244532e07be7444e94b2a768;p=shipsimu.git diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index 4eb1223..2d36b78 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -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)."
\n"; + } // END - foreach + + // And return it + return $includeList; + } } // [EOF]