You are here

function xautoload_ClassLoader::loadClass in X Autoload 7.2

Callback for class loading. This will include ("require") the file found.

Parameters

string $class: The class to load.

File

lib/ClassLoader.php, line 50

Class

xautoload_ClassLoader
Behaves like the Symfony ClassLoader classes.

Code

function loadClass($class) {
  $api = new xautoload_InjectedAPI_findFile($class);

  // $api has a ->suggestFile($file) method, which returns TRUE if the
  // suggested file exists.
  // The $finder->findFile() method is supposed to suggest a number of files
  // to the $api, until one is successful, and then return TRUE. Or return
  // FALSE, if nothing was found.
  if ($this->finder
    ->findFile($api, $class)) {

    // In case of success, the file will be in the $api, to be retrieved with
    // $api->getFile().
    require $api
      ->getFile();
  }
}