当前位置: 首页>>代码示例>>PHP>>正文


PHP RepositoryManager::getLocalRepositories方法代码示例

本文整理汇总了PHP中Composer\Repository\RepositoryManager::getLocalRepositories方法的典型用法代码示例。如果您正苦于以下问题:PHP RepositoryManager::getLocalRepositories方法的具体用法?PHP RepositoryManager::getLocalRepositories怎么用?PHP RepositoryManager::getLocalRepositories使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\Repository\RepositoryManager的用法示例。


在下文中一共展示了RepositoryManager::getLocalRepositories方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run installation (or update)
  */
 public function run()
 {
     if ($this->dryRun) {
         $this->verbose = true;
         $this->runScripts = false;
         $this->installationManager->addInstaller(new NoopInstaller());
     }
     if ($this->preferSource) {
         $this->downloadManager->setPreferSource(true);
     }
     // create installed repo, this contains all local packages + platform packages (php & extensions)
     $installedRootPackage = clone $this->package;
     $installedRootPackage->setRequires(array());
     $installedRootPackage->setDevRequires(array());
     $repos = array_merge($this->repositoryManager->getLocalRepositories(), array(new InstalledArrayRepository(array($installedRootPackage)), new PlatformRepository()));
     $installedRepo = new CompositeRepository($repos);
     if ($this->additionalInstalledRepository) {
         $installedRepo->addRepository($this->additionalInstalledRepository);
     }
     $aliases = $this->aliasPackages();
     if ($this->runScripts) {
         // dispatch pre event
         $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
         $this->eventDispatcher->dispatchCommandEvent($eventName);
     }
     $this->suggestedPackages = array();
     if (!$this->doInstall($this->repositoryManager->getLocalRepository(), $installedRepo, $aliases)) {
         return false;
     }
     if ($this->devMode) {
         if (!$this->doInstall($this->repositoryManager->getLocalDevRepository(), $installedRepo, $aliases, true)) {
             return false;
         }
     }
     // output suggestions
     foreach ($this->suggestedPackages as $suggestion) {
         if (!$installedRepo->findPackages($suggestion['target'])) {
             $this->io->write($suggestion['source'] . ' suggests installing ' . $suggestion['target'] . ' (' . $suggestion['reason'] . ')');
         }
     }
     if (!$this->dryRun) {
         // write lock
         if ($this->update || !$this->locker->isLocked()) {
             $updatedLock = $this->locker->setLockData($this->repositoryManager->getLocalRepository()->getPackages(), $this->devMode ? $this->repositoryManager->getLocalDevRepository()->getPackages() : null, $aliases, $this->package->getMinimumStability(), $this->package->getStabilityFlags());
             if ($updatedLock) {
                 $this->io->write('<info>Writing lock file</info>');
             }
         }
         // write autoloader
         $this->io->write('<info>Generating autoload files</info>');
         $localRepos = new CompositeRepository($this->repositoryManager->getLocalRepositories());
         $this->autoloadGenerator->dump($localRepos, $this->package, $this->installationManager, $this->installationManager->getVendorPath() . '/composer', true);
         if ($this->runScripts) {
             // dispatch post event
             $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
             $this->eventDispatcher->dispatchCommandEvent($eventName);
         }
     }
     return true;
 }
开发者ID:nicodmf,项目名称:composer,代码行数:63,代码来源:Installer.php

示例2: aliasPackages

 private function aliasPackages()
 {
     if (!$this->update && $this->locker->isLocked()) {
         $aliases = $this->locker->getAliases();
     } else {
         $aliases = $this->package->getAliases();
     }
     foreach ($aliases as $alias) {
         foreach ($this->repositoryManager->findPackages($alias['package'], $alias['version']) as $package) {
             $package->setAlias($alias['alias_normalized']);
             $package->setPrettyAlias($alias['alias']);
             $package->getRepository()->addPackage(new AliasPackage($package, $alias['alias_normalized'], $alias['alias']));
         }
         foreach ($this->repositoryManager->getLocalRepositories() as $repo) {
             foreach ($repo->findPackages($alias['package'], $alias['version']) as $package) {
                 $package->setAlias($alias['alias_normalized']);
                 $package->setPrettyAlias($alias['alias']);
                 $package->getRepository()->addPackage(new AliasPackage($package, $alias['alias_normalized'], $alias['alias']));
                 $package->getRepository()->removePackage($package);
             }
         }
     }
     return $aliases;
 }
开发者ID:nlegoff,项目名称:composer,代码行数:24,代码来源:Installer.php

示例3: purgePackages

 protected function purgePackages(Repository\RepositoryManager $rm, Installer\InstallationManager $im)
 {
     foreach ($rm->getLocalRepositories() as $repo) {
         foreach ($repo->getPackages() as $package) {
             if (!$im->isPackageInstalled($repo, $package)) {
                 $repo->removePackage($package);
             }
         }
     }
 }
开发者ID:nicodmf,项目名称:composer,代码行数:10,代码来源:Factory.php


注:本文中的Composer\Repository\RepositoryManager::getLocalRepositories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。