function AutoloadGenerator::parseAutoloads
Compiles an ordered list of namespace => path mappings
@phpstan-return array{ 'psr-0': array<string, array<string>>, 'psr-4': array<string, array<string>>, 'classmap': array<int, string>, 'files': array<string, string>, 'exclude-from-classmap': array<int, string>, }
Parameters
non-empty-array<int, array{0: PackageInterface, 1: string|null}> $packageMap array of array(package, installDir-relative-to-composer.json or null for metapackages):
RootPackageInterface $rootPackage root package instance:
bool|string[] $filteredDevPackages If an array, the list of packages that must be removed. If bool, whether to filter out require-dev packages:
Return value
array
1 call to AutoloadGenerator::parseAutoloads()
- AutoloadGenerator::dump in vendor/
composer/ composer/ src/ Composer/ Autoload/ AutoloadGenerator.php
File
-
vendor/
composer/ composer/ src/ Composer/ Autoload/ AutoloadGenerator.php, line 569
Class
- AutoloadGenerator
- @author Igor Wiedler <igor@wiedler.ch> @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\AutoloadCode
public function parseAutoloads(array $packageMap, PackageInterface $rootPackage, $filteredDevPackages = false) {
$rootPackageMap = array_shift($packageMap);
if (is_array($filteredDevPackages)) {
$packageMap = array_filter($packageMap, static function ($item) use ($filteredDevPackages) : bool {
return !in_array($item[0]->getName(), $filteredDevPackages, true);
});
}
elseif ($filteredDevPackages) {
$packageMap = $this->filterPackageMap($packageMap, $rootPackage);
}
$sortedPackageMap = $this->sortPackageMap($packageMap);
$sortedPackageMap[] = $rootPackageMap;
array_unshift($packageMap, $rootPackageMap);
$psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $rootPackage);
$psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $rootPackage);
$classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $rootPackage);
$files = $this->parseAutoloadsType($sortedPackageMap, 'files', $rootPackage);
$exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $rootPackage);
krsort($psr0);
krsort($psr4);
return [
'psr-0' => $psr0,
'psr-4' => $psr4,
'classmap' => $classmap,
'files' => $files,
'exclude-from-classmap' => $exclude,
];
}