Code Duplication    Length = 6-6 lines in 2 locations

src/SAML2/EncryptedAssertion.php 1 location

@@ 108-113 (lines=6) @@
105
     */
106
    public function toXML(\DOMNode $parentElement = null)
107
    {
108
        if ($parentElement === null) {
109
            $document = DOMDocumentFactory::create();
110
            $parentElement = $document;
111
        } else {
112
            $document = $parentElement->ownerDocument;
113
        }
114
115
        $root = $document->createElementNS(Constants::NS_SAML, 'saml:' . 'EncryptedAssertion');
116
        $parentElement->appendChild($root);

src/SAML2/Assertion.php 1 location

@@ 1257-1262 (lines=6) @@
1254
     */
1255
    public function toXML(\DOMNode $parentElement = null)
1256
    {
1257
        if ($parentElement === null) {
1258
            $document = DOMDocumentFactory::create();
1259
            $parentElement = $document;
1260
        } else {
1261
            $document = $parentElement->ownerDocument;
1262
        }
1263
1264
        $root = $document->createElementNS(Constants::NS_SAML, 'saml:' . 'Assertion');
1265
        $parentElement->appendChild($root);