function ClassFinderAdapter::add in X Autoload 7.4
Same name and namespace in other branches
- 7.5 src/Adapter/ClassFinderAdapter.php \Drupal\xautoload\Adapter\ClassFinderAdapter::add()
Add PSR-0 style prefixes. Alias for ->addPsr0().
Parameters
string $prefix:
string[]|string $paths:
Overrides CommonRegistrationInterface::add
1 call to ClassFinderAdapter::add()
- ClassFinderAdapter::addPsr0 in lib/
Adapter/ ClassFinderAdapter.php - Add PSR-0 style prefixes. Alias for ->add().
File
- lib/
Adapter/ ClassFinderAdapter.php, line 177
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 add($prefix, $paths) {
if (FALSE === strpos($prefix, '\\')) {
// Due to the ambiguity of PSR-0, this could be either PEAR-like or namespaced.
$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;
$this->prefixMap
->registerDeepPath($logical_base_path, $deep_path, $this->defaultBehavior);
}
}
// Namespaced PSR-0
$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;
$this->namespaceMap
->registerDeepPath($logical_base_path, $deep_path, $this->psr0Behavior);
}
}