diff --git a/src/MonitoringData.php b/src/MonitoringData.php index e06022a..554d152 100644 --- a/src/MonitoringData.php +++ b/src/MonitoringData.php @@ -5,9 +5,10 @@ namespace Phash; use DateTimeInterface; +use JsonSerializable; use RuntimeException; -class MonitoringData +class MonitoringData implements JsonSerializable { public const STATUS_OK = 'ok'; public const STATUS_ERROR = 'error'; @@ -41,7 +42,7 @@ public function __construct( $this->payload = $payload; $this->idleTimeoutInSeconds = $idleTimeoutInSeconds; $this->priority = $priority; - $this->date = $date; + $this->date = $date->format('Y-m-d H:i:s'); $this->path = $path; } @@ -80,7 +81,7 @@ public function getPriority(): int return $this->priority; } - public function getDate(): DateTimeInterface + public function getDate(): string { return $this->date; } @@ -99,4 +100,8 @@ public function getTileExpansionGrowthExpression(): ?string { return $this->tileExpansionGrowthExpression; } + + public function jsonSerialize() { + return get_object_vars($this); + } }