|
|
@ -14,9 +14,13 @@ class DeegraphNodeDetails |
|
|
|
|
|
|
|
public function __construct(array $nodeDetails) |
|
|
|
{ |
|
|
|
$this->ID = $nodeDetails["@id"]; |
|
|
|
$this->CreatedAt = new DateTime($nodeDetails["@created"]); |
|
|
|
$this->CreatorID = $nodeDetails["@creator"]; |
|
|
|
file_put_contents( |
|
|
|
filename: __DIR__ . '/../../../../../LocalStorage/DevCache/' . (new DateTime())->format('u') . '.json', |
|
|
|
data: json_encode($nodeDetails) |
|
|
|
); |
|
|
|
// $this->ID = $nodeDetails["@id"]; |
|
|
|
// $this->CreatedAt = new DateTime($nodeDetails["@created"]); |
|
|
|
// $this->CreatorID = $nodeDetails["@creator"]; |
|
|
|
|
|
|
|
foreach($nodeDetails as $key=>$value) { |
|
|
|
switch($key) |
|
|
@ -39,10 +43,14 @@ class DeegraphNodeDetails |
|
|
|
|
|
|
|
public function AsJSON(): string |
|
|
|
{ |
|
|
|
$createdAt = null; |
|
|
|
if (isset($this->CreatedAt)) |
|
|
|
$createdAt = $this->CreatedAt->format(format: 'Y-m-d\TH:i:s.v\Z'); |
|
|
|
|
|
|
|
$builder = [ |
|
|
|
"@id" => $this->ID, |
|
|
|
"@created" => $this->CreatedAt->format(format: 'Y-m-d\TH:i:s.v\Z'), |
|
|
|
"@creator" => $this->CreatorID, |
|
|
|
"@id" => $this->ID ?? null, |
|
|
|
"@created" => $createdAt, |
|
|
|
"@creator" => $this->CreatorID ?? null, |
|
|
|
]; |
|
|
|
foreach($this->OtherProperties as $key=>$value) { |
|
|
|
$builder[$key] = $value; |
|
|
|