view->escape(
is_string($struct)
? $struct
: var_export($struct, true)
);
} 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 (0 === count((array) $object)) {
return '{}';
}
$out = "{\n";
foreach ($object as $key => $val) {
$out .= '- '
. $this->view->escape($key)
. ' => '
. $this->customvar($val)
. "
\n";
}
return $out . "
}";
}
}