protected function createRootElement($rootElement)
    {
        if (is_string($rootElement)) {
            $rootElementName = $rootElement ?: 'root';

            return $this->document->createElement($rootElementName);
        }

        $rootElementName = $rootElement['rootElementName'] ?? 'root';

        $element = $this->document->createElement($rootElementName);

        foreach ($rootElement as $key => $value) {
            if ($key !== '_attributes' && $key !== '@attributes') {
                continue;
            }

            $this->addAttributes($element, $rootElement[$key]);
        }

        return $element;
    }
protected function createRootElement($rootElement)
    {
        if (is_string($rootElement)) {
            $rootElementName = $rootElement ?: 'root';

            return $this->document->createElement($rootElementName);
        }

        $rootElementName = $rootElement['rootElementName'] ?? 'root';

        $element = $this->document->createElement($rootElementName);

        foreach ($rootElement as $key => $value) {
            if ($key !== '_attributes' && $key !== '@attributes') {
                continue;
            }

            $this->addAttributes($element, $rootElement[$key]);
        }

        return $element;
    }
protected function createRootElement ( $ rootElement ) { if ( is_string ( $ rootElement ) ) { $ rootElementName = $ rootElement ? : 'root' ; return $ this -> document -> createElement ( $ rootElementName ) ; } $ rootElementName = $ rootElement [ 'rootElementName' ] ?? 'root' ; $ element = $ this -> document -> createElement ( $ rootElementName ) ; foreach ( $ rootElement as $ key => $ value ) { if ( $ key !== '_attributes' && $ key !== '@attributes' ) { continue ; } $ this -> addAttributes ( $ element , $ rootElement [ $ key ] ) ; } return $ element ; }
Create the root element.

@param  string|array $rootElement
@return DOMElement
Create the root element .