/**
  * String representation of this Version
  *
  * @return string
  **/
 public function __toString()
 {
     $string = parent::__toString();
     // Add pre-release
     if ($this->hasPreRelease()) {
         $string .= '-' . $this->getPreRelease();
     }
     // Add build
     if ($this->hasBuild()) {
         $string .= '+' . $this->getBuild();
     }
     return $string;
 }
Exemple #2
0
 /**
  * Compare two Versionable objects
  *
  * Returns true if they are equal
  *
  * @param  Versionable $v1
  * @param  Versionable $v2
  * @return bool
  **/
 private static function versionableEquals(Versionable $v1, Versionable $v2)
 {
     if ($v1->getMajor() !== $v2->getMajor()) {
         return false;
     }
     if ($v1->getMinor() !== $v2->getMinor()) {
         return false;
     }
     if ($v1->getPatch() !== $v2->getPatch()) {
         return false;
     }
     return true;
 }