From 71a0fc7f891fb4b6a93d99052bdfae3922cfcfc8 Mon Sep 17 00:00:00 2001 From: Khan M Rashedun-Naby Date: Mon, 25 Jun 2018 12:40:55 +0600 Subject: [PATCH] Log Abstract Class Methods Refactoring --- includes/class-wc-log-levels.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/includes/class-wc-log-levels.php b/includes/class-wc-log-levels.php index e86434006bc..6f58bb8f4f5 100644 --- a/includes/class-wc-log-levels.php +++ b/includes/class-wc-log-levels.php @@ -89,12 +89,7 @@ abstract class WC_Log_Levels { * @return int 100 (debug) - 800 (emergency) or 0 if not recognized */ public static function get_level_severity( $level ) { - if ( self::is_valid_level( $level ) ) { - $severity = self::$level_to_severity[ strtolower( $level ) ]; - } else { - $severity = 0; - } - return $severity; + return self::is_valid_level( $level ) ? self::$level_to_severity[ strtolower( $level ) ] : 0; } /** @@ -104,11 +99,10 @@ abstract class WC_Log_Levels { * @return bool|string False if not recognized. Otherwise string representation of level. */ public static function get_severity_level( $severity ) { - if ( array_key_exists( $severity, self::$severity_to_level ) ) { - return self::$severity_to_level[ $severity ]; - } else { + if ( ! array_key_exists( $severity, self::$severity_to_level ) ) { return false; } + return self::$severity_to_level[ $severity ]; } }