1
0
Fork 0

Minor cleanups, add license property to the PackageInterface

pull/1/head
Jordi Boggiano 2011-04-17 22:13:08 +02:00
parent 8ab98a8b5d
commit f0e709ad09
3 changed files with 30 additions and 7 deletions

View File

@ -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;
}
/**

View File

@ -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
*

View File

@ -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