public function ClassLoader::add

Registers a set of classes, merging with any others previously set.

Parameters

string $prefix The classes prefix:

array|string $paths The location(s) of the classes:

bool $prepend Prepend the location(s):

File

drupal/core/vendor/composer/ClassLoader.php, line 84

Class

ClassLoader
ClassLoader implements a PSR-0 class loader

Namespace

Composer\Autoload

Code

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);
  }
}