function xautoload_ClassFinder_NamespaceOrPrefix::registerNamespaceRoot in X Autoload 7.2
Same name and namespace in other branches
- 7.3 lib/ClassFinder/NamespaceOrPrefix.php \xautoload_ClassFinder_NamespaceOrPrefix::registerNamespaceRoot()
Register a PSR-0 root folder for a given namespace.
Parameters
string $namespace: The namespace, e.g. "My\Namespace", to cover all classes within that, e.g. My\Namespace\SomeClass, or My\Namespace\Xyz\SomeClass. This does not cover the root-level class, e.g. My\Namespace
string $path: The deep path, e.g. "../lib", if classes reside in e.g. My\Namespace\SomeClass -> ../lib/My/Namespace/SomeClass.php
boolean $lazy_check: If TRUE, then we are not sure if the directory at $path actually exists. If during the process we find the directory to be nonexistent, we unregister the path.
File
- lib/
ClassFinder/ NamespaceOrPrefix.php, line 28
Class
Code
function registerNamespaceRoot($namespace, $root_path, $lazy_check = TRUE) {
$subdir = str_replace('\\', DIRECTORY_SEPARATOR, $namespace);
$deep_path = !strlen($root_path) ? $subdir : !strlen($subdir) ? $root_path : $root_path . DIRECTORY_SEPARATOR . $subdir;
$this
->registerNamespaceDeepLocation($namespace, $deep_path, $lazy_check);
}