You are here

function xautoload_ClassFinder_NamespaceOrPrefix::registerNamespaceRoot in X Autoload 7.3

Same name and namespace in other branches
  1. 7.2 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

xautoload_ClassFinder_NamespaceOrPrefix

Code

function registerNamespaceRoot($namespace, $path, $lazy_check = TRUE) {
  $namespace_path_fragment = $this
    ->namespacePathFragment($namespace);
  $deep_path = strlen($path) ? $path . DIRECTORY_SEPARATOR : '';
  $deep_path .= $namespace_path_fragment;
  $this->namespaceMap
    ->registerDeepPath($namespace_path_fragment, $deep_path, $lazy_check);
}