Composer\Installers
BaseInstaller::getInstallPath() public WC 1.0
Return the install path based on package type.
{} Это метод класса: BaseInstaller{}
Хуков нет.
Возвращает
Строку.
Использование
$BaseInstaller = new BaseInstaller(); $BaseInstaller->getInstallPath( $package, $frameworkType );
- $package(Packageчислоerface) (обязательный)
- -
- $frameworkType(строка)
- -
Код BaseInstaller::getInstallPath() BaseInstaller::getInstallPath WC 5.0.0
public function getInstallPath(PackageInterface $package, $frameworkType = '')
{
$type = $this->package->getType();
$prettyName = $this->package->getPrettyName();
if (strpos($prettyName, '/') !== false) {
list($vendor, $name) = explode('/', $prettyName);
} else {
$vendor = '';
$name = $prettyName;
}
$availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type'));
$extra = $package->getExtra();
if (!empty($extra['installer-name'])) {
$availableVars['name'] = $extra['installer-name'];
}
if ($this->composer->getPackage()) {
$extra = $this->composer->getPackage()->getExtra();
if (!empty($extra['installer-paths'])) {
$customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type, $vendor);
if ($customPath !== false) {
return $this->templatePath($customPath, $availableVars);
}
}
}
$packageType = substr($type, strlen($frameworkType) + 1);
$locations = $this->getLocations();
if (!isset($locations[$packageType])) {
throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type));
}
return $this->templatePath($locations[$packageType], $availableVars);
}