File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 33namespace BNETDocs \Models ;
44
55use \CarlBennett \MVC \Libraries \Model ;
6+ use \DateTimeInterface ;
67use \JsonSerializable ;
78
89class Status extends Model implements JsonSerializable {
@@ -18,14 +19,18 @@ class Status extends Model implements JsonSerializable {
1819 public $ version_info ;
1920
2021 public function jsonSerialize () {
22+ $ timestamp = $ this ->timestamp ;
23+ if ($ timestamp instanceof DateTimeInterface) {
24+ $ timestamp = [
25+ 'iso ' => $ this ->timestamp ->format ('r ' ),
26+ 'unix ' => (int ) $ this ->timestamp ->format ('U ' ),
27+ ];
28+ }
2129 return [
2230 'healthcheck ' => $ this ->healthcheck ,
2331 'remote_address ' => $ this ->remote_address ,
2432 'remote_geoinfo ' => $ this ->remote_geoinfo ,
25- 'timestamp ' => [
26- 'iso ' => $ this ->timestamp ->format ('r ' ),
27- 'unix ' => (int ) $ this ->timestamp ->format ('U ' ),
28- ],
33+ 'timestamp ' => $ timestamp ,
2934 'version_info ' => $ this ->version_info ,
3035 ];
3136 }
You can’t perform that action at this time.
0 commit comments