Example #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());
 }
Example #2
0
 /**
  * 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 FilterUtil::findInlineStabilities($matches[1], $this->versionParser);
     }
     return FilterUtil::getMinimumStabilityFlag($this->package, $require);
 }
    /**
     * 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();
    }
Example #4
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());
 }