function xautoload_ClassFinder::findFile in X Autoload 7
Same name and namespace in other branches
- 6 xautoload.module \xautoload_ClassFinder::findFile()
Find the file that contains a class or interface definition.
Parameters
$class :string: Name of a class or interface to load.
Return value
:string The file that defines the class or interface, or NULL if not found.
File
- lib/
ClassFinder.php, line 26
Class
- xautoload_ClassFinder
- This is the only class that needs to be included explicitly using module_load_include().
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 . '.php';
if (file_exists($path)) {
return $path;
}
}
}
}