You are here

function LibrariesFinderPlugin::findFile in X Autoload 7.5

Find the file for a class that in PSR-0 or PEAR would be in $psr_0_root . '/' . $path_fragment . $path_suffix

Parameters

InjectedApiInterface $api:

string $logical_base_path:

string $relative_path:

Return value

bool|null TRUE, if the file was found. FALSE or NULL, otherwise.

Overrides xautoload_FinderPlugin_Interface::findFile

File

src/Libraries/LibrariesFinderPlugin.php, line 51

Class

LibrariesFinderPlugin
Registers autoload mappings from all libraries on hook_init(), or after the first cache miss.

Namespace

Drupal\xautoload\Libraries

Code

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());
}