1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-06 19:40:08 +02:00

🐛 Empty byte count now returns a warning symbol

This commit is contained in:
2023-05-19 11:49:50 +02:00
parent 2848b4dcd2
commit 326e5c58e2

View File

@ -129,9 +129,18 @@ class ActivePhpInstallation {
return ""
}
if value.isEmpty {
return "⚠️"
}
// Check if the syntax is valid otherwise
let regex = try! NSRegularExpression(pattern: #"^([0-9]*)(K|M|G|)$"#, options: [])
let match = regex.matches(in: value, options: [], range: NSRange(location: 0, length: value.count)).first
let match = regex.matches(
in: value, options: [],
range: NSRange(location: 0, length: value.count)
).first
return (match == nil) ? "⚠️" : "\(value)B"
}