Refactor checkLogLevel to correctly utilize LogLevel cases

This commit is contained in:
netkas 2024-09-17 15:29:03 -04:00
parent dfa6b50299
commit aa65dd73cf

View file

@ -228,13 +228,9 @@ namespace ncc\Utilities;
*/
public static function checkLogLevel(string $input): bool
{
// TODO: Fix this, it's not the proper use of cases()
if(!in_array(strtolower($input), LogLevel::cases()))
{
return false;
}
return true;
return in_array(strtolower($input), array_map(
fn($case) => $case->value, LogLevel::cases()), true
);
}
/**