From f0e709ad09a7799326d8d98fb83a1fca63e3896b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 17 Apr 2011 22:13:08 +0200 Subject: [PATCH] Minor cleanups, add license property to the PackageInterface --- src/Composer/Package/BasePackage.php | 2 -- src/Composer/Package/MemoryPackage.php | 26 +++++++++++++++++++---- src/Composer/Package/PackageInterface.php | 9 +++++++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index 9991a80c6..54dbd5748 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -22,7 +22,6 @@ use Composer\DependencyResolver\RelationConstraint\RelationConstraintInterface; abstract class BasePackage implements PackageInterface { protected $name; - protected $id; /** * All descendents' constructors should call this parent constructor @@ -32,7 +31,6 @@ abstract class BasePackage implements PackageInterface public function __construct($name) { $this->name = $name; - } /** diff --git a/src/Composer/Package/MemoryPackage.php b/src/Composer/Package/MemoryPackage.php index e326210b2..8e7cd0329 100644 --- a/src/Composer/Package/MemoryPackage.php +++ b/src/Composer/Package/MemoryPackage.php @@ -24,6 +24,7 @@ class MemoryPackage extends BasePackage protected $repositoryUrl; protected $releaseType; protected $version; + protected $license; protected $requires = array(); protected $conflicts = array(); @@ -37,12 +38,11 @@ class MemoryPackage extends BasePackage * * @param string $name The package's name * @param string $version The package's version - * @param string $releaseType The package's release type (beta/rc/stable) - * @param int $id A positive unique id, zero to auto generate + * @param string $releaseType The package's release type (beta/rc/stable/dev) */ - public function __construct($name, $version, $releaseType = 'stable', $id = 0) + public function __construct($name, $version, $releaseType = 'stable') { - parent::__construct($name, $id); + parent::__construct($name); $this->releaseType = $releaseType; $this->version = $version; @@ -132,6 +132,24 @@ class MemoryPackage extends BasePackage return $this->version; } + /** + * Set the license + * + * @param string $license + */ + public function setLicense($license) + { + $this->license = $license; + } + + /** + * {@inheritDoc} + */ + public function getLicense() + { + return $this->license; + } + /** * Set the required packages * diff --git a/src/Composer/Package/PackageInterface.php b/src/Composer/Package/PackageInterface.php index e01e1918d..08c1eb39d 100644 --- a/src/Composer/Package/PackageInterface.php +++ b/src/Composer/Package/PackageInterface.php @@ -47,7 +47,7 @@ interface PackageInterface function matches($name, RelationConstraintInterface $constraint); /** - * Returns the package type of this package, e.g. library + * Returns the package type, e.g. library * * @return string The package type */ @@ -81,6 +81,13 @@ interface PackageInterface */ function getVersion(); + /** + * Returns the package license, e.g. MIT, BSD, GPL + * + * @return string The package license + */ + function getLicense(); + /** * Returns a set of relations to packages which need to be installed before * this package can be installed