當前位置: 首頁>>代碼示例>>PHP>>正文


PHP InstalledRepositoryInterface::hasPackage方法代碼示例

本文整理匯總了PHP中Composer\Repository\InstalledRepositoryInterface::hasPackage方法的典型用法代碼示例。如果您正苦於以下問題:PHP InstalledRepositoryInterface::hasPackage方法的具體用法?PHP InstalledRepositoryInterface::hasPackage怎麽用?PHP InstalledRepositoryInterface::hasPackage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Composer\Repository\InstalledRepositoryInterface的用法示例。


在下文中一共展示了InstalledRepositoryInterface::hasPackage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: install

 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     // Debug
     $this->debug = $this->isDebug($package);
     // Composer stuff
     $this->initializeVendorDir();
     $downloadPath = $this->getInstallPath($package);
     if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
         $this->removeBinaries($package);
     }
     if (!$repo->hasPackage($package)) {
         $repo->addPackage(clone $package);
     }
     $this->downloadAndExtractFile($package);
 }
開發者ID:azt3k,項目名稱:non-destructive-archive-installer,代碼行數:18,代碼來源:NonDestructiveArchiveInstallerInstaller.php

示例2: updateCode

 public function updateCode(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
 {
     if (!$repo->hasPackage($initial)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $initial);
     }
     if ($initial->getInstallationSource() == 'source' && $initial->getSourceType() == 'git' && $target->getSourceType() == 'git') {
         $this->downloadManager->update($initial, $target, $this->getInstallPath($target));
     } else {
         $this->installCode($target);
     }
     $repo->removePackage($initial);
     if (!$repo->hasPackage($target)) {
         $repo->addPackage(clone $target);
     }
 }
開發者ID:claromentis,項目名稱:installer-composer-plugin,代碼行數:15,代碼來源:BaseInstaller.php

示例3: isPackageInstalled

 public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if ($package instanceof AliasPackage) {
         return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
     }
     return $this->getInstaller($package->getType())->isInstalled($repo, $package);
 }
開發者ID:itillawarra,項目名稱:cmfive,代碼行數:7,代碼來源:InstallationManager.php

示例4: uninstall

 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $repo->removePackage($package);
 }
開發者ID:itillawarra,項目名稱:cmfive,代碼行數:7,代碼來源:NoopInstaller.php

示例5: uninstall

 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         return;
     }
     $this->removeBinaries($package);
     $repo->removePackage($package);
 }
開發者ID:itscaro,項目名稱:composer-global-installer,代碼行數:11,代碼來源:GlobalInstaller.php

示例6: uninstall

 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $repo->removePackage($package);
     $installPath = $this->getInstallPath($package);
     $this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
 }
開發者ID:ddrozdik,項目名稱:dmaps,代碼行數:9,代碼來源:Installer.php

示例7: uninstall

 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         // TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125)
         return;
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $repo->removePackage($package);
 }
開發者ID:ilosada,項目名稱:chamilo-lms-icpna,代碼行數:12,代碼來源:NoopInstaller.php

示例8: uninstall

 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $this->removeCode($package);
     $this->removeBinaries($package);
     $repo->removePackage($package);
     $downloadPath = $this->getPackageBasePath($package);
     if (strpos($package->getName(), '/')) {
         $packageVendorDir = dirname($downloadPath);
         if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
             @rmdir($packageVendorDir);
         }
     }
 }
開發者ID:VicDeo,項目名稱:poc,代碼行數:16,代碼來源:LibraryInstaller.php

示例9: uninstall

 /**
  * {@inheritDoc}
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         // TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125)
         return;
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $downloadPath = $this->getInstallPath($package);
     $this->removeCode($package);
     $this->removeBinaries($package);
     $repo->removePackage($package);
     if (strpos($package->getName(), '/')) {
         $packageVendorDir = dirname($downloadPath);
         if (is_dir($packageVendorDir) && !glob($packageVendorDir . '/*')) {
             @rmdir($packageVendorDir);
         }
     }
 }
開發者ID:nickelc,項目名稱:composer,代碼行數:21,代碼來源:LibraryInstaller.php

示例10: isPackageInstalled

 public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     return $repo->hasPackage($package);
 }
開發者ID:alancleaver,項目名稱:composer,代碼行數:4,代碼來源:InstallationManagerMock.php

示例11: update

 /**
  * Updates a package
  *
  * @param \Composer\Repository\InstalledRepositoryInterface $repo
  * @param \Composer\Package\PackageInterface $initial
  * @param \Composer\Package\PackageInterface $target
  * @throws \InvalidArgumentException
  */
 public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
 {
     if (!$repo->hasPackage($initial)) {
         throw new CoreInstaller\PackageNotInstalledException($initial);
     }
     $this->getDriver()->update($initial, $target);
     $repo->removePackage($initial);
     if (!$repo->hasPackage($target)) {
         $repo->addPackage(clone $target);
     }
 }
開發者ID:netresearch,項目名稱:composer-installers,代碼行數:19,代碼來源:CoreInstaller.php

示例12: uninstall

 /**
  * Remove symlinks for Contao sources before uninstalling a package.
  *
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException When the requested package is not installed.
  */
 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     $this->logVerbose(sprintf('Removing Contao sources for %s', $package->getName()));
     $this->removeSymlinks($package, $this->getContaoRoot(), $this->getSources($package));
     parent::uninstall($repo, $package);
     $this->logVerbose('');
 }
開發者ID:contao-community-alliance,項目名稱:composer-plugin,代碼行數:17,代碼來源:AbstractModuleInstaller.php

示例13: uninstall

 /**
  * Uninstalls specific package.
  *
  * @param \Composer\Repository\InstalledRepositoryInterface $repo repository in which to check
  * @param \Composer\Package\PackageInterface $package package instance
  */
 public function uninstall(\Composer\Repository\InstalledRepositoryInterface $repo, \Composer\Package\PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     if ($this->filesystem->someFilesExist($this->symlinks)) {
         $this->filesystem->removeSymlinks($this->symlinks);
     }
     $this->removeCode($package);
     $repo->removePackage($package);
 }
開發者ID:rengaw83,項目名稱:CmsComposerInstallers,代碼行數:17,代碼來源:CoreInstaller.php

示例14: uninstall

 public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$repo->hasPackage($package)) {
         throw new \InvalidArgumentException('Package is not installed: ' . $package);
     }
     if ($package->getType() === MagentoInstaller::MAGENTO_SOURCE) {
         $repo->removePackage($package);
         $this->_makeBackup($repo, $package);
     } else {
         $repo->removePackage($package);
         $installPath = $this->getInstallPath($package);
         $this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
     }
 }
開發者ID:staempfli,項目名稱:composer-installer,代碼行數:14,代碼來源:Installer.php

示例15: isInstalled

 /**
  * @param InstalledRepositoryInterface $repo
  * @param PackageInterface             $package
  *
  * @return bool
  */
 public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     // Just check if the sources folder and the link exist
     return $repo->hasPackage($package) && is_readable($this->getInstallPath($package)) && is_link($this->getPackageVendorSymlink($package));
 }
開發者ID:letudiant,項目名稱:composer-shared-package-plugin,代碼行數:11,代碼來源:SharedPackageInstaller.php


注:本文中的Composer\Repository\InstalledRepositoryInterface::hasPackage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。