= self::MIN_SCORE && $score <= self::MAX_SCORE; } /** * Convert a numeric CVSS score to a severity string. * * @param float|int $score CVSS score (0-10). * * @return string Severity string: 'critical', 'high', 'medium', 'low', or 'none'. */ public static function getSeverityString( $score ) { $score = floatval( $score ); if ( $score >= 9.0 ) { return 'critical'; } elseif ( $score >= 7.0 ) { return 'high'; } elseif ( $score >= 4.0 ) { return 'medium'; } elseif ( $score > 0.0 ) { return 'low'; } else { return 'none'; } } /** * Get the display name for a severity level based on CVSS score. * * @param float|int $score CVSS score (0-10). * * @return string Display name with CVSS score in brackets. */ public static function getDisplayName( $score ) { $score = floatval( $score ); return '(CVSS ' . number_format( $score, 1 ) . ')'; } /** * Get the numeric value for a severity level (returns the CVSS score itself). * * @param float|int $score CVSS score (0-10). * * @return float Numeric CVSS score (0-10, higher = more severe). */ public static function getNumericValue( $score ) { return self::normalize( $score ); } }