class xautoload_ClassFinder in X Autoload 7
Same name and namespace in other branches
- 6 xautoload.module \xautoload_ClassFinder
This is the only class that needs to be included explicitly using module_load_include().
The thing is called ClassFinder, but it also works for interfaces.
Hierarchy
- class \xautoload_ClassFinder
Expanded class hierarchy of xautoload_ClassFinder
File
- lib/
ClassFinder.php, line 10
View source
class xautoload_ClassFinder {
protected $modules = array();
function __construct($modules) {
$this->modules = $modules;
}
/**
* Find the file that contains a class or interface definition.
*
* @param $class :string
* Name of a class or interface to load.
* @return :string
* The file that defines the class or interface, or NULL if not found.
*/
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;
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
xautoload_ClassFinder:: |
protected | property | ||
xautoload_ClassFinder:: |
function | Find the file that contains a class or interface definition. | ||
xautoload_ClassFinder:: |
function |