view->escape((string) $struct);
} elseif (is_array($struct)) {
return $this->renderArray($struct);
} elseif (is_object($struct)) {
return $this->renderObject($struct);
}
}
protected function renderArray($array)
{
if (empty($array)) {
return '[]';
}
$out = "
\n";
foreach ($array as $val) {
$out .= '- ' . $this->customvar($val) . "
\n";
}
return $out . "
\n";
}
protected function renderObject($object)
{
if (empty($object)) {
return '{}';
}
$out = "{\n";
foreach ($object as $key => $val) {
$out .= '- '
. $this->view->escape($key)
. ' => '
. $this->customvar($val)
. "
\n";
}
return $out . "
}";
}
}