You are here

protected function DbLogTest::getSeverityConstant in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::getSeverityConstant()
  2. 9 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::getSeverityConstant()

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.

File

core/modules/dblog/tests/src/Functional/DbLogTest.php, line 804

Class

DbLogTest
Generate events and verify dblog entries; verify user access to log reports based on permissions.

Namespace

Drupal\Tests\dblog\Functional

Code

protected function getSeverityConstant($class) {
  $map = array_flip(DbLogController::getLogLevelClassMap());

  // Find the class that contains the severity.
  $classes = explode(' ', $class);
  foreach ($classes as $class) {
    if (isset($map[$class])) {
      return $map[$class];
    }
  }
  return NULL;
}