本文整理汇总了PHP中Composer\Package\PackageInterface::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP PackageInterface::getType方法的具体用法?PHP PackageInterface::getType怎么用?PHP PackageInterface::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\Package\PackageInterface
的用法示例。
在下文中一共展示了PackageInterface::getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPackageBasePath
protected function getPackageBasePath(PackageInterface $package)
{
if (!$this->supports($package->getType())) {
throw new \InvalidArgumentException("Package type [{$type}] is not supported");
}
return self::$allowedTypes[$package->getType()] . '/' . $package->getPrettyName();
}
示例2: getRootPath
/**
* Returns the root installation path for templates.
*
* @param PackageInterface $package
*
* @return string a path relative to the root of the composer.json
*/
protected function getRootPath(PackageInterface $package)
{
$rootPath = $this->vendorDir . '/raulfraile/ladybug-themes/Ladybug/';
if ($this->composer->getPackage()->getName() === 'raulfraile/ladybug') {
$rootPath = 'data/' . ($package->getType() === self::PACKAGE_TYPE_THEME ? 'themes' : 'plugins') . '/Ladybug/';
}
$rootPath .= $package->getType() === self::PACKAGE_TYPE_THEME ? 'Theme' : 'Plugin';
return $rootPath;
}
示例3: getPattern
/**
* Retrieve the pattern for the given package.
*
* @param \Composer\Package\PackageInterface $package
*
* @return string
*/
public function getPattern(PackageInterface $package)
{
if (isset($this->packages[$package->getName()])) {
return $this->packages[$package->getName()];
} elseif (isset($this->packages[$package->getPrettyName()])) {
return $this->packages[$package->getPrettyName()];
} elseif (isset($this->types[$package->getType()])) {
return $this->types[$package->getType()];
}
}
示例4: 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();
}
示例5: getPackageBasePath
/**
* getPackageBasePath.
*
* @param PackageInterface $package
*
* @return string
*/
protected function getPackageBasePath(PackageInterface $package)
{
if (isset($this->paths[$package->getType()]) && ($path = $this->paths[$package->getType()])) {
@(list($vendor, $name) = explode('/', $package->getPrettyName()));
$path = strtr($path, array('{vendor}' => $vendor, '{name}' => $name));
return rtrim($path, '/');
}
if (($extra = $package->getExtra()) && isset($extra['courier-path'])) {
return rtrim($extra['courier-path'], '/');
}
return ($this->vendorDir ? $this->vendorDir . '/' : '') . $package->getPrettyName();
}
示例6: getPackageBasePath
/**
* {@inheritDoc}
*/
protected function getPackageBasePath(PackageInterface $package)
{
$targetPath = '.faye-app';
if ('faye-app-integration-plugin' == $package->getType()) {
$targetPath .= '/plugins';
}
if ($targetPath && !file_exists($targetPath)) {
mkdir($targetPath, 0777, true);
}
if ('faye-app-integration-plugin' == $package->getType()) {
return $targetPath . '/' . str_replace('/', '-', $package->getPrettyName());
}
return $targetPath;
}
示例7: getInstallPath
/**
* Returns the installation path of a package
*
* @param PackageInterface $package Package
*
* @return string
*/
public function getInstallPath(PackageInterface $package)
{
switch ($package->getType()) {
case self::TYPE_WORDPRESS:
return 'wp';
}
}
示例8: getCoreInstallPath
protected function getCoreInstallPath(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()) {
$extra = $this->composer->getPackage()->getExtra();
if (!empty($extra['installer-paths'])) {
$customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type);
if ($customPath !== false) {
return $this->templatePath($customPath, $availableVars);
}
}
}
$path = self::DEFAULT_TARGET_PATH;
return $this->templatePath($path, $availableVars);
}
示例9: getInstallPath
/**
* Returns the installation path of a package
*
* @param PackageInterface $package Package to install.
* @return string path
*/
public function getInstallPath(PackageInterface $package)
{
if ($package->getType() === $this->type) {
return 'Packages/Applications/' . self::getPathName($package);
}
throw new \InvalidArgumentException('Sorry the package type of this package is not supported.');
}
示例10: uninstall
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
$this->initGingerBackend();
$extra = $package->getExtra();
$uninstallPluginCommand = new Cqrs\UninstallPluginCommand(array('plugin_name' => $package->getName(), 'plugin_type' => $package->getType(), 'plugin_namespace' => $extra['plugin-namespace'], 'plugin_version' => $package->getVersion()));
$this->getServiceManager()->get('malocher.cqrs.gate')->getBus()->invokeCommand($uninstallPluginCommand);
parent::uninstall($repo, $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)
{
$type = $package->getType();
if ($type === 'keeko-core') {
return 'core';
}
return $this->getPackageDir($type) . '/' . $package->getName();
}
示例12: getInstallPath
/**
* {@inheritDoc}
*/
public function getInstallPath(PackageInterface $package)
{
$name = $package->getPrettyName();
if (strpos($name, '/') !== false) {
list($vendor, $name) = explode('/', $name);
}
if ($package->getType() === 'modulargaming-module') {
return 'modulargaming/' . $name;
}
if ($package->getType() === 'modulargaming-theme') {
// Remove theme- prefix if it exists.
if (substr($name, 0, 6) === 'theme-') {
$name = substr($name, 6);
}
return 'themes/' . $name;
}
}
示例13: getInstallPath
/**
* {@inheritDoc}
*/
public function getInstallPath(PackageInterface $package)
{
$packageType = $package->getType();
if (!isset($this->locations[$packageType])) {
throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $packageType));
}
list($vendor, $name) = explode('/', strtolower($package->getName()), 2);
$extra = $package->getExtra();
$path = str_replace(['{$vendor}', '{$name}', '{$extra.dir}'], [$vendor, $name, $extra['dir']], $this->locations[$packageType]);
return $this->vendorDir . '/' . $path;
}
示例14: getInstaller
/**
* Returns the installer for a given type
*
* @param PackageInterface
* @return AbstractPackageInstaller
*/
private function getInstaller(PackageInterface $package)
{
switch ($package->getType()) {
case 'keeko-app':
return new AppInstaller();
case 'keeko-module':
return new ModuleInstaller();
default:
return new DummyInstaller();
}
}
示例15: getPackageBasePath
/**
* {@inheritdoc}
*/
protected function getPackageBasePath(PackageInterface $package)
{
switch ($package->getType()) {
case self::TYPE_MOODLE_SOURCE:
$basePath = $this->getMoodleDir();
break;
default:
$basePath = parent::getPackageBasePath($package);
}
return $basePath;
}