protected static function openTag($tag, $add, $whitespace)
    {
        $tabs = str_pad('', self::$tabCount ++, "\t");

        if (preg_match('#^<(a|label|option|textarea|h1|h2|h3|h4|h5|h6|strong|b|em|i|abbr|acronym|cite|span|sub|sup|u|s|title)(?: [^>]*|)>#', $tag)) {
            // if it's one of those tag it's inline so it does not require a leading line break
            $result = $tag . $whitespace . str_replace("\n", "\n" . $tabs, $add);
        } elseif (substr($tag, 0, 9) == '<!DOCTYPE') {
            // it's the doctype declaration so no line break here either
            $result = $tabs . $tag;
        } else {
            // normal block tag
            $result = "\n" . $tabs . $tag;

            if (!empty($add)) {
                $result .= "\n" . $tabs . "\t" . str_replace("\n", "\n\t" . $tabs, $add);
            }
        }

        self::$lastCallAdd = $add;

        return $result;
    }