You are here

public function CheckResult::__construct in Security Review 8

Constructs an immutable CheckResult.

Parameters

\Drupal\security_review\Check $check: The Check that created this result.

int $result: The result integer (see the constants defined above).

array $findings: The findings.

int $time: The timestamp of the check run.

bool $visible: The visibility of the result.

File

src/CheckResult.php, line 64

Class

CheckResult
Used to define the result of a Check.

Namespace

Drupal\security_review

Code

public function __construct(Check $check, $result, array $findings, $visible = TRUE, $time = NULL) {

  // Set the parent check.
  $this->check = $check;

  // Set the result value.
  $result = intval($result);
  if ($result < self::SUCCESS || $result > self::INFO) {
    $result = self::INFO;
  }
  $this->result = $result;

  // Set the findings.
  $this->findings = $findings;

  // Set the visibility.
  $this->visible = $visible;

  // Set the timestamp.
  if (!is_int($time)) {
    $this->time = time();
  }
  else {
    $this->time = intval($time);
  }
}