Extract some code in a AutoloadGenerator::buildPackageMap method
parent
8c535b1961
commit
5daaba9e62
|
@ -68,19 +68,7 @@ return array(
|
||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
// build package => install path map
|
$packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getPackages());
|
||||||
$packageMap = array();
|
|
||||||
|
|
||||||
// add main package
|
|
||||||
$packageMap[] = array($mainPackage, '');
|
|
||||||
|
|
||||||
foreach ($localRepo->getPackages() as $installedPackage) {
|
|
||||||
$packageMap[] = array(
|
|
||||||
$installedPackage,
|
|
||||||
$installationManager->getInstallPath($installedPackage)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$autoloads = $this->parseAutoloads($packageMap);
|
$autoloads = $this->parseAutoloads($packageMap);
|
||||||
|
|
||||||
$appBaseDir = $filesystem->findShortestPathCode($vendorPath, getcwd(), true);
|
$appBaseDir = $filesystem->findShortestPathCode($vendorPath, getcwd(), true);
|
||||||
|
@ -128,6 +116,24 @@ EOF;
|
||||||
copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
|
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
|
* Compiles an ordered list of namespace => path mappings
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue