From aa65dd73cf8cb973f287785d20fcc8a3c55652fd Mon Sep 17 00:00:00 2001 From: netkas Date: Tue, 17 Sep 2024 15:29:03 -0400 Subject: [PATCH] Refactor checkLogLevel to correctly utilize LogLevel cases --- src/ncc/Utilities/Validate.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ncc/Utilities/Validate.php b/src/ncc/Utilities/Validate.php index c89c5ed..5ea09d3 100644 --- a/src/ncc/Utilities/Validate.php +++ b/src/ncc/Utilities/Validate.php @@ -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 + ); } /**