Drop .0 or .0.0 from version for display
This commit is contained in:
@@ -3,6 +3,22 @@
|
||||
/** The current Feed Reader Central version */
|
||||
const FRC_VERSION = '1.0.0-alpha7';
|
||||
|
||||
/**
|
||||
* Drop .0 or .0.0 from the end of the version to format it for display
|
||||
*
|
||||
* @return string The version of the application for user display
|
||||
*/
|
||||
function display_version(): string {
|
||||
[$major, $minor, $rev] = explode('.', FRC_VERSION);
|
||||
$minor = $minor == '0' ? '' : ".$minor";
|
||||
$rev = match (true) {
|
||||
$rev == '0' => '',
|
||||
str_starts_with($rev, '0-') => substr($rev, 1),
|
||||
default => ".$rev"
|
||||
};
|
||||
return "v$major$minor$rev";
|
||||
}
|
||||
|
||||
spl_autoload_register(function ($class) {
|
||||
$file = implode(DIRECTORY_SEPARATOR, [__DIR__, 'lib', "$class.php"]);
|
||||
if (file_exists($file)) {
|
||||
|
||||
Reference in New Issue
Block a user