* @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:----SEvDVSRB5te8plYWOWTNDY+m1ir3lDrkvlGeGALEW/RalKOhvN/9lsGmbfiuWc/33WZZ1wK21Wd0OnfxvVlcZOC9PyMOa7zBllg6bhGaC3wGgluP3LQHTKRzfN2j4M6JAdhnjFWJ2O9PAkP9pq+t2eu44LZpOv7VUqFAh9H6biwIAduafySTCv18skYees3E0MumRfP9Vk7nOOhwbGCYL4bpxAx5EXGF2duqmElP/m9XiraW7e9/wWcb/l8t9ltk/FdJwg4OXatf0whAPWCFsL++6TsVS/CrSmk6z3wyWEZzMae84RKiHTIlsujs5ABpcNKnXvFWqHMJh/YrgjIIdWaRDUSgEYmTZnSCfQ1Kd+AxbbOd4YEfaQIDFq4KuOxf5KFw4bSrF79ozuwe5JKFcr6xbMMzBftBgEY5a7TIyaq9TXetdrniKC0JK2ykjXl/c2/MOzbpo5wCdwmfkHd/rhDU/oTD43YyHjQ9mnXGmMZxdQy2eyoy5SnawwIKQLtYwdmtTk3U2KNHolwK59QsYzeCGv2Q+UC5pfG2qb6dDqWJVH+PUS+8CqOieN9Tl7/cDZGPGScdes20NTHJnNiaR6+6bSE+dX7kvyAtFu6UzLRJ8e74vxvmwSww+IgFro4do/wK+6L6oXA6NCU4v7E1t34lpJKr63LfSsz722aR1ds=----ATTACHMENT:----Njc0NTYyNDI3NjM4NDkxNyA3NTkwMjIxMDgwNTA2NTA0IDIyMjI2NTU4Njk2Nzg3NjQ=