for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of questocat/version-comparator package.
*
* (c) questocat <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Questocat\VersionComparator;
class Version
{
/**
* The major version number.
* @var int
protected $major = 0;
* The minor version number.
protected $minor = 0;
* The patch number.
protected $patch = 0;
* The pre-release version number.
* @var array
protected $preRelease = [];
* The build metadata identifiers.
protected $buildMetadata = [];
* Get major.
* @return int
public function getMajor()
return $this->major;
}
* Get minor.
public function getMinor()
return $this->minor;
* Get patch.
public function getPatch()
return $this->patch;
* Get preRelease.
* @return array
public function getPreRelease()
return $this->preRelease;
* Get buildMetadata.
public function getBuildMetadata()
return $this->buildMetadata;
* Map the given array onto the version's properties.
* @param array $attributes
* @return $this
public function map(array $attributes)
foreach ($attributes as $key => $value) {
$this->{$key} = $value;
return $this;
* Checks if the version number is stable.
* @return bool
public function isStable()
return empty($this->preRelease) && 0 !== $this->major;