public static function getPackageInstallPath(PackageInterface $package, Composer $composer)
{
$prettyName = $package->getPrettyName();
if (strpos($prettyName, '/') !== false) {
list($vendor, $name) = explode('/', $prettyName);
} else {
$vendor = '';
$name = $prettyName;
}
$availableVars = compact('name', 'vendor');
$extra = $package->getExtra();
if (!empty($extra['installer-name'])) {
$availableVars['name'] = $extra['installer-name'];
}
if ($composer->getPackage()) {
$extra = $composer->getPackage()->getExtra();
if (!empty($extra['installer-paths'])) {
$customPath = self::mapCustomInstallPaths($extra['installer-paths'], $prettyName);
if (false !== $customPath) {
return self::templatePath($customPath, $availableVars);
}
}
}
return NULL;
}