Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
fix: implement json serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
cawolf committed Mar 13, 2020
1 parent c161923 commit 279e23c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/MonitoringData.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -80,7 +81,7 @@ public function getPriority(): int
return $this->priority;
}

public function getDate(): DateTimeInterface
public function getDate(): string
{
return $this->date;
}
Expand All @@ -99,4 +100,8 @@ public function getTileExpansionGrowthExpression(): ?string
{
return $this->tileExpansionGrowthExpression;
}

public function jsonSerialize() {
return get_object_vars($this);
}
}

0 comments on commit 279e23c

Please sign in to comment.