public static getPackageInstallPath ( Composer\Package\PackageInterface $package, Composer\Composer $composer ) | ||
$package | Composer\Package\PackageInterface | |
$composer | Composer\Composer |
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;
}
public function getInstallPath(PackageInterface $package) { $path = PackageUtils::getPackageInstallPath($package, $this->composer); if (!empty($path)) { return $path; } /* * In case, the user didn't provide a custom path * use the default one, by calling the parent::getInstallPath function */ return parent::getInstallPath($package); }