/** * 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()); }
/** * @param ExtendedClassFinderInterface $finder * The class finder object. * @param ClassMapGeneratorInterface $classmap_generator */ function __construct($finder, $classmap_generator) { $this->finder = $finder; $this->prefixMap = $finder->getPrefixMap(); $this->namespaceMap = $finder->getNamespaceMap(); $this->defaultBehavior = new DefaultDirectoryBehavior(); $this->psr0Behavior = new Psr0DirectoryBehavior(); $this->classMapGenerator = $classmap_generator; }
/** * @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(); }