Removed unused \ncc\Utilities > Functions > convertToSemver()
This commit is contained in:
parent
3f67344a60
commit
6388b27b7a
1 changed files with 0 additions and 47 deletions
|
@ -415,53 +415,6 @@
|
|||
return (new ConfigurationManager())->getProperty($property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to convert a weird version number to a standard version number
|
||||
*
|
||||
* @param $version
|
||||
* @return string
|
||||
*/
|
||||
public static function convertToSemVer($version): string
|
||||
{
|
||||
if(stripos(strtolower($version), 'v') === 0)
|
||||
{
|
||||
$version = substr($version, 1);
|
||||
}
|
||||
|
||||
if(!Validate::version($version))
|
||||
{
|
||||
$parts = explode('.', $version);
|
||||
$major = (string)null;
|
||||
$minor = (string)null;
|
||||
$patch = (string)null;
|
||||
|
||||
if(count($parts) >= 1)
|
||||
{
|
||||
$major = $parts[0];
|
||||
}
|
||||
|
||||
if(count($parts) >= 2)
|
||||
{
|
||||
$minor = $parts[1];
|
||||
}
|
||||
|
||||
if(count($parts) >= 3)
|
||||
{
|
||||
$patch = $parts[2];
|
||||
}
|
||||
|
||||
// Assemble the SemVer compatible string
|
||||
$version = "$major.$minor.$patch";
|
||||
}
|
||||
|
||||
if(!Validate::version($version))
|
||||
{
|
||||
return '1.0.0';
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to cast the correct type of the given value
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue