示例#1
0
 /**
  * Creates a new in memory package.
  *
  * @param string $name        The package's name
  * @param string $version     The package's version
  * @param string $prettyVersion The package's non-normalized version
  */
 public function __construct($name, $version, $prettyVersion)
 {
     parent::__construct($name);
     $this->version = $version;
     $this->prettyVersion = $prettyVersion;
     $this->dev = VersionParser::isDev($version);
 }
 /**
  * All descendants' constructors should call this parent constructor
  *
  * @param PackageInterface $aliasOf       The package this package is an alias of
  * @param string           $version       The version the alias must report
  * @param string           $prettyVersion The alias's non-normalized version
  */
 public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
 {
     parent::__construct($aliasOf->getName());
     $this->version = $version;
     $this->prettyVersion = $prettyVersion;
     $this->aliasOf = $aliasOf;
     $this->stability = VersionParser::parseStability($version);
     $this->dev = $this->stability === 'dev';
     // replace self.version dependencies
     foreach (array('requires', 'devRequires') as $type) {
         $links = $aliasOf->{'get' . ucfirst($type)}();
         foreach ($links as $index => $link) {
             // link is self.version, but must be replacing also the replaced version
             if ('self.version' === $link->getPrettyConstraint()) {
                 $links[$index] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $prettyVersion);
             }
         }
         $this->{$type} = $links;
     }
     // duplicate self.version provides
     foreach (array('conflicts', 'provides', 'replaces') as $type) {
         $links = $aliasOf->{'get' . ucfirst($type)}();
         $newLinks = array();
         foreach ($links as $link) {
             // link is self.version, but must be replacing also the replaced version
             if ('self.version' === $link->getPrettyConstraint()) {
                 $newLinks[] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $prettyVersion);
             }
         }
         $this->{$type} = array_merge($links, $newLinks);
     }
 }
示例#3
0
 public function __construct($name, $version, $prettyVersion)
 {
     parent::__construct($name);
     $this->version = $version;
     $this->prettyVersion = $prettyVersion;
     $this->stability = VersionParser::parseStability($version);
     $this->dev = $this->stability === 'dev';
 }
示例#4
0
 /**
  * All descendants' constructors should call this parent constructor
  *
  * @param PackageInterface $aliasOf       The package this package is an alias of
  * @param string           $version       The version the alias must report
  * @param string           $prettyVersion The alias's non-normalized version
  */
 public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
 {
     parent::__construct($aliasOf->getName());
     $this->version = $version;
     $this->prettyVersion = $prettyVersion;
     $this->aliasOf = $aliasOf;
     $this->stability = VersionParser::parseStability($version);
     $this->dev = $this->stability === 'dev';
     foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
         $links = $aliasOf->{'get' . ucfirst($type)}();
         $this->{$type} = $this->replaceSelfVersionDependencies($links, $type);
     }
 }