You are here

public function XmlRpc::process in Production check & Production monitor 8

Processes a single prod check plugin

Parameters

\Drupal\prod_check\Plugin\ProdCheckInterface $plugin:

Overrides ProdCheckProcessorBase::process

File

modules/prod_check_xmlrpc/src/Plugin/ProdCheckProcessor/XmlRpc.php, line 53

Class

XmlRpc
XML-RPC processor

Namespace

Drupal\prod_check_xmlrpc\Plugin\ProdCheckProcessor

Code

public function process(ProdCheckInterface $plugin) {
  if (!$plugin) {
    return [];
  }
  $plugin
    ->setProcessor($this);
  $status = $plugin
    ->state();
  $requirement = [
    'status' => $status,
    'severity' => $status ? $this
      ->ok() : $plugin
      ->severity(),
    'title' => (string) $plugin
      ->title(),
    'category' => $plugin
      ->category(),
    'data' => $plugin
      ->data(),
  ];
  if ($status) {
    $message = $plugin
      ->successMessages();
    $requirement['value'] = (string) render($message['value']);
    $requirement['description'] = (string) render($message['description']);
  }
  else {
    $message = $plugin
      ->failMessages();
    $requirement['value'] = (string) render($message['value']);
    $requirement['description'] = (string) render($message['description']);
  }
  return $requirement;
}