You are here

public function ClassLoader::addPrefix in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/class-loader/ClassLoader.php \Symfony\Component\ClassLoader\ClassLoader::addPrefix()

Registers a set of classes.

Parameters

string $prefix The classes prefix:

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

1 call to ClassLoader::addPrefix()
ClassLoader::addPrefixes in vendor/symfony/class-loader/ClassLoader.php
Adds prefixes.

File

vendor/symfony/class-loader/ClassLoader.php, line 84

Class

ClassLoader
ClassLoader implements an PSR-0 class loader.

Namespace

Symfony\Component\ClassLoader

Code

public function addPrefix($prefix, $paths) {
  if (!$prefix) {
    foreach ((array) $paths as $path) {
      $this->fallbackDirs[] = $path;
    }
    return;
  }
  if (isset($this->prefixes[$prefix])) {
    if (is_array($paths)) {
      $this->prefixes[$prefix] = array_unique(array_merge($this->prefixes[$prefix], $paths));
    }
    elseif (!in_array($paths, $this->prefixes[$prefix])) {
      $this->prefixes[$prefix][] = $paths;
    }
  }
  else {
    $this->prefixes[$prefix] = array_unique((array) $paths);
  }
}