function ClassFinderAdapter::addMultiplePsr0 in X Autoload 7.5
Same name and namespace in other branches
- 7.4 lib/Adapter/ClassFinderAdapter.php \Drupal\xautoload\Adapter\ClassFinderAdapter::addMultiplePsr0()
Add multiple PSR-0 namespaces
Parameters
array $prefixes:
Overrides ClassFinderAdapterInterface::addMultiplePsr0
File
- src/
Adapter/ ClassFinderAdapter.php, line 130
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\AdapterCode
function addMultiplePsr0(array $prefixes) {
$namespace_map = array();
$prefix_map = array();
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;
$prefix_map[$logical_base_path][$deep_path] = $this->defaultBehavior;
}
}
$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;
$namespace_map[$logical_base_path][$deep_path] = $this->psr0Behavior;
}
}
if (!empty($prefix_map)) {
$this->prefixMap
->registerDeepPaths($prefix_map);
}
$this->namespaceMap
->registerDeepPaths($namespace_map);
}