You are here

function ClassFinderAdapter::addMultiplePsr4 in X Autoload 7.4

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

Add multiple PSR-4 namespaces

Parameters

array $map:

Overrides ClassFinderAdapterInterface::addMultiplePsr4

File

lib/Adapter/ClassFinderAdapter.php, line 152

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 addMultiplePsr4(array $map) {
  $namespace_map = array();
  foreach ($map as $namespace => $paths) {
    $logical_base_path = Util::namespaceLogicalPath($namespace);
    foreach ($paths as $root_path) {
      $deep_path = strlen($root_path) ? rtrim($root_path, '/') . '/' : '';
      $namespace_map[$logical_base_path][$deep_path] = $this->defaultBehavior;
    }
  }
  $this->namespaceMap
    ->registerDeepPaths($namespace_map);
}