diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index f58b427b1..37b305640 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -68,19 +68,7 @@ return array( EOF; - // build package => install path map - $packageMap = array(); - - // add main package - $packageMap[] = array($mainPackage, ''); - - foreach ($localRepo->getPackages() as $installedPackage) { - $packageMap[] = array( - $installedPackage, - $installationManager->getInstallPath($installedPackage) - ); - } - + $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getPackages()); $autoloads = $this->parseAutoloads($packageMap); $appBaseDir = $filesystem->findShortestPathCode($vendorPath, getcwd(), true); @@ -128,6 +116,24 @@ EOF; copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php'); } + public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages) + { + // build package => install path map + $packageMap = array(); + + // add main package + $packageMap[] = array($mainPackage, ''); + + foreach ($packages as $package) { + $packageMap[] = array( + $package, + $installationManager->getInstallPath($package) + ); + } + + return $packageMap; + } + /** * Compiles an ordered list of namespace => path mappings *