You are here

function _xautoload_finder in X Autoload 7

Same name and namespace in other branches
  1. 6 xautoload.module \_xautoload_finder()

Static registry for the finder object.

File

./xautoload.module, line 27

Code

function _xautoload_finder() {
  static $_finder;
  if (!isset($_finder)) {
    $modules = module_list();
    foreach ($modules as $module => $m) {
      $path = drupal_get_path('module', $module) . '/lib/';
      if (is_dir($path)) {
        $modules[$module] = $path;
      }
    }

    // Autoload is not ready yet, this is why we include this one explicitly.
    module_load_include('php', 'xautoload', 'lib/ClassFinder');
    $_finder = new xautoload_ClassFinder($modules);
  }
  return $_finder;
}