You are here

public function Incident::toJson in Radioactivity 8.2

Same name and namespace in other branches
  1. 8.3 src/Incident.php \Drupal\radioactivity\Incident::toJson()
  2. 4.0.x src/Incident.php \Drupal\radioactivity\Incident::toJson()

Convert to JSON format

Return value

string

File

src/Incident.php, line 63

Class

Incident
Incident class

Namespace

Drupal\radioactivity

Code

public function toJson() {
  return Json::encode([
    'fn' => $this->field_name,
    'et' => $this->entity_type,
    'id' => $this->entity_id,
    'e' => $this->energy,
    'h' => $this
      ->calculateHash(),
  ]);
}