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 3
3
namespace BNETDocs \Models ;
4
4
5
5
use \CarlBennett \MVC \Libraries \Model ;
6
+ use \DateTimeInterface ;
6
7
use \JsonSerializable ;
7
8
8
9
class Status extends Model implements JsonSerializable {
@@ -18,14 +19,18 @@ class Status extends Model implements JsonSerializable {
18
19
public $ version_info ;
19
20
20
21
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
+ }
21
29
return [
22
30
'healthcheck ' => $ this ->healthcheck ,
23
31
'remote_address ' => $ this ->remote_address ,
24
32
'remote_geoinfo ' => $ this ->remote_geoinfo ,
25
- 'timestamp ' => [
26
- 'iso ' => $ this ->timestamp ->format ('r ' ),
27
- 'unix ' => (int ) $ this ->timestamp ->format ('U ' ),
28
- ],
33
+ 'timestamp ' => $ timestamp ,
29
34
'version_info ' => $ this ->version_info ,
30
35
];
31
36
}
You can’t perform that action at this time.
0 commit comments