import($import_file); } function import(string $file): bool { $json = @file_get_contents($file); if($json===false) return false; $json = json_decode($json, true); if(!is_array(json)) return false; foreach($json as $key => $value) { $this->$$key = $value; } return true; } function export(string $file = ""): string { return json_encode($this, JSON_PRETTY_PRINT); } function __toString(): string { return $this->export(); } }