<?php

if (!function_exists('toHumanReadable')) {
    function toHumanReadable($name)
    {
        return ucwords(preg_replace("/[^0-9a-z]/i", " ", $name));
    }
}
if (!function_exists('parseRender')) {
    function parseRender($_data)
    {
        if ($_data) {
            $type = gettype($_data);
            if (is_string($_data) || is_numeric($_data)) {
                echo $_data;
            } else {
                echo "<table class='table table-sm border w-100'>";
                foreach ($_data as $k => $v) {
                    echo "<tr>";
                    echo "<td><b class='text-secondary'>" . toHumanReadable($k) . "</b></td>";
                    echo "<td>";
                    if (is_object($v)) {
                        parseRender($v);
                    } elseif (is_array($v)) {
                        foreach ($v as $k2 => $v2) {
                            parseRender($v2);
                        }
                    } else {
                        echo $v;
                    }
                    echo "</td>";
                    echo "</tr>";
                }
                echo "</table>";
            }
        }
    }
}

?>