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

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