/** * @param ClassFinderAdapter $adapter */ function writeToAdapter($adapter) { // PSR-0 namespaces / prefixes if (is_file($this->dir . '/autoload_namespaces.php')) { $prefixes = (require $this->dir . '/autoload_namespaces.php'); if (!empty($prefixes)) { $adapter->addMultiplePsr0($prefixes); } } // PSR-4 namespaces if (is_file($this->dir . '/autoload_psr4.php')) { $map = (require $this->dir . '/autoload_psr4.php'); if (!empty($map)) { $adapter->addMultiplePsr4($map); } } // Class map if (is_file($this->dir . '/autoload_classmap.php')) { $class_map = (require $this->dir . '/autoload_classmap.php'); if (!empty($class_map)) { $adapter->addClassMap($class_map); } } // Include path if (is_file($this->dir . '/include_paths.php')) { $include_paths = (require $this->dir . '/include_paths.php'); if (!empty($include_paths)) { array_push($include_paths, get_include_path()); set_include_path(join(PATH_SEPARATOR, $include_paths)); } } // Include files if (is_file($this->dir . '/autoload_files.php')) { $include_files = (require $this->dir . '/autoload_files.php'); foreach ($include_files as $file) { require $file; } } }
/** * Adds a prefix similar to PEAR, but with flat directories. * * This will assume with no further checks that $prefix contains no namespace * separator. * * @param string $prefix * The prefix, e.g. 'Acme_FooPackage_' * @param string|string[] $paths * An array of paths, or one specific path. * E.g. 'lib' for $relative = TRUE, * or 'sites/all/libraries/AcmeFooPackage/lib' for $relative = FALSE. * @param bool $relative * If TRUE, the paths will be relative to $this->localDirectory. */ function addPearFlat($prefix, $paths, $relative = TRUE) { $relative && $this->prependToPaths($paths); $this->master->addPearFlat($prefix, $paths); }
/** * @param ExtendedClassFinderInterface $finder * The class finder object. * @param string $localDirectory * * @return self */ static function create($finder, $localDirectory) { $adapter = ClassFinderAdapter::create($finder); return new self($adapter, $localDirectory); }
/** * @param ClassFinderAdapter $adapter * @param string[] $sources_raw * Array of files and folders to scan for class implementations. */ protected function addClassmapSources($adapter, array $sources_raw) { foreach ($sources_raw as &$path) { $path = $this->pathPrefix . $path; } $adapter->addClassmapSources($sources_raw); }