20 private $baseDir =
'';
28 if (!file_exists($baseDir) || is_file($baseDir)) {
29 throw new \Exception(
"Base dir '".$baseDir.
"' is not a directory.");
31 $baseDir = preg_replace(
'/\/\/$/',
'/', $baseDir.
'/');
32 $this->baseDir = $baseDir;
33 spl_autoload_register([$this,
'load'],
true,
true);
40 public function load($className) {
42 $filename = $this->baseDir.str_replace(
"\\",
"/", $className).
'.php';
43 if (file_exists($filename)) {
ClassLoader tries to load missing class definitions.
load($className)
Load the given class definition.
__construct($baseDir)
Constructor.