本文整理匯總了PHP中Composer\Package\PackageInterface::getNames方法的典型用法代碼示例。如果您正苦於以下問題:PHP PackageInterface::getNames方法的具體用法?PHP PackageInterface::getNames怎麽用?PHP PackageInterface::getNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Composer\Package\PackageInterface
的用法示例。
在下文中一共展示了PackageInterface::getNames方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getPackageBasePath
/**
* {@inheritDoc}
*/
public function getPackageBasePath(PackageInterface $package)
{
$names = $package->getNames();
if (is_array($names)) {
$names = $names[0];
}
$extra = $package->getExtra();
if (isset($extra['install-dir'])) {
return $extra['install-dir'];
} else {
list($vendor, $package) = explode('/', $names);
return 'plugins/' . $vendor . $package;
}
}
示例2: getInstallPath
public function getInstallPath(PackageInterface $package)
{
$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);
}
示例3: isSkippable
/**
* Tells if a package has to be dumped or not.
*
* @param PackageInterface $package The package to be dumped
*
* @return bool false if the package has to be dumped.
*/
public function isSkippable(PackageInterface $package)
{
if ('metapackage' === $package->getType()) {
return true;
}
$name = $package->getPrettyString();
if (true === $this->archiveConfig['skip-dev'] && true === $package->isDev()) {
$this->output->writeln(sprintf("<info>Skipping '%s' (is dev)</info>", $name));
return true;
}
$names = $package->getNames();
if ($this->archiveConfig['whitelist'] && !array_intersect($this->archiveConfig['whitelist'], $names)) {
$this->output->writeln(sprintf("<info>Skipping '%s' (is not in whitelist)</info>", $name));
return true;
}
if ($this->archiveConfig['blacklist'] && array_intersect($this->archiveConfig['blacklist'], $names)) {
$this->output->writeln(sprintf("<info>Skipping '%s' (is in blacklist)</info>", $name));
return true;
}
return false;
}
示例4: getInstallPath
public function getInstallPath(PackageInterface $package)
{
$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)) {
if ($matched = preg_match_all("/\\{(.*?)\\}/is", $path, $matches, PREG_PATTERN_ORDER)) {
$packageParts = explode('/', $packageName);
foreach ($matches[1] as $pattern) {
$patternParts = explode('|', $pattern);
$flags = array();
if (count($patternParts) > 1) {
$flags = str_split($patternParts[1]);
}
switch ($patternParts[0]) {
case '$package':
$value = $packageName;
break;
case '$name':
if (count($packageParts) > 1) {
$value = $packageParts[1];
} else {
$value = 'undefined';
}
break;
case '$vendor':
if (count($packageParts) > 1) {
$value = $packageParts[0];
} else {
$value = 'undefined';
}
break;
}
foreach ($flags as $flag) {
switch ($flag) {
case 'F':
$value = ucfirst($value);
break;
case 'P':
$value = preg_replace_callback('/[_\\-]([a-zA-Z])/', function ($matches) {
return strtoupper($matches[1]);
}, $value);
break;
}
}
$path = str_replace('{' . $pattern . '}', $value, $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);
}
示例5: getNames
/**
* {@inheritdoc}
*/
public function getNames()
{
return $this->package->getNames();
}