本文整理汇总了PHP中Composer\Package\PackageInterface::getRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP PackageInterface::getRepository方法的具体用法?PHP PackageInterface::getRepository怎么用?PHP PackageInterface::getRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\Package\PackageInterface
的用法示例。
在下文中一共展示了PackageInterface::getRepository方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compareByPriorityPreferInstalled
public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $ignoreReplace = false)
{
if ($a->getRepository() === $b->getRepository()) {
if (!$ignoreReplace) {
// return original, not replaced
if ($this->replaces($a, $b)) {
return 1;
// use b
}
if ($this->replaces($b, $a)) {
return -1;
// use a
}
}
// priority equal, sort by package id to make reproducible
if ($a->getId() === $b->getId()) {
return 0;
}
return $a->getId() < $b->getId() ? -1 : 1;
}
if (isset($installedMap[$a->getId()])) {
return -1;
}
if (isset($installedMap[$b->getId()])) {
return 1;
}
return $this->getPriority($pool, $a) > $this->getPriority($pool, $b) ? -1 : 1;
}
示例2: initPerforce
public function initPerforce(PackageInterface $package, $path, $url)
{
if (!empty($this->perforce)) {
$this->perforce->initializePath($path);
return;
}
$repository = $package->getRepository();
$repoConfig = null;
if ($repository instanceof VcsRepository) {
$repoConfig = $this->getRepoConfig($repository);
}
$this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
}
示例3: doDownload
/**
* {@inheritDoc}
*/
public function doDownload(PackageInterface $package, $path, $url)
{
SvnUtil::cleanEnv();
$ref = $package->getSourceReference();
$repo = $package->getRepository();
if ($repo instanceof VcsRepository) {
$repoConfig = $repo->getRepoConfig();
if (array_key_exists('svn-cache-credentials', $repoConfig)) {
$this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
}
}
$this->io->writeError(" Checking out " . $package->getSourceReference());
$this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
}
示例4: compareByPriorityPreferInstalled
public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
{
if ($a->getRepository() === $b->getRepository()) {
if ($a->getName() === $b->getName()) {
$aAliased = $a instanceof AliasPackage;
$bAliased = $b instanceof AliasPackage;
if ($aAliased && !$bAliased) {
return -1;
}
if (!$aAliased && $bAliased) {
return 1;
}
}
if (!$ignoreReplace) {
if ($this->replaces($a, $b)) {
return 1;
}
if ($this->replaces($b, $a)) {
return -1;
}
if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
$requiredVendor = substr($requiredPackage, 0, $pos);
$aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
$bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
if ($bIsSameVendor !== $aIsSameVendor) {
return $aIsSameVendor ? -1 : 1;
}
}
}
if ($a->id === $b->id) {
return 0;
}
return $a->id < $b->id ? -1 : 1;
}
if (isset($installedMap[$a->id])) {
return -1;
}
if (isset($installedMap[$b->id])) {
return 1;
}
return $this->getPriority($pool, $a) > $this->getPriority($pool, $b) ? -1 : 1;
}
示例5: notifyInstall
protected function notifyInstall(PackageInterface $package)
{
if ($package->getRepository() instanceof NotifiableRepositoryInterface) {
$package->getRepository()->notifyInstall($package);
}
}
示例6: compareByPriorityPreferInstalled
/**
* @protected
*/
public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
{
if ($a->getRepository() === $b->getRepository()) {
// prefer aliases to the original package
if ($a->getName() === $b->getName()) {
$aAliased = $a instanceof AliasPackage;
$bAliased = $b instanceof AliasPackage;
if ($aAliased && !$bAliased) {
return -1;
// use a
}
if (!$aAliased && $bAliased) {
return 1;
// use b
}
}
if (!$ignoreReplace) {
// return original, not replaced
if ($this->replaces($a, $b)) {
return 1;
// use b
}
if ($this->replaces($b, $a)) {
return -1;
// use a
}
// for replacers not replacing each other, put a higher prio on replacing
// packages with the same vendor as the required package
if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
$requiredVendor = substr($requiredPackage, 0, $pos);
$aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
$bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
if ($bIsSameVendor !== $aIsSameVendor) {
return $aIsSameVendor ? -1 : 1;
}
}
}
// priority equal, sort by package id to make reproducible
if ($a->getId() === $b->getId()) {
return 0;
}
return $a->getId() < $b->getId() ? -1 : 1;
}
if (isset($installedMap[$a->getId()])) {
return -1;
}
if (isset($installedMap[$b->getId()])) {
return 1;
}
return $this->getPriority($pool, $a) > $this->getPriority($pool, $b) ? -1 : 1;
}
示例7: getRepository
/**
* {@inheritdoc}
*/
public function getRepository()
{
return $this->package->getRepository();
}