From 69f1de99861e1ee336a7cd08b22a79166bbd7e8e Mon Sep 17 00:00:00 2001 From: everzet Date: Sat, 24 Sep 2011 02:11:32 +0300 Subject: [PATCH] Enhanced PackageInterface and BasePackage with getUniqueName() method, which provides name-version-releaseType string (used in installer registry) --- src/Composer/Package/BasePackage.php | 12 +++++++++++- src/Composer/Package/PackageInterface.php | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index ddeaf65b3..1caaf3ba8 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -134,6 +134,16 @@ abstract class BasePackage implements PackageInterface $this->repository = $repository; } + /** + * Returns package unique name, constructed from name, version and release type. + * + * @return string + */ + public function getUniqueName() + { + return $this->getName().'-'.$this->getVersion().'-'.$this->getReleaseType(); + } + /** * Converts the package into a readable and unique string * @@ -141,6 +151,6 @@ abstract class BasePackage implements PackageInterface */ public function __toString() { - return $this->getName().'-'.$this->getVersion().'-'.$this->getReleaseType(); + return $this->getUniqueName(); } } diff --git a/src/Composer/Package/PackageInterface.php b/src/Composer/Package/PackageInterface.php index 3fdefc78d..47b81814c 100644 --- a/src/Composer/Package/PackageInterface.php +++ b/src/Composer/Package/PackageInterface.php @@ -200,6 +200,13 @@ interface PackageInterface */ function getRepository(); + /** + * Returns package unique name, constructed from name, version and release type. + * + * @return string + */ + function getUniqueName(); + /** * Converts the package into a readable and unique string *