You are here

private function ValidationResult::__construct in Automatic Updates 8.2

Creates a ValidationResult object.

Parameters

int $severity: The severity of the result. Should be one of the SystemManager::REQUIREMENT_* constants.

\Drupal\Core\StringTranslation\TranslatableMarkup[] $messages: The error messages.

\Drupal\Core\StringTranslation\TranslatableMarkup|null $summary: The errors summary.

File

src/Validation/ValidationResult.php, line 45

Class

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

Namespace

Drupal\automatic_updates\Validation

Code

private function __construct(int $severity, array $messages, ?TranslatableMarkup $summary = NULL) {
  if (count($messages) > 1 && !$summary) {
    throw new \InvalidArgumentException('If more than one message is provided, a summary is required.');
  }
  $this->summary = $summary;
  $this->messages = $messages;
  $this->severity = $severity;
}