/usr/share/php/Composer/Package/AliasPackage.php is in composer 1.6.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Package;
use Composer\Semver\Constraint\Constraint;
use Composer\Package\Version\VersionParser;
/**
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class AliasPackage extends BasePackage implements CompletePackageInterface
{
protected $version;
protected $prettyVersion;
protected $dev;
protected $rootPackageAlias = false;
protected $stability;
/** @var PackageInterface */
protected $aliasOf;
/** @var Link[] */
protected $requires;
/** @var Link[] */
protected $devRequires;
/** @var Link[] */
protected $conflicts;
/** @var Link[] */
protected $provides;
/** @var Link[] */
protected $replaces;
/**
* 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);
}
}
/**
* @return PackageInterface
*/
public function getAliasOf()
{
return $this->aliasOf;
}
/**
* {@inheritDoc}
*/
public function getVersion()
{
return $this->version;
}
/**
* {@inheritDoc}
*/
public function getStability()
{
return $this->stability;
}
/**
* {@inheritDoc}
*/
public function getPrettyVersion()
{
return $this->prettyVersion;
}
/**
* {@inheritDoc}
*/
public function isDev()
{
return $this->dev;
}
/**
* {@inheritDoc}
*/
public function getRequires()
{
return $this->requires;
}
/**
* {@inheritDoc}
*/
public function getConflicts()
{
return $this->conflicts;
}
/**
* {@inheritDoc}
*/
public function getProvides()
{
return $this->provides;
}
/**
* {@inheritDoc}
*/
public function getReplaces()
{
return $this->replaces;
}
/**
* {@inheritDoc}
*/
public function getDevRequires()
{
return $this->devRequires;
}
/**
* Stores whether this is an alias created by an aliasing in the requirements of the root package or not
*
* Use by the policy for sorting manually aliased packages first, see #576
*
* @param bool $value
*
* @return mixed
*/
public function setRootPackageAlias($value)
{
return $this->rootPackageAlias = $value;
}
/**
* @see setRootPackageAlias
* @return bool
*/
public function isRootPackageAlias()
{
return $this->rootPackageAlias;
}
/**
* @param Link[] $links
* @param string $linkType
*
* @return Link[]
*/
protected function replaceSelfVersionDependencies(array $links, $linkType)
{
if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
$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 Constraint('=', $this->version), $linkType, $this->prettyVersion);
}
}
$links = array_merge($links, $newLinks);
} else {
foreach ($links as $index => $link) {
if ('self.version' === $link->getPrettyConstraint()) {
$links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
}
}
}
return $links;
}
/***************************************
* Wrappers around the aliased package *
***************************************/
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 getSourceUrls()
{
return $this->aliasOf->getSourceUrls();
}
public function getSourceReference()
{
return $this->aliasOf->getSourceReference();
}
public function setSourceReference($reference)
{
return $this->aliasOf->setSourceReference($reference);
}
public function setSourceMirrors($mirrors)
{
return $this->aliasOf->setSourceMirrors($mirrors);
}
public function getSourceMirrors()
{
return $this->aliasOf->getSourceMirrors();
}
public function getDistType()
{
return $this->aliasOf->getDistType();
}
public function getDistUrl()
{
return $this->aliasOf->getDistUrl();
}
public function getDistUrls()
{
return $this->aliasOf->getDistUrls();
}
public function getDistReference()
{
return $this->aliasOf->getDistReference();
}
public function setDistReference($reference)
{
return $this->aliasOf->setDistReference($reference);
}
public function getDistSha1Checksum()
{
return $this->aliasOf->getDistSha1Checksum();
}
public function setTransportOptions(array $options)
{
return $this->aliasOf->setTransportOptions($options);
}
public function getTransportOptions()
{
return $this->aliasOf->getTransportOptions();
}
public function setDistMirrors($mirrors)
{
return $this->aliasOf->setDistMirrors($mirrors);
}
public function getDistMirrors()
{
return $this->aliasOf->getDistMirrors();
}
public function getScripts()
{
return $this->aliasOf->getScripts();
}
public function getLicense()
{
return $this->aliasOf->getLicense();
}
public function getAutoload()
{
return $this->aliasOf->getAutoload();
}
public function getDevAutoload()
{
return $this->aliasOf->getDevAutoload();
}
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 getSupport()
{
return $this->aliasOf->getSupport();
}
public function getNotificationUrl()
{
return $this->aliasOf->getNotificationUrl();
}
public function getArchiveExcludes()
{
return $this->aliasOf->getArchiveExcludes();
}
public function isAbandoned()
{
return $this->aliasOf->isAbandoned();
}
public function getReplacementPackage()
{
return $this->aliasOf->getReplacementPackage();
}
public function __toString()
{
return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
}
}
|