PhpCss\Ast\Visitor\Explain::appendElement PHP Method

appendElement() private method

private appendElement ( $name, string $content = '', array $attributes = [] ) : DOMNode
$name
$content string
$attributes array
return DOMNode
    private function appendElement($name, $content = '', array $attributes = array())
    {
        $result = $this->_dom->createElementNs($this->_xmlns, $name);
        if (!empty($content)) {
            $text = $result->appendChild($this->_dom->createElementNs($this->_xmlns, 'text'));
            if (trim($content) !== $content) {
                $text->appendChild($this->_dom->createCDATASection($content));
            } else {
                $text->appendChild($this->_dom->createTextNode($content));
            }
        }
        foreach ($attributes as $attribute => $value) {
            $result->setAttribute($attribute, $value);
        }
        $this->_current->appendChild($result);
        return $result;
    }