/**
  * @param DrupalSystemInterface $system
  * @param ExtendedClassFinderInterface $finder
  */
 function __construct(DrupalSystemInterface $system, ExtendedClassFinderInterface $finder)
 {
     $this->system = $system;
     $this->finder = $finder;
     $this->namespaceMap = $finder->getNamespaceMap();
     $this->prefixMap = $finder->getPrefixMap();
     foreach (array('module', 'theme') as $extension_type) {
         $this->namespaceBehaviors[$extension_type] = new DrupalExtensionNamespaceFinderPlugin($extension_type, $this->namespaceMap, $this->prefixMap, $this->system);
         $this->prefixBehaviors[$extension_type] = new DrupalExtensionUnderscoreFinderPlugin($extension_type, $this->namespaceMap, $this->prefixMap, $this->system);
     }
     $this->defaultBehavior = new DefaultDirectoryBehavior();
 }
 /**
  * Find the file for a class that in PSR-0 or PEAR would be in
  * $psr_0_root . '/' . $path_fragment . $path_suffix
  *
  * @param InjectedApiInterface $api
  * @param string $logical_base_path
  * @param string $relative_path
  *
  * @return bool|null
  *   TRUE, if the file was found.
  *   FALSE or NULL, otherwise.
  */
 function findFile($api, $logical_base_path, $relative_path)
 {
     // Prevent recursion if this is called from libraries_info().
     // @todo Find a better way to do this?
     $backtrace = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace(FALSE);
     foreach ($backtrace as $call) {
         if ('libraries_info' === $call['function']) {
             return FALSE;
         }
     }
     $this->finder->getNamespaceMap()->unregisterDeepPath('', '');
     $this->finder->getPrefixMap()->unregisterDeepPath('', '');
     $this->registerAllLibraries();
     return $this->finder->apiFindFile($api, $api->getClass());
 }
 /**
  * Legacy: Plugins were called "Handler" before.
  *
  * @deprecated
  *
  * @param string $namespace
  * @param xautoload_FinderPlugin_Interface $plugin
  *
  * @return string
  *   The key under which the plugin was registered. This can later be used to
  *   unregister the plugin again.
  */
 function namespaceHandler($namespace, $plugin)
 {
     $key = Util::randomString();
     $this->finder->registerNamespaceDeep($namespace, $key, $plugin);
     return $key;
 }
 /**
  * {@inheritdoc}
  */
 function addClassMap(array $classMap)
 {
     $this->finder->registerClasses($classMap);
 }
 /**
  * {@inheritdoc}
  */
 function apiFindFile($api, $class)
 {
     $this->initFinder();
     return $this->finder->apiFindFile($api, $class);
 }