Code Duplication    Length = 6-6 lines in 3 locations

src/SAML2/AuthnRequest.php 1 location

@@ 200-205 (lines=6) @@
197
            throw new \Exception('More than one <saml:NameID> or <saml:EncryptedID> in <saml:Subject>.');
198
        }
199
        $nameId = $nameId[0];
200
        if ($nameId->localName === 'EncryptedData') {
201
            /* The NameID element is encrypted. */
202
            $this->encryptedNameId = $nameId;
203
        } else {
204
            $this->nameId = new XML\saml\NameID($nameId);
205
        }
206
207
        $subjectConfirmation = Utils::xpQuery($subject, './saml_assertion:SubjectConfirmation');
208
        foreach ($subjectConfirmation as $sc) {

src/SAML2/LogoutRequest.php 1 location

@@ 72-77 (lines=6) @@
69
            throw new \Exception('More than one <saml:NameID> or <saml:EncryptedD> in <samlp:LogoutRequest>.');
70
        }
71
        $nameId = $nameId[0];
72
        if ($nameId->localName === 'EncryptedData') {
73
            /* The NameID element is encrypted. */
74
            $this->encryptedNameId = $nameId;
75
        } else {
76
            $this->nameId = new XML\saml\NameID($nameId);
77
        }
78
79
        $sessionIndexes = Utils::xpQuery($xml, './saml_protocol:SessionIndex');
80
        foreach ($sessionIndexes as $sessionIndex) {

src/SAML2/Assertion.php 1 location

@@ 329-334 (lines=6) @@
326
            throw new \Exception('More than one <saml:NameID> or <saml:EncryptedID> in <saml:Subject>.');
327
        } elseif (!empty($nameId)) {
328
            $nameId = $nameId[0];
329
            if ($nameId->localName === 'EncryptedData') {
330
                /* The NameID element is encrypted. */
331
                $this->encryptedNameId = $nameId;
332
            } else {
333
                $this->nameId = new XML\saml\NameID($nameId);
334
            }
335
        }
336
337
        $subjectConfirmation = Utils::xpQuery($subject, './saml_assertion:SubjectConfirmation');