Esempio n. 1
0
File: Plugin.php Progetto: Jobu/core
 /**
  * Inject the contao/*-bundle versions into the Contao package.
  *
  * @param WritableRepositoryInterface $repository    The repository where to add the packages.
  *
  * @param string                      $version       The version to use.
  *
  * @param string                      $prettyVersion The version to use.
  *
  * @return void
  */
 protected function injectContaoBundles(WritableRepositoryInterface $repository, $version, $prettyVersion)
 {
     foreach (Environment::$bundleNames as $bundleName) {
         if ($remove = $repository->findPackage($bundleName, '*')) {
             if ($this->isNotMetaPackageOrHasSameVersion($remove, $version)) {
                 // stop if the package is required somehow and must not be injected or if the virtual package is
                 // already injected.
                 continue;
             }
             // Otherwise remove the package.
             $repository->removePackage($remove);
         }
         $package = new CompletePackage($bundleName, $version, $prettyVersion);
         $package->setType('metapackage');
         $repository->addPackage($package);
     }
 }