You are here

function VirtualFilesystem::addClass in X Autoload 7.4

Same name and namespace in other branches
  1. 7.5 tests/src/Filesystem/VirtualFilesystem.php \Drupal\xautoload\Tests\Filesystem\VirtualFilesystem::addClass()

Parameters

string $file:

string $class:

Throws

\Exception

File

tests/lib/Filesystem/VirtualFilesystem.php, line 69

Class

VirtualFilesystem

Namespace

Drupal\xautoload\Tests\Filesystem

Code

function addClass($file, $class) {
  $this
    ->addKnownFile($file);
  if (self::FILE !== ($existing = $this->knownPaths[$file])) {
    throw new \Exception("A class '{$existing}' already exists at '{$file}'. Cannot overwrite with class '{$class}'.");
  }
  $this->knownPaths[$file] = $class;
}