protected function CliCommands::normalizeSeverity in Site Alert 8
Normalizes to one of the three allowed values.
Parameters
string $severity: One of the three values low, medium, high.
Return value
string The normalized severity.
1 call to CliCommands::normalizeSeverity()
- CliCommands::create in src/
CliCommands.php - Creates a new site alert.
File
- src/
CliCommands.php, line 198
Class
- CliCommands
- Service with shared code for CLI tools to perform common tasks.
Namespace
Drupal\site_alertCode
protected function normalizeSeverity(string $severity = 'medium') : string {
$severity = trim($severity);
$severity = strtolower($severity);
$allowed_severities = [
'low',
'medium',
'high',
];
if (!in_array($severity, $allowed_severities)) {
$severity = 'medium';
}
return $severity;
}