properties[$key] = $value; } public function rename(string $key, string $newKey) { $renamed = []; foreach ($this->properties as $k=>$v) { $renamed[($k==$key)?$newKey:$k] = $v; } $this->properties = $renamed; } public function unset(string $key) { unset($this->properties[$key]); } public function __clone() { $properties = array_combine( array_keys($this->properties), array_map(fn($v) => clone $v, $this->properties) ); return new ObjectNode($properties); } public function jsonSerialize(): mixed { return $this->properties; } }