Beispiel #1
0
 /**
  * Constructor.
  *
  * @param string             $name
  * @param string             $type
  * @param PackageInterface   $package
  * @param Link               $link
  * @param Dependency[]|false $children
  */
 public function __construct($name, $type, PackageInterface $package, Link $link, $children)
 {
     $this->name = $name;
     $this->type = $type;
     $this->package = $package;
     $this->link = $link;
     $this->setChildren($children);
     $this->relationship = (new DependencyRelationship())->setSourceName($package->getPrettyName())->setSourceVersion($package->getPrettyVersion())->setTargetName($link->getTarget())->setTargetVersion($link->getPrettyConstraint())->setReason($link->getDescription());
 }
Beispiel #2
0
 /**
  * Resolves a package link to a package in the installed pool
  *
  * Since dependencies are already installed this should always find one.
  *
  * @param Pool $pool Pool of installed packages only
  * @param Link $link Package link to look up
  *
  * @return PackageInterface|null The found package
  */
 private function lookupInstalledPackage(Pool $pool, Link $link)
 {
     $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
     return !empty($packages) ? $packages[0] : null;
 }
 /**
  * @param \Composer\Package\Link $packageLink
  * @param bool $ignoreRequiredVersion
  * @param bool $exactAsTilda
  * @return \Composer\Package\PackageInterface[]
  */
 private function getVersionsByPackageLink(Link $packageLink, $ignoreRequiredVersion = FALSE, $exactAsTilda = FALSE)
 {
     $constraint = $packageLink->getConstraint();
     if ($this->versionParser->parseStability($constraint->getPrettyString()) !== 'dev') {
         if ($ignoreRequiredVersion) {
             $constraint = NULL;
         } elseif ($exactAsTilda && $this->isExact($constraint)) {
             $constraint = $this->versionParser->parseConstraints(sprintf('~%s', $constraint->getPrettyString()));
         }
     }
     return $this->getVersions($packageLink->getTarget(), $constraint);
 }
 /**
  * Include the constraint of root dependency version in the constraint
  * of installed package.
  *
  * @param PackageInterface $package The installed package
  * @param Link             $link    The link contained installed constraint
  *
  * @return Link The link with root and installed version constraint
  */
 private function includeRootConstraint(PackageInterface $package, Link $link)
 {
     if (isset($this->requires[$package->getName()])) {
         /* @var Link $rLink */
         $rLink = $this->requires[$package->getName()];
         $useConjunctive = FilterUtil::checkExtraOption($this->package, 'asset-optimize-with-conjunctive');
         $constraint = new MultiConstraint(array($rLink->getConstraint(), $link->getConstraint()), $useConjunctive);
         $link = new Link($rLink->getSource(), $rLink->getTarget(), $constraint, 'installed', $constraint->getPrettyString());
     }
     return $link;
 }
 /**
  * Get the minimum stability for the require dependency defined in root package.
  *
  * @param RootPackageInterface $package The root package
  * @param Link                 $require The require link defined in root package
  *
  * @return string The minimum stability defined in root package (in links or global project)
  */
 public static function getMinimumStabilityFlag(RootPackageInterface $package, Link $require)
 {
     $flags = $package->getStabilityFlags();
     if (isset($flags[$require->getTarget()])) {
         return static::findFlagStabilityName($flags[$require->getTarget()]);
     }
     return $package->getPreferStable() ? 'stable' : $package->getMinimumStability();
 }
    /**
     * Get the minimum stability for the require dependency defined in root package.
     *
     * @param Link $require The require link defined in root package.
     *
     * @return string The minimum stability
     */
    protected function getRequireStability(Link $require)
    {
        $prettyConstraint = $require->getPrettyConstraint();
        $stabilities = Package::$stabilities;

        if (preg_match_all('/@('.implode('|', array_keys($stabilities)).')/', $prettyConstraint, $matches)) {
            return $this->findInlineStabilities($matches[1]);
        }

        return $this->package->getMinimumStability();
    }
Beispiel #7
0
 /**
  * @param Link $packageLink
  * @return string
  */
 private function formatPackageLink(Link $packageLink)
 {
     return sprintf('<info>%s</info> %s <comment>%s</comment>', str_pad($packageLink->getTarget(), $this->nameLength), str_pad($packageLink->getPrettyConstraint(), $this->versionLength), $packageLink->getSource());
 }
 private function hasFallbackBranch(Link $require)
 {
     return isset($this->featureBranchFallbacks[$require->getTarget()]);
 }