* @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:----JjNwY5vQRuOq/2zoYN7E2xfAdzLqbQE1MEME6JUbatnDtFqP2HpOcnbFfPoCNi6Hr8eqpU1inXxOKekSvKZ1EdIPLegNMGMNDb2l+VuEhbz53t8yooKFcFehvIbJM1cavVFlSNs2VDm7RUvqfyINzZX69yq784Mig/X00gcHzIHv8+cNXWlL+XH7NE9cfo3s/nZOfoeYR+MHhG0RkyonTbh1wLMzJoXIdD5OrNwt5Ejyx/f813QiohR0hHnYmY1Nn9WSc9rIVYXs0rbIMNsKQd8ggJp9TtR/JvB85+qhxhiNmkTd9mV7h+3FZznfTVlZ8VmndQrpXoM/5VmCbyr5N3fS8nEh1Vm/OwIXGlCUsArryuvqryFe62pGbNLKQFlXL4fAbfUjiFCg9Km8uBAWefBHk0V/6xTmNoUtCJU/EktTxtzAGktwfeloDUCj5PAZZ7oVPavjBdF12SPa3x5SYi7WTMockNMAALOX7NNEM4bK8EokFMbYnufx1xKasual8+Ys2Y8z4bEct4TzIEb/9Akn7P2k8G22Y7ncMRqCusiX9SprRIEFbUBFe+MjjE4L/tsjHBfTMsfa7XnhXBam/0JnCyaWg+2419RLyN+CX0/SHFf+XUE7z+hiFzJEPEH71V2hpXuGmknYDSv6NmnGFw8OJJ120POk9HyZGsQrN28=----ATTACHMENT:----NTA5NTAxNzk0ODM2NDEwNiA0NTAyODkzMjY1OTU5Mjk3IDMzNDA0MjA1OTIwMzkwMTk=