src/Valkyrja/Debug/ExceptionHandler.php
protected function formatArgs(array $args): string
    {
        $result = [];

        foreach ($args as $key => $item) {
            if (\is_object($item)) {
                $formattedValue = sprintf(
                    '<em>object</em>(%s)',
                    $this->formatClass(\get_class($item))
                );
            } elseif (\is_array($item)) {
                $formattedValue = sprintf(
                    '<em>array</em>(%s)',
                    $this->formatArgs($item)
                );
            } elseif (\is_string($item)) {
                $formattedValue = sprintf("'%s'", $this->escapeHtml($item));
            } elseif (null === $item) {
                $formattedValue = '<em>null</em>';
            } elseif (\is_bool($item)) {
                $formattedValue = '<em>'
                    . strtolower(var_export($item, true))
                    . '</em>';
            } elseif (\is_resource($item)) {
                $formattedValue = '<em>resource</em>';
            } else {
                $formattedValue = str_replace(
                    "\n",
                    '',
                    var_export($this->escapeHtml((string) $item), true)
                );
            }

            $result[] = \is_int($key)
                ? $formattedValue
                : sprintf("'%s' => %s", $key, $formattedValue);
        }

        return implode(', ', $result);
    }
protected function formatArgs(array $args): string
    {
        $result = [];

        foreach ($args as $key => $item) {
            if (\is_object($item)) {
                $formattedValue = sprintf(
                    '<em>object</em>(%s)',
                    $this->formatClass(\get_class($item))
                );
            } elseif (\is_array($item)) {
                $formattedValue = sprintf(
                    '<em>array</em>(%s)',
                    $this->formatArgs($item)
                );
            } elseif (\is_string($item)) {
                $formattedValue = sprintf("'%s'", $this->escapeHtml($item));
            } elseif (null === $item) {
                $formattedValue = '<em>null</em>';
            } elseif (\is_bool($item)) {
                $formattedValue = '<em>'
                    . strtolower(var_export($item, true))
                    . '</em>';
            } elseif (\is_resource($item)) {
                $formattedValue = '<em>resource</em>';
            } else {
                $formattedValue = str_replace(
                    "\n",
                    '',
                    var_export($this->escapeHtml((string) $item), true)
                );
            }

            $result[] = \is_int($key)
                ? $formattedValue
                : sprintf("'%s' => %s", $key, $formattedValue);
        }

        return implode(', ', $result);
    }
Formats an array as a string.

@param array $args The argument array

@return string