123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <?php
- namespace Composer\Package;
- use Composer\Package\LinkConstraint\LinkConstraintInterface;
- use Composer\Package\LinkConstraint\VersionConstraint;
- use Composer\Repository\RepositoryInterface;
- use Composer\Repository\PlatformRepository;
- use Composer\Package\Version\VersionParser;
- class AliasPackage extends BasePackage
- {
- protected $version;
- protected $prettyVersion;
- protected $dev;
- protected $aliasOf;
- protected $rootPackageAlias = false;
- protected $requires;
- protected $conflicts;
- protected $provides;
- protected $replaces;
- protected $recommends;
- protected $suggests;
-
- public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
- {
- parent::__construct($aliasOf->getName());
- $this->version = $version;
- $this->prettyVersion = $prettyVersion;
- $this->aliasOf = $aliasOf;
- $this->dev = VersionParser::isDev($version);
-
- foreach (array('requires', 'devRequires') as $type) {
- $links = $aliasOf->{'get'.ucfirst($type)}();
- foreach ($links as $index => $link) {
-
- if ('self.version' === $link->getPrettyConstraint()) {
- $links[$index] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $this->version);
- }
- }
- $this->$type = $links;
- }
-
- foreach (array('conflicts', 'provides', 'replaces') as $type) {
- $links = $aliasOf->{'get'.ucfirst($type)}();
- $newLinks = array();
- foreach ($links as $link) {
-
- if ('self.version' === $link->getPrettyConstraint()) {
- $newLinks[] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $this->version);
- }
- }
- $this->$type = array_merge($links, $newLinks);
- }
- }
- public function getAliasOf()
- {
- return $this->aliasOf;
- }
-
- public function getVersion()
- {
- return $this->version;
- }
-
- public function getPrettyVersion()
- {
- return $this->prettyVersion;
- }
-
- public function isDev()
- {
- return $this->dev;
- }
-
- public function getRequires()
- {
- return $this->requires;
- }
-
- public function getConflicts()
- {
- return $this->conflicts;
- }
-
- public function getProvides()
- {
- return $this->provides;
- }
-
- public function getReplaces()
- {
- return $this->replaces;
- }
-
- public function getDevRequires()
- {
- return $this->devRequires;
- }
-
- public function setRootPackageAlias($value)
- {
- return $this->rootPackageAlias = $value;
- }
-
- public function isRootPackageAlias()
- {
- return $this->rootPackageAlias;
- }
-
- public function getAlias()
- {
- return '';
- }
-
- public function getPrettyAlias()
- {
- return '';
- }
-
- public function getType()
- {
- return $this->aliasOf->getType();
- }
- public function getTargetDir()
- {
- return $this->aliasOf->getTargetDir();
- }
- public function getExtra()
- {
- return $this->aliasOf->getExtra();
- }
- public function setInstallationSource($type)
- {
- $this->aliasOf->setInstallationSource($type);
- }
- public function getInstallationSource()
- {
- return $this->aliasOf->getInstallationSource();
- }
- public function getSourceType()
- {
- return $this->aliasOf->getSourceType();
- }
- public function getSourceUrl()
- {
- return $this->aliasOf->getSourceUrl();
- }
- public function getSourceReference()
- {
- return $this->aliasOf->getSourceReference();
- }
- public function setSourceReference($reference)
- {
- return $this->aliasOf->setSourceReference($reference);
- }
- public function getDistType()
- {
- return $this->aliasOf->getDistType();
- }
- public function getDistUrl()
- {
- return $this->aliasOf->getDistUrl();
- }
- public function getDistReference()
- {
- return $this->aliasOf->getDistReference();
- }
- public function getDistSha1Checksum()
- {
- return $this->aliasOf->getDistSha1Checksum();
- }
- public function getScripts()
- {
- return $this->aliasOf->getScripts();
- }
- public function setAliases(array $aliases)
- {
- return $this->aliasOf->setAliases($aliases);
- }
- public function getAliases()
- {
- return $this->aliasOf->getAliases();
- }
- public function getLicense()
- {
- return $this->aliasOf->getLicense();
- }
- public function getAutoload()
- {
- return $this->aliasOf->getAutoload();
- }
- public function getIncludePaths()
- {
- return $this->aliasOf->getIncludePaths();
- }
- public function getRepositories()
- {
- return $this->aliasOf->getRepositories();
- }
- public function getReleaseDate()
- {
- return $this->aliasOf->getReleaseDate();
- }
- public function getBinaries()
- {
- return $this->aliasOf->getBinaries();
- }
- public function getKeywords()
- {
- return $this->aliasOf->getKeywords();
- }
- public function getDescription()
- {
- return $this->aliasOf->getDescription();
- }
- public function getHomepage()
- {
- return $this->aliasOf->getHomepage();
- }
- public function getSuggests()
- {
- return $this->aliasOf->getSuggests();
- }
- public function getAuthors()
- {
- return $this->aliasOf->getAuthors();
- }
- public function __toString()
- {
- return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
- }
- }
|