1
0
Fork 0

Add extra and type info to packages

pull/9/head
Jordi Boggiano 2011-08-21 13:11:42 +02:00
parent 4dbb73daba
commit ba9f12a517
3 changed files with 40 additions and 8 deletions

View File

@ -28,6 +28,7 @@ class MemoryPackage extends BasePackage
protected $releaseType;
protected $version;
protected $license;
protected $extra = array();
protected $requires = array();
protected $conflicts = array();
@ -67,6 +68,22 @@ class MemoryPackage extends BasePackage
return $this->type ?: 'library';
}
/**
* @param array $extra
*/
public function setExtra(array $extra)
{
$this->extra = $extra;
}
/**
* {@inheritDoc}
*/
public function getExtra()
{
return $this->extra;
}
/**
* @param string $type
*/

View File

@ -38,17 +38,17 @@ interface PackageInterface
function getNames();
/**
* Allows the solver to set an id for this package to refer to it.
*
* @param int $id
*/
* Allows the solver to set an id for this package to refer to it.
*
* @param int $id
*/
function setId($id);
/**
* Retrieves the package's id set through setId
*
* @return int The previously set package id
*/
* Retrieves the package's id set through setId
*
* @return int The previously set package id
*/
function getId();
/**
@ -68,6 +68,13 @@ interface PackageInterface
*/
function getType();
/**
* Returns the package extra data
*
* @return array The package extra data
*/
function getExtra();
/**
* Returns the repository type of this package, e.g. git, svn
*

View File

@ -55,6 +55,14 @@ class ComposerRepository extends ArrayRepository
$package->setDistUrl($rev['dist']['url']);
$package->setDistSha1Checksum($rev['dist']['shasum']);
if (isset($rev['type'])) {
$package->setType($rev['type']);
}
if (isset($rev['extra'])) {
$package->setExtra($rev['extra']);
}
if (isset($rev['license'])) {
$package->setLicense($rev['license']);
}