Removed unused \ncc\Utilities > Functions > convertToSemver()

This commit is contained in:
Netkas 2023-10-08 12:23:47 -04:00
parent 3f67344a60
commit 6388b27b7a
No known key found for this signature in database
GPG key ID: 5DAF58535614062B

View file

@ -415,53 +415,6 @@
return (new ConfigurationManager())->getProperty($property); 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 * Attempts to cast the correct type of the given value
* *