function ClassFinderAdapter::addPsr4 in X Autoload 7.5
Same name and namespace in other branches
- 7.4 lib/Adapter/ClassFinderAdapter.php \Drupal\xautoload\Adapter\ClassFinderAdapter::addPsr4()
Adds a PSR-4 style namespace.
Parameters
string $prefix:
string[]|string $paths:
Overrides CommonRegistrationInterface::addPsr4
File
- src/
Adapter/ ClassFinderAdapter.php, line 224
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 addPsr4($prefix, $paths) {
// Namespaced PSR-4
$logical_base_path = Util::namespaceLogicalPath($prefix);
foreach ((array) $paths as $deep_path) {
$deep_path = strlen($deep_path) ? rtrim($deep_path, '/') . '/' : '';
$this->namespaceMap
->registerDeepPath($logical_base_path, $deep_path, $this->defaultBehavior);
}
}