function SystemManager::getMaxSeverity

Same name in other branches
  1. 9 core/modules/system/src/SystemManager.php \Drupal\system\SystemManager::getMaxSeverity()
  2. 10 core/modules/system/src/SystemManager.php \Drupal\system\SystemManager::getMaxSeverity()
  3. 11.x core/modules/system/src/SystemManager.php \Drupal\system\SystemManager::getMaxSeverity()

Extracts the highest severity from the requirements array.

Parameters

$requirements: An array of requirements, in the same format as is returned by hook_requirements().

Return value

The highest severity in the array.

1 call to SystemManager::getMaxSeverity()
SystemManager::checkRequirements in core/modules/system/src/SystemManager.php
Checks for requirement severity.

File

core/modules/system/src/SystemManager.php, line 135

Class

SystemManager
System Manager Service.

Namespace

Drupal\system

Code

public function getMaxSeverity(&$requirements) {
    $severity = static::REQUIREMENT_OK;
    foreach ($requirements as $requirement) {
        if (isset($requirement['severity'])) {
            $severity = max($severity, $requirement['severity']);
        }
    }
    return $severity;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.