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 $releaseType;
protected $version; protected $version;
protected $license; protected $license;
protected $extra = array();
protected $requires = array(); protected $requires = array();
protected $conflicts = array(); protected $conflicts = array();
@ -67,6 +68,22 @@ class MemoryPackage extends BasePackage
return $this->type ?: 'library'; 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 * @param string $type
*/ */

View File

@ -38,17 +38,17 @@ interface PackageInterface
function getNames(); function getNames();
/** /**
* Allows the solver to set an id for this package to refer to it. * Allows the solver to set an id for this package to refer to it.
* *
* @param int $id * @param int $id
*/ */
function setId($id); function setId($id);
/** /**
* Retrieves the package's id set through setId * Retrieves the package's id set through setId
* *
* @return int The previously set package id * @return int The previously set package id
*/ */
function getId(); function getId();
/** /**
@ -68,6 +68,13 @@ interface PackageInterface
*/ */
function getType(); 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 * 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->setDistUrl($rev['dist']['url']);
$package->setDistSha1Checksum($rev['dist']['shasum']); $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'])) { if (isset($rev['license'])) {
$package->setLicense($rev['license']); $package->setLicense($rev['license']);
} }