src/Html/Tags.php
private static function buildTag(string $name, $arguments): string
    {
        $tagConf = static::$tagsData[$name];
        $hasValue = (boolean)$tagConf['hasValue'];
        $clear = \iterator_to_array($tagConf['clearAttributes'], true);
        $default = \iterator_to_array($tagConf['defaultAttributes'], true);

        $tagName = $name == 'vartag' ? 'var' : $name;
        $tagValue = static::getTagContent($arguments, $hasValue);
        $attributes = static::getTagAttributes($arguments, $hasValue);
        $attributes = static::clearAttributes($attributes, $clear);
        $attributes = static::setDefaultAttributes($attributes, $default);
        $newLine = '';

        if (\is_array($tagValue)) {
            $tagValue = \implode(static::CRLF, $tagValue);
            $newLine = static::CRLF;
        } elseif (\in_array($tagName, ['body', 'head', 'html'])) {
            $newLine = static::CRLF;
        }

        if ($hasValue === true) {
            return \sprintf(
                '<%s%s>%s%s%s</%s>%s',
                $tagName,
                static::extractAttributes($attributes),
                $newLine,
                \rtrim(\str_replace(static::CRLF.static::CRLF, static::CRLF, $tagValue), static::CRLF),
                $newLine,
                $tagName,
                $newLine
            );
        }

        if (\in_array($tagName, ['iframe'])) {
            return \sprintf('<%s%s></%s>', $tagName, static::extractAttributes($attributes), $tagName);
        }

        return \sprintf('<%s%s/>', $tagName, static::extractAttributes($attributes));
    }
private static function buildTag(string $name, $arguments): string
    {
        $tagConf = static::$tagsData[$name];
        $hasValue = (boolean)$tagConf['hasValue'];
        $clear = \iterator_to_array($tagConf['clearAttributes'], true);
        $default = \iterator_to_array($tagConf['defaultAttributes'], true);

        $tagName = $name == 'vartag' ? 'var' : $name;
        $tagValue = static::getTagContent($arguments, $hasValue);
        $attributes = static::getTagAttributes($arguments, $hasValue);
        $attributes = static::clearAttributes($attributes, $clear);
        $attributes = static::setDefaultAttributes($attributes, $default);
        $newLine = '';

        if (\is_array($tagValue)) {
            $tagValue = \implode(static::CRLF, $tagValue);
            $newLine = static::CRLF;
        } elseif (\in_array($tagName, ['body', 'head', 'html'])) {
            $newLine = static::CRLF;
        }

        if ($hasValue === true) {
            return \sprintf(
                '<%s%s>%s%s%s</%s>%s',
                $tagName,
                static::extractAttributes($attributes),
                $newLine,
                \rtrim(\str_replace(static::CRLF.static::CRLF, static::CRLF, $tagValue), static::CRLF),
                $newLine,
                $tagName,
                $newLine
            );
        }

        if (\in_array($tagName, ['iframe'])) {
            return \sprintf('<%s%s></%s>', $tagName, static::extractAttributes($attributes), $tagName);
        }

        return \sprintf('<%s%s/>', $tagName, static::extractAttributes($attributes));
    }
private static function buildTag ( string $ name , $ arguments ) : string { $ tagConf = static :: $ tagsData [ $ name ] ; $ hasValue = ( boolean ) $ tagConf [ 'hasValue' ] ; $ clear = \ iterator_to_array ( $ tagConf [ 'clearAttributes' ] , true ) ; $ default = \ iterator_to_array ( $ tagConf [ 'defaultAttributes' ] , true ) ; $ tagName = $ name == 'vartag' ? 'var' : $ name ; $ tagValue = static :: getTagContent ( $ arguments , $ hasValue ) ; $ attributes = static :: getTagAttributes ( $ arguments , $ hasValue ) ; $ attributes = static :: clearAttributes ( $ attributes , $ clear ) ; $ attributes = static :: setDefaultAttributes ( $ attributes , $ default ) ; $ newLine = '' ; if ( \ is_array ( $ tagValue ) ) { $ tagValue = \ implode ( static :: CRLF , $ tagValue ) ; $ newLine = static :: CRLF ; } elseif ( \ in_array ( $ tagName , [ 'body' , 'head' , 'html' ] ) ) { $ newLine = static :: CRLF ; } if ( $ hasValue === true ) { return \ sprintf ( '<%s%s>%s%s%s</%s>%s' , $ tagName , static :: extractAttributes ( $ attributes ) , $ newLine , \ rtrim ( \ str_replace ( static :: CRLF . static :: CRLF , static :: CRLF , $ tagValue ) , static :: CRLF ) , $ newLine , $ tagName , $ newLine ) ; } if ( \ in_array ( $ tagName , [ 'iframe' ] ) ) { return \ sprintf ( '<%s%s></%s>' , $ tagName , static :: extractAttributes ( $ attributes ) , $ tagName ) ; } return \ sprintf ( '<%s%s/>' , $ tagName , static :: extractAttributes ( $ attributes ) ) ; }
Builds html tag

@param string $name
@param        $arguments
@return string
Builds html tag