You are here

function xautoload_ClassFinder::findFile in X Autoload 6

Same name and namespace in other branches
  1. 7 lib/ClassFinder.php \xautoload_ClassFinder::findFile()

File

./xautoload.module, line 53

Class

xautoload_ClassFinder
We don't put this in the lib folder, obviously, because it has to be available before xautoload is initialized.

Code

function findFile($class) {
  if (preg_match('/^([a-z0-9_]+)_([A-Z].*)$/', $class, $m)) {
    list(, $module, $name) = $m;
    if (isset($this->modules[$module])) {
      $path = strtr($name, '_', '/');
      $path = $this->modules[$module] . $path . '.inc';
      if (file_exists($path)) {
        return $path;
      }
    }
  }
}