public function dump($level = 0)
{
$export = implode(' ', array_map(function ($key, $value) {
$str = '';
if (!is_numeric($key)) {
$str .= "{$key}=";
}
if ($value) {
$str .= !is_array($value) ? $value : '{' . implode(', ', array_map('trim', array_map('strval', $value))) . '}';
}
return $str;
}, array_keys($this->data), $this->data));
$indent = str_repeat(' ', $level);
$str = $indent . '[' . $this->type . (empty($export) ? '' : " {$export}") . ']' . "\n";
foreach ($this->children as $child) {
$str .= $child->dump($level + 1);
}
return trim($str);
}