function _list(string
$type = 'ul',
$list =
[],
$attributes = '', int
$depth = 0
): string
{ // Set the indentation based on the depth
$out =
str_repeat(' ',
$depth) // Write the opening list tag
. '<' .
$type .
stringify_attributes($attributes) . ">\n";
// Cycle through the list elements. If an array is
// encountered we will recursively call _list()
foreach ($list as $key =>
$val) { $out .=
str_repeat(' ',
$depth + 2
) . '<li>';
if (!
is_array($val)) { $out .=
$val;
} else { $out .=
$key .