You are here

public function RestProcessor::getData in Radioactivity 4.0.x

Same name and namespace in other branches
  1. 8.3 src/RestProcessor.php \Drupal\radioactivity\RestProcessor::getData()

Returns the stored incident data.

Return value

string Json formatted incident data.

File

src/RestProcessor.php, line 84

Class

RestProcessor
The worker class for the Radioactivity rest endpoint.

Namespace

Drupal\radioactivity

Code

public function getData() {
  if (file_exists($this->payloadFile)) {
    $fh = fopen($this->payloadFile, 'r');
    $data = fread($fh, filesize($this->payloadFile));
    fclose($fh);
    return '[' . rtrim($data, ',' . PHP_EOL) . ']';
  }
  else {
    return '[]';
  }
}