diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 69d67b5e3..146522ec3 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -65,6 +65,7 @@ class ArrayLoader } $package->setSourceType($config['source']['type']); $package->setSourceUrl($config['source']['url']); + $package->setSourceReference($config['source']['reference']); } if (isset($config['dist'])) { @@ -79,6 +80,7 @@ class ArrayLoader } $package->setDistType($config['dist']['type']); $package->setDistUrl($config['dist']['url']); + $package->setDistReference($config['dist']['reference']); $package->setDistSha1Checksum($config['dist']['shasum']); } diff --git a/src/Composer/Package/MemoryPackage.php b/src/Composer/Package/MemoryPackage.php index 535b73eb1..eb9f644fd 100644 --- a/src/Composer/Package/MemoryPackage.php +++ b/src/Composer/Package/MemoryPackage.php @@ -23,8 +23,10 @@ class MemoryPackage extends BasePackage protected $installationSource; protected $sourceType; protected $sourceUrl; + protected $sourceReference; protected $distType; protected $distUrl; + protected $distReference; protected $distSha1Checksum; protected $releaseType; protected $version; @@ -133,6 +135,22 @@ class MemoryPackage extends BasePackage return $this->sourceUrl; } + /** + * @param string $reference + */ + public function setSourceReference($reference) + { + $this->sourceReference = $reference; + } + + /** + * {@inheritDoc} + */ + public function getSourceReference() + { + return $this->sourceReference; + } + /** * @param string $type */ @@ -165,6 +183,22 @@ class MemoryPackage extends BasePackage return $this->distUrl; } + /** + * @param string $reference + */ + public function setDistReference($reference) + { + $this->distReference = $reference; + } + + /** + * {@inheritDoc} + */ + public function getDistReference() + { + return $this->distReference; + } + /** * @param string $url */ diff --git a/src/Composer/Package/PackageInterface.php b/src/Composer/Package/PackageInterface.php index ed7c08bf4..54750d907 100644 --- a/src/Composer/Package/PackageInterface.php +++ b/src/Composer/Package/PackageInterface.php @@ -110,6 +110,13 @@ interface PackageInterface */ function getSourceUrl(); + /** + * Returns the repository reference of this package, e.g. master, 1.0.0 or a commit hash for git + * + * @return string The repository reference + */ + function getSourceReference(); + /** * Returns the type of the distribution archive of this version, e.g. zip, tarball * @@ -124,6 +131,13 @@ interface PackageInterface */ function getDistUrl(); + /** + * Returns the reference of the distribution archive of this version, e.g. master, 1.0.0 or a commit hash for git + * + * @return string + */ + function getDistReference(); + /** * Returns the sha1 checksum for the distribution archive of this version *