I created a class that I plan on using to autoload my project classes (20-30 classes) maximum. I wonder if there is anything, anything at all, that I can improve on this class to improve it any further.
Please let me know your thoughts below.
<?php
/**
* YodaCMS, content management system.
*
* @info This class autoloads project classes.
* @author Someone Someone <[email protected]>
* @version 0.0.1
* @package YodaCMS
*
*/
class autoLoader {
private static $loadedLibrarys;
public function __construct() {
$loadedLibrarys = array();
}
public static function loadLibrarys() {
newLibrary("testClass", new testClass());
}
private function newLibrary($lName, $lValue) {
if (!$this->tryLoadLibrary($lName, $lValue)) {
print_r('Error loading library: ' . $lName);
}
}
public function tryLoadLibrary($lName, $lValue) {
include(ROOT . '/applocation/base/classes/'.$lName.'.class.php');
$this->loadedLibrarys[$lName] = $lValue;
return true;
}
}