You are here

public function ClassLoader::setPsr4 in N1ED - Visual editor as CKEditor plugin with Bootstrap support 7

Registers a set of PSR-4 directories for a given namespace, replacing any others previously set for this namespace.

Parameters

string $prefix The prefix/namespace, with trailing '\\':

array|string $paths The PSR-4 base directories:

Throws

\InvalidArgumentException

File

vendor/composer/ClassLoader.php, line 219

Class

ClassLoader
ClassLoader implements a PSR-0, PSR-4 and classmap class loader.

Namespace

Composer\Autoload

Code

public function setPsr4($prefix, $paths) {
  if (!$prefix) {
    $this->fallbackDirsPsr4 = (array) $paths;
  }
  else {
    $length = strlen($prefix);
    if ('\\' !== $prefix[$length - 1]) {
      throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
    }
    $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    $this->prefixDirsPsr4[$prefix] = (array) $paths;
  }
}