function prettyPrintArray()

in util/GenerateDocExamples.php [130:154]


function prettyPrintArray(array $input, int $space): string
{
    $output = '';
    $tab = str_repeat(' ', $space);
    foreach ($input as $key => $value) {
        if (is_int($key)) {
            $output .= sprintf("%s", $tab);
        } else {
            $output .= sprintf("%s'%s' => ", $tab, $key);
        }
        if (is_array($value)) {
            $output .= "[\n";
            $output .= prettyPrintArray($value, $space + 4);
            $output .= sprintf("%s],\n", $tab);
        } else {
            if (is_string($value)) {
                $value = "'" . str_replace("'", "\'", $value) . "'";
            } if (is_bool($value)) {
                $value = $value ? 'true' : 'false';
            }
            $output .= sprintf("%s,\n", $value);
        }
    }
    return $output;
}