Registers a set of classes, merging with any others previously set.
string $prefix The classes prefix:
array|string $paths The location(s) of the classes:
bool $prepend Prepend the location(s):
public function add($prefix, $paths, $prepend = false) {
if (!$prefix) {
if ($prepend) {
$this->fallbackDirs = array_merge((array) $paths, $this->fallbackDirs);
}
else {
$this->fallbackDirs = array_merge($this->fallbackDirs, (array) $paths);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixes[$first][$prefix])) {
$this->prefixes[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixes[$first][$prefix] = array_merge((array) $paths, $this->prefixes[$first][$prefix]);
}
else {
$this->prefixes[$first][$prefix] = array_merge($this->prefixes[$first][$prefix], (array) $paths);
}
}