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

@@ 1282-1287 (lines=6) @@
1279
     */
1280
    public function toXML(\DOMNode $parentElement = null)
1281
    {
1282
        if ($parentElement === null) {
1283
            $document = DOMDocumentFactory::create();
1284
            $parentElement = $document;
1285
        } else {
1286
            $document = $parentElement->ownerDocument;
1287
        }
1288
1289
        $root = $document->createElementNS(Constants::NS_SAML, 'saml:' . 'Assertion');
1290
        $parentElement->appendChild($root);