function ClassFinder::registerNamespacesRoot in X Autoload 7.4
Same name and namespace in other branches
- 7.5 src/ClassFinder/ClassFinder.php \Drupal\xautoload\ClassFinder\ClassFinder::registerNamespacesRoot()
Register PSR-0 root folders for given namespaces.
Parameters
string[] $map: Associative array, the keys are the namespaces, the values are the directories.
\Drupal\xautoload\DirectoryBehavior\DirectoryBehaviorInterface $behavior: If TRUE, then we are not sure if the directory at $path actually exists. If during the process we find the directory to be nonexistent, we unregister the path.
Overrides ExtendedClassFinderInterface::registerNamespacesRoot
File
- lib/
ClassFinder/ ClassFinder.php, line 304
Class
Namespace
Drupal\xautoload\ClassFinderCode
function registerNamespacesRoot($map, $behavior = NULL) {
if (!isset($behavior)) {
$behavior = $this->defaultBehavior;
}
$deep_map = array();
foreach ($map as $namespace => $root_path) {
$logical_base_path = Util::namespaceLogicalPath($namespace);
$deep_path = strlen($root_path) ? rtrim($root_path, '/') . '/' . $logical_base_path : $logical_base_path;
$deep_map[$logical_base_path][$deep_path] = $behavior;
}
$this->namespaceMap
->registerDeepPaths($deep_map);
}