HtmlObject\Traits\Tag::close PHP Method

close() public method

Close the Tag.
public close ( ) : string | null
return string | null
    public function close()
    {
        $this->isOpened = false;
        $openedOn = null;
        $element = null;
        foreach ($this->children as $childName => $child) {
            if ($child->isOpened && !$child->isSelfClosing) {
                $openedOn = $childName;
                $element .= $child->close();
            } elseif ($openedOn && $child->isAfter($openedOn)) {
                $element .= $child;
            }
        }
        // Invisible tags
        if (!$this->element) {
            return;
        }
        return $element .= '</' . $this->element . '>';
    }