|
@@ -13,8 +13,9 @@
|
|
|
namespace Packagist\WebBundle\Entity;
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
-use Composer\Package\Version\VersionParser;
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
+use Doctrine\Common\Collections\ArrayCollection;
|
|
|
+use Composer\Package\Version\VersionParser;
|
|
|
|
|
|
/**
|
|
|
* @ORM\Entity(repositoryClass="Packagist\WebBundle\Entity\VersionRepository")
|
|
@@ -193,14 +194,14 @@ class Version
|
|
|
|
|
|
public function __construct()
|
|
|
{
|
|
|
- $this->tags = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
- $this->require = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
- $this->replace = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
- $this->conflict = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
- $this->provide = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
- $this->devRequire = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
- $this->suggest = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
- $this->authors = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
+ $this->tags = new ArrayCollection();
|
|
|
+ $this->require = new ArrayCollection();
|
|
|
+ $this->replace = new ArrayCollection();
|
|
|
+ $this->conflict = new ArrayCollection();
|
|
|
+ $this->provide = new ArrayCollection();
|
|
|
+ $this->devRequire = new ArrayCollection();
|
|
|
+ $this->suggest = new ArrayCollection();
|
|
|
+ $this->authors = new ArrayCollection();
|
|
|
$this->createdAt = new \DateTime;
|
|
|
$this->updatedAt = new \DateTime;
|
|
|
}
|
|
@@ -209,10 +210,12 @@ class Version
|
|
|
{
|
|
|
$tags = array();
|
|
|
foreach ($this->getTags() as $tag) {
|
|
|
+ /** @var $tag Tag */
|
|
|
$tags[] = $tag->getName();
|
|
|
}
|
|
|
$authors = array();
|
|
|
foreach ($this->getAuthors() as $author) {
|
|
|
+ /** @var $author Author */
|
|
|
$authors[] = $author->toArray();
|
|
|
}
|
|
|
|
|
@@ -307,7 +310,7 @@ class Version
|
|
|
/**
|
|
|
* Get description
|
|
|
*
|
|
|
- * @return text $description
|
|
|
+ * @return string $description
|
|
|
*/
|
|
|
public function getDescription()
|
|
|
{
|
|
@@ -377,7 +380,7 @@ class Version
|
|
|
/**
|
|
|
* Set license
|
|
|
*
|
|
|
- * @param string $license
|
|
|
+ * @param array $license
|
|
|
*/
|
|
|
public function setLicense(array $license)
|
|
|
{
|
|
@@ -407,7 +410,7 @@ class Version
|
|
|
/**
|
|
|
* Get source
|
|
|
*
|
|
|
- * @return text $source
|
|
|
+ * @return array $source
|
|
|
*/
|
|
|
public function getSource()
|
|
|
{
|
|
@@ -427,7 +430,7 @@ class Version
|
|
|
/**
|
|
|
* Get dist
|
|
|
*
|
|
|
- * @return text
|
|
|
+ * @return array
|
|
|
*/
|
|
|
public function getDist()
|
|
|
{
|
|
@@ -447,7 +450,7 @@ class Version
|
|
|
/**
|
|
|
* Get autoload
|
|
|
*
|
|
|
- * @return text
|
|
|
+ * @return array
|
|
|
*/
|
|
|
public function getAutoload()
|
|
|
{
|
|
@@ -467,7 +470,7 @@ class Version
|
|
|
/**
|
|
|
* Get binaries
|
|
|
*
|
|
|
- * @return text
|
|
|
+ * @return array
|
|
|
*/
|
|
|
public function getBinaries()
|
|
|
{
|
|
@@ -517,7 +520,7 @@ class Version
|
|
|
/**
|
|
|
* Set createdAt
|
|
|
*
|
|
|
- * @param datetime $createdAt
|
|
|
+ * @param \DateTime $createdAt
|
|
|
*/
|
|
|
public function setCreatedAt($createdAt)
|
|
|
{
|
|
@@ -527,7 +530,7 @@ class Version
|
|
|
/**
|
|
|
* Get createdAt
|
|
|
*
|
|
|
- * @return datetime $createdAt
|
|
|
+ * @return \DateTime $createdAt
|
|
|
*/
|
|
|
public function getCreatedAt()
|
|
|
{
|
|
@@ -537,7 +540,7 @@ class Version
|
|
|
/**
|
|
|
* Set releasedAt
|
|
|
*
|
|
|
- * @param datetime $releasedAt
|
|
|
+ * @param \DateTime $releasedAt
|
|
|
*/
|
|
|
public function setReleasedAt($releasedAt)
|
|
|
{
|
|
@@ -547,7 +550,7 @@ class Version
|
|
|
/**
|
|
|
* Get releasedAt
|
|
|
*
|
|
|
- * @return datetime $releasedAt
|
|
|
+ * @return \DateTime $releasedAt
|
|
|
*/
|
|
|
public function getReleasedAt()
|
|
|
{
|
|
@@ -557,7 +560,7 @@ class Version
|
|
|
/**
|
|
|
* Set package
|
|
|
*
|
|
|
- * @param Packagist\WebBundle\Entity\Package $package
|
|
|
+ * @param \Packagist\WebBundle\Entity\Package $package
|
|
|
*/
|
|
|
public function setPackage(Package $package)
|
|
|
{
|
|
@@ -567,7 +570,7 @@ class Version
|
|
|
/**
|
|
|
* Get package
|
|
|
*
|
|
|
- * @return Packagist\WebBundle\Entity\Package $package
|
|
|
+ * @return \Packagist\WebBundle\Entity\Package $package
|
|
|
*/
|
|
|
public function getPackage()
|
|
|
{
|
|
@@ -577,7 +580,7 @@ class Version
|
|
|
/**
|
|
|
* Get tags
|
|
|
*
|
|
|
- * @return Doctrine\Common\Collections\Collection $tags
|
|
|
+ * @return \Doctrine\Common\Collections\Collection $tags
|
|
|
*/
|
|
|
public function getTags()
|
|
|
{
|
|
@@ -587,7 +590,7 @@ class Version
|
|
|
/**
|
|
|
* Set updatedAt
|
|
|
*
|
|
|
- * @param datetime $updatedAt
|
|
|
+ * @param \DateTime $updatedAt
|
|
|
*/
|
|
|
public function setUpdatedAt($updatedAt)
|
|
|
{
|
|
@@ -597,7 +600,7 @@ class Version
|
|
|
/**
|
|
|
* Get updatedAt
|
|
|
*
|
|
|
- * @return datetime $updatedAt
|
|
|
+ * @return \DateTime $updatedAt
|
|
|
*/
|
|
|
public function getUpdatedAt()
|
|
|
{
|
|
@@ -607,7 +610,7 @@ class Version
|
|
|
/**
|
|
|
* Get authors
|
|
|
*
|
|
|
- * @return Doctrine\Common\Collections\Collection
|
|
|
+ * @return \Doctrine\Common\Collections\Collection
|
|
|
*/
|
|
|
public function getAuthors()
|
|
|
{
|
|
@@ -703,29 +706,29 @@ class Version
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Add tags
|
|
|
+ * Add tag
|
|
|
*
|
|
|
- * @param Packagist\WebBundle\Entity\Tag $tags
|
|
|
+ * @param \Packagist\WebBundle\Entity\Tag $tag
|
|
|
*/
|
|
|
- public function addTag(\Packagist\WebBundle\Entity\Tag $tags)
|
|
|
+ public function addTag(Tag $tag)
|
|
|
{
|
|
|
- $this->tags[] = $tags;
|
|
|
+ $this->tags[] = $tag;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Add authors
|
|
|
*
|
|
|
- * @param Packagist\WebBundle\Entity\Author $authors
|
|
|
+ * @param \Packagist\WebBundle\Entity\Author $author
|
|
|
*/
|
|
|
- public function addAuthor(\Packagist\WebBundle\Entity\Author $authors)
|
|
|
+ public function addAuthor(Author $author)
|
|
|
{
|
|
|
- $this->authors[] = $authors;
|
|
|
+ $this->authors[] = $author;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Add require
|
|
|
*
|
|
|
- * @param Packagist\WebBundle\Entity\RequireLink $require
|
|
|
+ * @param \Packagist\WebBundle\Entity\RequireLink $require
|
|
|
*/
|
|
|
public function addRequireLink(RequireLink $require)
|
|
|
{
|
|
@@ -735,7 +738,7 @@ class Version
|
|
|
/**
|
|
|
* Get require
|
|
|
*
|
|
|
- * @return Doctrine\Common\Collections\Collection
|
|
|
+ * @return \Doctrine\Common\Collections\Collection
|
|
|
*/
|
|
|
public function getRequire()
|
|
|
{
|
|
@@ -745,7 +748,7 @@ class Version
|
|
|
/**
|
|
|
* Add replace
|
|
|
*
|
|
|
- * @param Packagist\WebBundle\Entity\ReplaceLink $replace
|
|
|
+ * @param \Packagist\WebBundle\Entity\ReplaceLink $replace
|
|
|
*/
|
|
|
public function addReplaceLink(ReplaceLink $replace)
|
|
|
{
|
|
@@ -755,7 +758,7 @@ class Version
|
|
|
/**
|
|
|
* Get replace
|
|
|
*
|
|
|
- * @return Doctrine\Common\Collections\Collection
|
|
|
+ * @return \Doctrine\Common\Collections\Collection
|
|
|
*/
|
|
|
public function getReplace()
|
|
|
{
|
|
@@ -765,7 +768,7 @@ class Version
|
|
|
/**
|
|
|
* Add conflict
|
|
|
*
|
|
|
- * @param Packagist\WebBundle\Entity\ConflictLink $conflict
|
|
|
+ * @param \Packagist\WebBundle\Entity\ConflictLink $conflict
|
|
|
*/
|
|
|
public function addConflictLink(ConflictLink $conflict)
|
|
|
{
|
|
@@ -775,7 +778,7 @@ class Version
|
|
|
/**
|
|
|
* Get conflict
|
|
|
*
|
|
|
- * @return Doctrine\Common\Collections\Collection
|
|
|
+ * @return \Doctrine\Common\Collections\Collection
|
|
|
*/
|
|
|
public function getConflict()
|
|
|
{
|
|
@@ -785,7 +788,7 @@ class Version
|
|
|
/**
|
|
|
* Add provide
|
|
|
*
|
|
|
- * @param Packagist\WebBundle\Entity\ProvideLink $provide
|
|
|
+ * @param \Packagist\WebBundle\Entity\ProvideLink $provide
|
|
|
*/
|
|
|
public function addProvideLink(ProvideLink $provide)
|
|
|
{
|
|
@@ -795,7 +798,7 @@ class Version
|
|
|
/**
|
|
|
* Get provide
|
|
|
*
|
|
|
- * @return Doctrine\Common\Collections\Collection
|
|
|
+ * @return \Doctrine\Common\Collections\Collection
|
|
|
*/
|
|
|
public function getProvide()
|
|
|
{
|
|
@@ -805,7 +808,7 @@ class Version
|
|
|
/**
|
|
|
* Add devRequire
|
|
|
*
|
|
|
- * @param Packagist\WebBundle\Entity\DevRequireLink $devRequire
|
|
|
+ * @param \Packagist\WebBundle\Entity\DevRequireLink $devRequire
|
|
|
*/
|
|
|
public function addDevRequireLink(DevRequireLink $devRequire)
|
|
|
{
|
|
@@ -815,7 +818,7 @@ class Version
|
|
|
/**
|
|
|
* Get devRequire
|
|
|
*
|
|
|
- * @return Doctrine\Common\Collections\Collection
|
|
|
+ * @return \Doctrine\Common\Collections\Collection
|
|
|
*/
|
|
|
public function getDevRequire()
|
|
|
{
|
|
@@ -825,7 +828,7 @@ class Version
|
|
|
/**
|
|
|
* Add suggest
|
|
|
*
|
|
|
- * @param Packagist\WebBundle\Entity\SuggestLink $suggest
|
|
|
+ * @param \Packagist\WebBundle\Entity\SuggestLink $suggest
|
|
|
*/
|
|
|
public function addSuggestLink(SuggestLink $suggest)
|
|
|
{
|
|
@@ -835,7 +838,7 @@ class Version
|
|
|
/**
|
|
|
* Get suggest
|
|
|
*
|
|
|
- * @return Doctrine\Common\Collections\Collection
|
|
|
+ * @return \Doctrine\Common\Collections\Collection
|
|
|
*/
|
|
|
public function getSuggest()
|
|
|
{
|
|
@@ -862,6 +865,8 @@ class Version
|
|
|
$version = $parser->normalizeBranch(str_replace('-dev', '', $extra['branch-alias'][$this->getVersion()]));
|
|
|
return preg_replace('{(\.9{7})+}', '.x', $version);
|
|
|
}
|
|
|
+
|
|
|
+ return '';
|
|
|
}
|
|
|
|
|
|
public function __toString()
|