Esempio n. 1
0
 /**
  * Retrieve the packages to obtain.
  *
  * @param ComposerInformation $composer The composer information.
  *
  * @return string[]
  *
  * @throws \LogicException When require-dev shall get included but the current package is not the root package.
  */
 private function filteredPackages(ComposerInformation $composer)
 {
     $packages = [];
     if ($this->includeRequire) {
         if (true === $this->includeRequire) {
             $packages = $composer->getDependencies($this->name, $this->excludeDependencies);
         } else {
             $packages = $this->includeRequire;
         }
     }
     $packages = array_merge($packages, [$this->name]);
     if ($this->includeRequireDev) {
         if ($this->name !== $composer->getRootPackageName()) {
             throw new \LogicException('Inclusion of require-dev from ' . $this->name . ' requested but it is not the root package.');
         }
         if (true === $this->includeRequireDev) {
             $packages = array_merge($packages, $composer->getDevDependencies());
         }
     }
     $exclude = $this->excludeDependencies;
     $excTypes = ['platform', 'metapackage'];
     $packages = array_filter($packages, function ($package) use($exclude, $excTypes, $composer) {
         return !(in_array($package, $exclude) || in_array($composer->getPackageType($package), $excTypes));
     });
     return $packages;
 }
Esempio n. 2
0
 /**
  * Collect the parameter bag.
  *
  * @param ComposerInformation $information    The composer information.
  *
  * @param string[]            $baseParameters The base parameters.
  *
  * @return ParameterBag
  */
 private function collectParameters(ComposerInformation $information, $baseParameters)
 {
     $parameterBag = new ParameterBag($baseParameters);
     foreach ($information->getPackageNames() as $packageName) {
         $parameterBag->set(sprintf('package:%s', $packageName), $information->getPackageDirectory($packageName));
         $parameterBag->set(sprintf('version:%s', $packageName), $information->getPackageVersion($packageName));
         $parameterBag->set(sprintf('date:%s', $packageName), $information->getPackageReleaseDate($packageName));
     }
     return $parameterBag;
 }