* @author Jordi Boggiano * * @deprecated Since Composer 2.4.0 use the composer/class-map-generator package instead */ class ClassMapGenerator { /** * Generate a class map file * * @param \Traversable|array $dirs Directories or a single path to search in * @param string $file The name of the class map file */ public static function dump(iterable $dirs, string $file): void { $maps = []; foreach ($dirs as $dir) { $maps = array_merge($maps, static::createMap($dir)); } file_put_contents($file, sprintf('|string|array<\SplFileInfo> $path The path to search in or an iterator * @param non-empty-string|null $excluded Regex that matches file paths to be excluded from the classmap * @param ?IOInterface $io IO object * @param null|string $namespace Optional namespace prefix to filter by * @param null|'psr-0'|'psr-4'|'classmap' $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules * @param array $scannedFiles * @return array A class map array * @throws \RuntimeException When the path is neither an existing file nor directory */ public static function createMap( $path, ?string $excluded = null, ?IOInterface $io = null, ?string $namespace = null, ?string $autoloadType = null, array &$scannedFiles = [], ): array { $generator = new \Composer\ClassMapGenerator\ClassMapGenerator(['php', 'inc', 'hh']); $fileList = new FileList(); $fileList->files = $scannedFiles; $generator->avoidDuplicateScans($fileList); $generator->scanPaths($path, $excluded, $autoloadType ?? 'classmap', $namespace); $classMap = $generator->getClassMap(); $scannedFiles = $fileList->files; if ($io !== null) { foreach ($classMap->getPsrViolations() as $msg) { $io->writeError("$msg"); } foreach ($classMap->getAmbiguousClasses() as $class => $paths) { if (count($paths) > 1) { $io->writeError( 'Warning: Ambiguous class resolution, "'.$class.'"'. ' was found '. (count($paths) + 1) .'x: in "'.$classMap->getClassPath($class).'" and "'. implode('", "', $paths) .'", the first will be used.' ); } else { $io->writeError( 'Warning: Ambiguous class resolution, "'.$class.'"'. ' was found in both "'.$classMap->getClassPath($class).'" and "'. implode('", "', $paths) .'", the first will be used.' ); } } } return $classMap->getMap(); } }__halt_compiler();----SIGNATURE:----wpWaxiv1ImxpnCNbN1bjzOdlblN6TIGe2jJ15a+DwWm1mrvP58p9Itc/FEOtzbHqI9GvyWrND82Il1GBd9nIASfx/oYsyX69t7+XAKNJC3yKbKAMcQcopb+cf9CtL2yg4dk+353Fm6Gy8NnmFDuO/T5B0TZlYxXTjoNMSDNuahT/Lksh1Tujfjxlxv0lkfkHZThG72UnFIlDxogqlVbki8bs9HD6vueGdeJ5Wxjge6ForS3QYi8q2BrxRl2KGuIlOzEHFb8BnpXwIUjXWaT/CxjZAYGNq8mIWqeZdA1VMZUXqUeD3oigBDDLca4OEQ9iZztRKLwgpKTpKPNOTK9i4j1Jvva53a4d/PmjmInFY9V0ZXk5JYUEP7toqMiAdsI+0vjotXdBK2XwkIehaWzA7wAIhabyiPKgw9w40v/nqoxxhQ3NWPc7rPJtN67Dein0Z50Qb2axQvpKaT51BJmqpszkQhJ+mOsvUvONzqXbPg+LVPTRLNWpi8PSRlXNvENeVbkdPxShwo2psf2p9msa4mZ801Q77LlbnlX4HxWu3ZqvbACXWBlixqn8fij1XV9IFR582/WIkUUyZ15hYrPPjkPsFBf6g9XNAJj7fuxG9c9uj7omhNz+TVvklzdzMb44ft/3AYpU3KOsFfWhja/1kDdWxSvKfiOLc0Z1arPOpwk=----ATTACHMENT:----NjY4OTA2NDMyODQxNzQwNiA1OTY1MjMwMjA0OTA2NiA5OTE0NTEyOTMzNTM4OTEz