public function tag($name, array $attributes, $content = null)
    {
        $args = func_get_args();
        $tag = array_shift($args);
        $attributes = array_shift($args);
        foreach ($attributes as $key => $value) {
            if (is_array($value)) {
                $value = implode(' ', array_unique(array_filter($value)));
            }
            if ($value === '') {
                unset($attributes[$key]);
            } elseif (!is_numeric($key)) {
                $attributes[$key] = $key.'="'.$value.'"';
            } elseif (isset($attributes[$value])) {
                unset($attributes[$key]);
            }
        }
        $attributes = (!empty($attributes)) ? ' '.implode(' ', $attributes) : '';
        $html = '<'.$tag.$attributes.'>';
        if (!empty($args)) {
            $html .= implode(' ', array_filter($args));
            $html .= '</'.strstr($tag.' ', ' ', true).'>';
        }

        return $html;
    }