protected function DBLogTestCase::getSeverityConstant in Drupal 7
Gets the watchdog severity constant corresponding to the CSS class.
Parameters
string $class: CSS class attribute.
Return value
int|null The watchdog severity constant or NULL if not found.
Related topics
1 call to DBLogTestCase::getSeverityConstant()
- DBLogTestCase::getLogEntries in modules/
dblog/ dblog.test - Gets the database log event information from the browser page.
File
- modules/
dblog/ dblog.test, line 610 - Tests for dblog.module.
Class
- DBLogTestCase
- Tests logging messages to the database.
Code
protected function getSeverityConstant($class) {
// Reversed array from dblog_overview().
$map = array(
'dblog-debug' => WATCHDOG_DEBUG,
'dblog-info' => WATCHDOG_INFO,
'dblog-notice' => WATCHDOG_NOTICE,
'dblog-warning' => WATCHDOG_WARNING,
'dblog-error' => WATCHDOG_ERROR,
'dblog-critical' => WATCHDOG_CRITICAL,
'dblog-alert' => WATCHDOG_ALERT,
'dblog-emerg' => WATCHDOG_EMERGENCY,
);
// Find the class that contains the severity.
$classes = explode(' ', $class);
foreach ($classes as $class) {
if (isset($map[$class])) {
return $map[$class];
}
}
return NULL;
}