public function generateTag($tag, $attributes, $closeTag = true)
    {
        $openPattern = replace_variables($this->openTagPattern, compact('tag'));
        $external = '';

        if (in_array($tag, $this->voidTags) && !empty($this->voidTagPattern) && $this->voidTagPattern != $this->openTagPattern) {
            $openPattern = replace_variables($this->voidTagPattern, compact('tag'));
        }

        if (array_key_exists($this->externalKey, $attributes)) {
            $external = $attributes[$this->externalKey];
            unset($attributes[$this->externalKey]);
        }

        $html = replace_variables($openPattern, ['attr' => associative_implode('=', ' ', $attributes)]);

        if (!in_array($tag, $this->voidTags)) {
            $html .= $external;

            if ($closeTag) {
                $html .= $this->closeTag($tag);
            }
        }

        return $html;
    }
public function generateTag($tag, $attributes, $closeTag = true)
    {
        $openPattern = replace_variables($this->openTagPattern, compact('tag'));
        $external = '';

        if (in_array($tag, $this->voidTags) && !empty($this->voidTagPattern) && $this->voidTagPattern != $this->openTagPattern) {
            $openPattern = replace_variables($this->voidTagPattern, compact('tag'));
        }

        if (array_key_exists($this->externalKey, $attributes)) {
            $external = $attributes[$this->externalKey];
            unset($attributes[$this->externalKey]);
        }

        $html = replace_variables($openPattern, ['attr' => associative_implode('=', ' ', $attributes)]);

        if (!in_array($tag, $this->voidTags)) {
            $html .= $external;

            if ($closeTag) {
                $html .= $this->closeTag($tag);
            }
        }

        return $html;
    }
public function generateTag ( $ tag , $ attributes , $ closeTag = true ) { $ openPattern = replace_variables ( $ this -> openTagPattern , compact ( 'tag' ) ) ; $ external = '' ; if ( in_array ( $ tag , $ this -> voidTags ) && ! empty ( $ this -> voidTagPattern ) && $ this -> voidTagPattern != $ this -> openTagPattern ) { $ openPattern = replace_variables ( $ this -> voidTagPattern , compact ( 'tag' ) ) ; } if ( array_key_exists ( $ this -> externalKey , $ attributes ) ) { $ external = $ attributes [ $ this -> externalKey ] ; unset ( $ attributes [ $ this -> externalKey ] ) ; } $ html = replace_variables ( $ openPattern , [ 'attr' => associative_implode ( '=' , ' ' , $ attributes ) ] ) ; if ( ! in_array ( $ tag , $ this -> voidTags ) ) { $ html .= $ external ; if ( $ closeTag ) { $ html .= $ this -> closeTag ( $ tag ) ; } } return $ html ; }
Generate an HTML tag.

@param $tag
@param $attributes
@param $closeTag

@return string
Generate an HTML tag .