src/FINDOLOGIC/Export/Helpers/XMLHelper.php
public static function createElementWithText(
        DOMDocument $document,
        string $name,
        string $text,
        array $attributes = []
    ): DOMElement {
        $element = self::createElement($document, $name, $attributes);
        $wrappedText = $document->createCDATASection($text);
        $element->appendChild($wrappedText);

        return $element;
    }
public static function createElementWithText(
        DOMDocument $document,
        string $name,
        string $text,
        array $attributes = []
    ): DOMElement {
        $element = self::createElement($document, $name, $attributes);
        $wrappedText = $document->createCDATASection($text);
        $element->appendChild($wrappedText);

        return $element;
    }
Shortcut for creating an XML element that contains CDATA-wrapped text.

@param DOMDocument $document The document used to create the element. It will NOT be modified.
@param string $name Name of the element.
@param string $text The text body of the document.
@param array $attributes String-to-string mapping of attributes to set on the element.
@return DOMElement The newly constructed independent DOM element.