static function Util::prefixLogicalPath in X Autoload 7.5
Same name and namespace in other branches
- 7.4 lib/Util.php \Drupal\xautoload\Util::prefixLogicalPath()
Convert the underscores of a prefix into directory separators.
Parameters
string $prefix: Prefix, without trailing underscore.
Return value
string Path fragment representing the prefix, with trailing '/'.
12 calls to Util::prefixLogicalPath()
- ClassFinder::add in src/
ClassFinder/ ClassFinder.php - Adds a PSR-0 style prefix. Alias for ->addPsr0().
- ClassFinder::addPear in src/
ClassFinder/ ClassFinder.php - Adds a PEAR-like prefix.
- ClassFinder::addPearFlat in src/
ClassFinder/ ClassFinder.php - Adds a prefix similar to PEAR, but with flat directories.
- ClassFinder::registerPrefixDeepLocation in src/
ClassFinder/ ClassFinder.php - Register a filesystem location for a given class prefix.
- ClassFinder::registerPrefixesDeep in src/
ClassFinder/ ClassFinder.php - Register an array of PEAR-style deep paths for given class prefixes.
File
- src/
Util.php, line 119
Class
- Util
- A number of static methods that don't interact with any global state.
Namespace
Drupal\xautoloadCode
static function prefixLogicalPath($prefix) {
if (!strlen($prefix)) {
return '';
}
$pear_logical_path = str_replace('_', '/', rtrim($prefix, '_') . '_');
// Clean up surplus '/' resulting from duplicate underscores, or an
// underscore at the beginning of the class.
while (FALSE !== ($pos = strrpos('/' . $pear_logical_path, '//'))) {
$pear_logical_path[$pos] = '_';
}
return $pear_logical_path;
}