Merge pull request #20615 from rnaby/250618-121609

Log Abstract Class Methods Refactoring
This commit is contained in:
Mike Jolley 2018-06-25 12:09:05 +01:00 committed by GitHub
commit ff8781a406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 9 deletions

View File

@ -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 ];
}
}