/**
 * Implements hook_xautoload()
 *
 * Register additional classes, namespaces, autoload patterns, that are not
 * already registered by default.
 *
 * @param \xautoload_InjectedAPI_hookXautoload $api
 *   An adapter object that can register stuff into the class loader.
 */
function hook_xautoload($api)
{
    // Register a namespace with PSR-0.
    $api->add('Acme\\GardenKit\\', 'shrubbery/lib');
    // Register a namespace with PSR-4.
    $api->absolute()->addPsr4('Acme\\ShrubGardens\\', '/home/karnouffle/php/shrub-gardens/src');
    // Scan sites/all/vendor/composer for Composer-generated autoload files, e.g.
    // 'sites/all/vendor/composer/autoload_namespaces.php', etc.
    $api->absolute()->composerDir('sites/all/vendor/composer');
}
 /**
  * {@inheritdoc}
  */
 function operateOnFinder($finder, $helper)
 {
     // Let other modules register stuff to the finder via hook_xautoload().
     $classmap_generator = new ClassMapGenerator();
     $adapter = new ClassFinderAdapter($finder, $classmap_generator);
     $api = new \xautoload_InjectedAPI_hookXautoload($adapter, '');
     foreach (module_implements('xautoload') as $module) {
         $api->setExtensionDir($dir = drupal_get_path('module', $module));
         $f = $module . '_xautoload';
         $f($api, $dir);
     }
 }
 /**
  * {@inheritdoc}
  */
 function operateOnFinder($finder, $helper)
 {
     // Let other modules register stuff to the finder via hook_xautoload().
     $classmap_generator = new ClassMapGenerator();
     $adapter = new ClassFinderAdapter($finder, $classmap_generator);
     $api = new \xautoload_InjectedAPI_hookXautoload($adapter, '');
     foreach ($this->extensions as $info) {
         // The simplest module dir is enough for this simulation.
         $api->setExtensionDir('test://modules/' . $info->name);
         $f = $info->name . '_xautoload';
         $f($api);
     }
 }
 /**
  * Registers all libraries that have an "xautoload" setting.
  */
 private function registerAllLibraries() {
   $adapter = \xautoload_InjectedAPI_hookXautoload::create($this->finder, '');
   foreach ($info = $this->getLibrariesXautoloadInfo() as $name => $pathAndCallback) {
     list($path, $callback) = $pathAndCallback;
     if (!is_callable($callback)) {
       continue;
     }
     if (!is_dir($path)) {
       continue;
     }
     $adapter->setExtensionDir($path);
     call_user_func($callback, $adapter, $path);
   }
 }
 /**
  * Runs hook_xautoload() on all enabled modules.
  *
  * This may occur multiple times in a request, if new modules are enabled.
  *
  * @param array $modules
  */
 private function runHookXautoload(array $modules)
 {
     // Let other modules register stuff to the finder via hook_xautoload().
     $adapter = \xautoload_InjectedAPI_hookXautoload::create($this->finder, '');
     foreach ($modules as $module) {
         $adapter->setExtensionDir($dir = $this->system->drupalGetPath('module', $module));
         $function = $module . '_xautoload';
         $function($adapter, $dir);
     }
 }
 /**
  * Executes the operation.
  *
  * This method will only be called if and when the "real" class finder is
  * initialized.
  *
  * @param ExtendedClassFinderInterface $finder
  *   The class finder.
  */
 function cacheMiss($finder)
 {
     $adapter = \xautoload_InjectedAPI_hookXautoload::create($finder, $this->path);
     call_user_func($this->callable, $adapter, $this->path);
 }