本文整理汇总了PHP中Composer\Installer\LibraryInstaller::getInstallPath方法的典型用法代码示例。如果您正苦于以下问题:PHP LibraryInstaller::getInstallPath方法的具体用法?PHP LibraryInstaller::getInstallPath怎么用?PHP LibraryInstaller::getInstallPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\Installer\LibraryInstaller
的用法示例。
在下文中一共展示了LibraryInstaller::getInstallPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstallPath
/**
* Returns the installation path of a package
*
* @param PackageInterface $package
*
* @return string
*/
public function getInstallPath(PackageInterface $package)
{
if ($package->isDev()) {
return $this->symlinkInstaller->getInstallPath($package);
}
return $this->defaultInstaller->getInstallPath($package);
}
示例2: getInstallPath
/**
* Returns the installation path of a package
*
* @param PackageInterface $package
*
* @return string
*/
public function getInstallPath(PackageInterface $package)
{
if ($this->solver->isSharedPackage($package)) {
return $this->symlinkInstaller->getInstallPath($package);
}
return $this->defaultInstaller->getInstallPath($package);
}
示例3: getInstallPath
/**
* {@inheritDoc}
*/
public function getInstallPath(PackageInterface $package)
{
$type = $package->getType();
$prettyName = $package->getPrettyName();
if (strpos($prettyName, '/') !== false) {
list($vendor, $name) = explode('/', $prettyName);
} else {
$vendor = '';
$name = $prettyName;
}
$availableVars = compact('name', 'vendor', 'type');
$extra = $package->getExtra();
if (!empty($extra['installer-name'])) {
$availableVars['name'] = $extra['installer-name'];
}
if ($this->composer->getPackage()) {
$pkg_extra = $this->composer->getPackage()->getExtra();
if (!empty($pkg_extra['installer-paths'])) {
$customPath = $this->mapCustomInstallPaths($pkg_extra['installer-paths'], $prettyName, $type);
if ($customPath !== false) {
return $this->templatePath($customPath, $availableVars);
}
}
}
if (empty($extra['installer-path'])) {
return parent::getInstallPath($package);
}
return $this->templatePath($extra['installer-path'], $availableVars);
}
示例4: getInstallPath
public function getInstallPath(PackageInterface $package)
{
$packageName = $package->getPrettyName();
$packageExtra = $this->composer->getPackage()->getExtra();
if (false === array_key_exists('wordpress-install-dir', $packageExtra)) {
return parent::getInstallPath($package);
}
$installDirs = $packageExtra['wordpress-install-dir'];
if (false === is_array($installDirs)) {
throw new InvalidPackageException(['Installation directory must be a key value array of packages and install directories.'], [], [$installDirs]);
}
if (false === array_key_exists($packageName, $installDirs)) {
throw new InvalidPackageException(['Installation directory must be a key value array of packages and install directories.'], [], [$installDirs]);
}
$packageInstallDir = $installDirs[$packageName];
$installDirCount = 0;
foreach ($installDirs as $installDir) {
if ($installDir === $packageInstallDir) {
$installDirCount++;
}
}
if ($installDirCount > 1) {
throw new InvalidPackageException(['Two packages cannot have the same install directory'], [], $installDirs);
}
return $installDirs[$packageName];
}
示例5: getInstallPath
public function getInstallPath(PackageInterface $package)
{
$installer = new InstallerHelper($package, $this->composer, $this->io);
$path = $installer->getInstallPath($package, $package->getType());
// if the path is false, use the default installer path instead
return $path !== false ? $path : LibraryInstaller::getInstallPath($package);
}
示例6: getInstallPath
/**
* {@inheritDoc}
*/
public function getInstallPath(PackageInterface $package)
{
$type = $package->getType();
if (!$this->supports($type)) {
throw new \InvalidArgumentException("Package type '{$type}' is not supported at this time.");
}
if ($type === 'projek-ci-module') {
return parent::getInstallPath($package);
}
$prettyName = $package->getPrettyName();
if (strpos($prettyName, '/') !== false) {
list($vendor, $name) = explode('/', $prettyName);
} else {
$vendor = '';
$name = $prettyName;
}
$extra = ($pkg = $this->composer->getPackage()) ? $pkg->getExtra() : array();
$appdir = !empty($extra['codeigniter-application-dir']) ? $extra['codeigniter-application-dir'] : 'application';
$install_paths = $this->package_install_paths;
if (!empty($extra['codeigniter-module-dir'])) {
$moduleDir = $extra['codeigniter-module-dir'];
$install_paths['codeigniter-module'] = $moduleDir . '/{name}/';
}
if (!empty($extra['codeigniter-subclass-prefix'])) {
$this->package_subclass_prefix = $extra['codeigniter-subclass-prefix'];
}
$vars = array('{name}' => $name, '{vendor}' => $vendor, '{type}' => $type, '{application}' => $appdir);
return str_replace(array_keys($vars), array_values($vars), $install_paths[$type]);
}
示例7: getInstallPath
public function getInstallPath(PackageInterface $package)
{
$type = $package->getType();
if ($this->supports($type)) {
$directory = $this->getDirectory($type, $package);
if (!empty($directory)) {
return $directory;
}
}
$names = $package->getNames();
if ($this->composer->getPackage()) {
$extra = $this->composer->getPackage()->getExtra();
if (!empty($extra['installer-paths'])) {
foreach ($extra['installer-paths'] as $path => $packageNames) {
foreach ($packageNames as $packageName) {
if (in_array(strtolower($packageName), $names)) {
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);
}
示例8: getInstallPath
/**
* Overridden to take into account the root package
*
* @see \Composer\Installer\LibraryInstaller::getInstallPath()
*/
public function getInstallPath(PackageInterface $package)
{
if ($package instanceof RootPackageInterface) {
return '.';
}
return parent::getInstallPath($package);
}
示例9: getInstallPath
/**
* {@inheritdoc}
*/
public function getInstallPath(PackageInterface $package)
{
$drupalLibraries = ['enyo/dropzone'];
if (in_array($package->getPrettyName(), $drupalLibraries)) {
return getcwd() . '/docroot/libraries/' . explode('/', $package->getPrettyName())[1];
}
return parent::getInstallPath($package);
}
示例10: getInstallPath
/**
* {@inheritDoc}
*/
public function getInstallPath(PackageInterface $package)
{
$extra = $package->getExtra();
if (array_key_exists("install-path", $extra)) {
return $extra["install-path"];
} else {
return parent::getInstallPath($package);
}
}
示例11: getInstallPath
/**
*
* @param PackageInterface $package
*
* @return string a path relative to the root of the composer.json that is being installed.
*/
public function getInstallPath(PackageInterface $package)
{
// custom install path only when it is the keeko/keeko package
if ($this->root->getName() == 'keeko/keeko') {
return 'packages/' . $package->getName();
}
// ... anyway return the default
return parent::getInstallPath($package);
}
示例12: getInstallPath
public function getInstallPath(PackageInterface $package)
{
$strDest = parent::getInstallPath($package);
$parts = explode('_', $package->getName());
if ('qcubed/plugin' === $parts[0]) {
$strDest = ($this->vendorDir ? $this->vendorDir . '/' : '') . 'qcubed/plugin/' . $parts[1];
}
return $strDest;
}
示例13: getInstallPath
/**
* {@inheritDoc}
*/
public function getInstallPath(PackageInterface $package)
{
if (empty($this->drupalLibraryMap[$package->getPrettyName()])) {
$path = parent::getInstallPath($package);
} else {
$path = $this->drupalLibrariesPath . $this->drupalLibraryMap[$package->getPrettyName()];
}
return $path;
}
示例14: getInstallPath
/**
* Determines the install path for git hooks,
*
* The installation path is the standard git hooks directory documented here:
* https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
*
* @param PackageInterface $package
*
* @return string a path relative to the root of the composer.json that is being installed.
*/
public function getInstallPath(PackageInterface $package)
{
if (!$this->supports($package->getType())) {
throw new \InvalidArgumentException('Unable to install package, git-hook packages only ' . 'support "git-hook", "library" type packages.');
}
// Allow to LibraryInstaller to resolve the installPath for other packages.
if ($package->getType() !== 'git-hook') {
return parent::getInstallPath($package);
}
return $this->getGitHooksPath();
}
示例15: getInstallPath
/**
* {@inheritdoc}
*/
public function getInstallPath(PackageInterface $package)
{
switch ($package->getType()) {
case self::TYPE_MOODLE_SOURCE:
$basePath = $this->getMoodleDir();
break;
default:
$basePath = parent::getInstallPath($package);
}
return $basePath;
}