Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ValidationResult.php

function ValidationResult::getOverallSeverity

Returns the overall severity for a set of validation results.

Parameters

\Drupal\package_manager\ValidationResult[] $results: The validation results.

Return value

int The overall severity of the results. Will be one of the SystemManager::REQUIREMENT_* constants.

File

core/modules/package_manager/src/ValidationResult.php, line 120

Class

ValidationResult
A value object to contain the results of a validation.

Namespace

Drupal\package_manager

Code

public static function getOverallSeverity(array $results) : int {
    foreach ($results as $result) {
        if ($result->severity === SystemManager::REQUIREMENT_ERROR) {
            return SystemManager::REQUIREMENT_ERROR;
        }
    }
    // If there were no errors, then any remaining results must be warnings.
    return $results ? SystemManager::REQUIREMENT_WARNING : SystemManager::REQUIREMENT_OK;
}
RSS feed
Powered by Drupal