/** * {@inheritdoc} */ public function evaluate(CheckResult $result) { if ($result->result() === CheckResult::SUCCESS) { return array(); } $output = ''; foreach ($result->findings() as $finding) { $output .= '<p>'; $output .= t($finding); $output .= '</p>'; } return array('#type' => 'markup', '#markup' => $output); }
/** * Stores a result in the state system. * * @param \Drupal\security_review\CheckResult $result * The result to store. */ public function storeResult(CheckResult $result = NULL) { if ($result == NULL) { $context = array('!reviewcheck' => $this->getTitle(), '!namespace' => $this->getNamespace()); SecurityReview::log($this, 'Unable to store check !reviewcheck for !namespace', $context, RfcLogLevel::CRITICAL); return; } $findings = $this->storesFindings() ? $result->findings() : array(); Drupal::state()->setMultiple(array($this->statePrefix . 'last_result.result' => $result->result(), $this->statePrefix . 'last_result.time' => $result->time(), $this->statePrefix . 'last_result.findings' => $findings)); }