diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 13779d494..85892b9c7 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -69,12 +69,26 @@ class ArrayLoader $package->setRepositories($config['repositories']); } - if (isset($config['extra'])) { + if (isset($config['extra']) && is_array($config['extra'])) { $package->setExtra($config['extra']); } - if (isset($config['license'])) { - $package->setLicense($config['license']); + if (!empty($config['keywords'])) { + $package->setKeywords(is_array($config['keywords']) ? $config['keywords'] : array($config['keywords'])); + + if (!empty($config['license'])) { + $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license'])); + } + + if (!empty($config['time'])) { + try { + $package->setReleaseDate(new \DateTime($config['time'])); + } catch (\Exception $e) { + } + } + + if (!empty($config['authors']) && is_array($config['authors'])) { + $package->setAuthors($config['authors']); } if (isset($config['installation-source'])) { diff --git a/src/Composer/Package/MemoryPackage.php b/src/Composer/Package/MemoryPackage.php index 097c70c42..419688a43 100644 --- a/src/Composer/Package/MemoryPackage.php +++ b/src/Composer/Package/MemoryPackage.php @@ -33,6 +33,9 @@ class MemoryPackage extends BasePackage protected $prettyVersion; protected $repositories; protected $license; + protected $releaseDate; + protected $keywords; + protected $authors; protected $extra = array(); protected $requires = array(); @@ -394,6 +397,60 @@ class MemoryPackage extends BasePackage return $this->suggests; } + /** + * Set the releaseDate + * + * @param DateTime $releaseDate + */ + public function setReleasedate(\DateTime $releaseDate) + { + $this->releaseDate = $releaseDate; + } + + /** + * {@inheritDoc} + */ + public function getReleaseDate() + { + return $this->releaseDate; + } + + /** + * Set the keywords + * + * @param array $keywords + */ + public function setKeywords(array $keywords) + { + $this->keywords = $keywords; + } + + /** + * {@inheritDoc} + */ + public function getKeywords() + { + return $this->keywords; + } + + /** + * Set the authors + * + * @param array $authors + */ + public function setAuthors(array $authors) + { + $this->authors = $authors; + } + + /** + * {@inheritDoc} + */ + public function getAuthors() + { + return $this->authors; + } + /** * Set the autoload mapping * diff --git a/src/Composer/Package/PackageInterface.php b/src/Composer/Package/PackageInterface.php index fad8040cd..f0bc3ae1d 100644 --- a/src/Composer/Package/PackageInterface.php +++ b/src/Composer/Package/PackageInterface.php @@ -259,7 +259,30 @@ interface PackageInterface function getRepository(); /** - * Returns package unique name, constructed from name, version and release type. + * Returns the release date of the package + * + * @return DateTime + */ + function getReleaseDate(); + + /** + * Returns an array of keywords relating to the package + * + * @return array + */ + function getKeywords(); + + /** + * Returns an array of authors of the package + * + * Each item can contain name/homepage/email keys + * + * @return array + */ + function getAuthors(); + + /** + * Returns package unique name, constructed from name and version. * * @return string */