Code Duplication    Length = 6-6 lines in 3 locations

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');

src/SAML2/AuthnRequest.php 1 location

@@ 208-213 (lines=6) @@
205
            throw new \Exception('More than one <saml:NameID> or <saml:EncryptedID> in <saml:Subject>.');
206
        }
207
        $nameId = $nameId[0];
208
        if ($nameId->localName === 'EncryptedData') {
209
            /* The NameID element is encrypted. */
210
            $this->encryptedNameId = $nameId;
211
        } else {
212
            $this->nameId = new XML\saml\NameID($nameId);
213
        }
214
215
        $subjectConfirmation = Utils::xpQuery($subject, './saml_assertion:SubjectConfirmation');
216
        foreach ($subjectConfirmation as $sc) {