protected function renderTag($tagName, array $attributes = [], $content = '')
    {
        if (empty($tagName)) {
            throw new \InvalidArgumentException('$tagName must not be NULL or empty.', 1343763729);
        }

        $output = '<' . htmlspecialchars($tagName);

        foreach ($attributes as $key => $value) {
            if (!is_string($key) || $key === '') {
                throw new \InvalidArgumentException('Attribute key must not be empty.', 1448657422);
            }
            $output .= ' ' . htmlspecialchars($key) . '="' . htmlspecialchars($value) . '"';
        }

        if ($content !== '') {
            $output .= '>' . $content . '</' . htmlspecialchars($tagName) . '>';
        } else {
            $output .= ' />';
        }

        return $output;
    }
protected function renderTag($tagName, array $attributes = [], $content = '')
    {
        if (empty($tagName)) {
            throw new \InvalidArgumentException('$tagName must not be NULL or empty.', 1343763729);
        }

        $output = '<' . htmlspecialchars($tagName);

        foreach ($attributes as $key => $value) {
            if (!is_string($key) || $key === '') {
                throw new \InvalidArgumentException('Attribute key must not be empty.', 1448657422);
            }
            $output .= ' ' . htmlspecialchars($key) . '="' . htmlspecialchars($value) . '"';
        }

        if ($content !== '') {
            $output .= '>' . $content . '</' . htmlspecialchars($tagName) . '>';
        } else {
            $output .= ' />';
        }

        return $output;
    }
protected function renderTag ( $ tagName , array $ attributes = [ ] , $ content = '' ) { if ( empty ( $ tagName ) ) { throw new \ InvalidArgumentException ( '$tagName must not be NULL or empty.' , 1343763729 ) ; } $ output = '<' . htmlspecialchars ( $ tagName ) ; foreach ( $ attributes as $ key => $ value ) { if ( ! is_string ( $ key ) || $ key === '' ) { throw new \ InvalidArgumentException ( 'Attribute key must not be empty.' , 1448657422 ) ; } $ output .= ' ' . htmlspecialchars ( $ key ) . '="' . htmlspecialchars ( $ value ) . '"' ; } if ( $ content !== '' ) { $ output .= '>' . $ content . '</' . htmlspecialchars ( $ tagName ) . '>' ; } else { $ output .= ' />' ; } return $ output ; }
Renders any HTML tag with its own parameter either around some content.

If the content is empty, the tag gets rendered as a self-closing tag.

@param string $tagName
@param string[] $attributes
use HTML attribute as key, must not be empty
use attribute value as array value, might be empty
@param string $content

@return string the rendered HTML tag

@throws \InvalidArgumentException if the given tagName is empty
Renders any HTML tag with its own parameter either around some content .