protected function ComposerJsonTargetDir::addMultipleWithTargetDir in X Autoload 7.5
Same name and namespace in other branches
- 7.4 lib/Discovery/ComposerJsonTargetDir.php \Drupal\xautoload\Discovery\ComposerJsonTargetDir::addMultipleWithTargetDir()
Parameters
ClassFinderAdapter $adapter:
array $prefixes:
1 call to ComposerJsonTargetDir::addMultipleWithTargetDir()
- ComposerJsonTargetDir::writeToAdapter in src/
Discovery/ ComposerJsonTargetDir.php
File
- src/
Discovery/ ComposerJsonTargetDir.php, line 81
Class
Namespace
Drupal\xautoload\DiscoveryCode
protected function addMultipleWithTargetDir(ClassFinderAdapter $adapter, array $prefixes) {
$default_behavior = new DefaultDirectoryBehavior();
$psr0_behavior = new Psr0DirectoryBehavior();
$namespace_map = array();
$prefix_map = array();
$target_dir_strlen = strlen($this->targetDir);
foreach ($prefixes as $prefix => $paths) {
if (FALSE === strpos($prefix, '\\')) {
$logical_base_path = Util::prefixLogicalPath($prefix);
foreach ((array) $paths as $root_path) {
$deep_path = strlen($root_path) ? rtrim($root_path, '/') . '/' . $logical_base_path : $logical_base_path;
if (0 !== strpos($deep_path, $this->targetDir)) {
continue;
}
$deep_path = $this->pathPrefix . substr($deep_path, $target_dir_strlen);
$prefix_map[$logical_base_path][$deep_path] = $default_behavior;
}
}
$logical_base_path = Util::namespaceLogicalPath($prefix);
foreach ((array) $paths as $root_path) {
$deep_path = strlen($root_path) ? rtrim($root_path, '/') . '/' . $logical_base_path : $logical_base_path;
if (0 !== strpos($deep_path, $this->targetDir)) {
continue;
}
$deep_path = $this->pathPrefix . substr($deep_path, $target_dir_strlen);
$namespace_map[$logical_base_path][$deep_path] = $psr0_behavior;
}
}
if (!empty($prefix_map)) {
$adapter
->getPrefixMap()
->registerDeepPaths($prefix_map);
}
$adapter
->getNamespaceMap()
->registerDeepPaths($namespace_map);
}