You are here

function ClassFinderAdapter::addPsr4 in X Autoload 7.4

Same name and namespace in other branches
  1. 7.5 src/Adapter/ClassFinderAdapter.php \Drupal\xautoload\Adapter\ClassFinderAdapter::addPsr4()

Parameters

string $prefix:

string[]|string $paths:

Overrides CommonRegistrationInterface::addPsr4

File

lib/Adapter/ClassFinderAdapter.php, line 218

Class

ClassFinderAdapter
An instance of this class is passed around to implementations of hook_xautoload(). It acts as a wrapper around the ClassFinder, to register stuff.

Namespace

Drupal\xautoload\Adapter

Code

function addPsr4($prefix, $paths) {

  // Namespaced PSR-4
  $logical_base_path = Util::namespaceLogicalPath($prefix);
  foreach ((array) $paths as $deep_path) {
    $deep_path = strlen($deep_path) ? rtrim($deep_path, '/') . '/' : '';
    $this->namespaceMap
      ->registerDeepPath($logical_base_path, $deep_path, $this->defaultBehavior);
  }
}