Code Duplication    Length = 5-5 lines in 3 locations

src/SAML2/LogoutRequest.php 1 location

@@ 66-70 (lines=5) @@
63
        }
64
65
        $nameId = Utils::xpQuery($xml, './saml_assertion:NameID | ./saml_assertion:EncryptedID/xenc:EncryptedData');
66
        if (empty($nameId)) {
67
            throw new \Exception('Missing <saml:NameID> or <saml:EncryptedID> in <samlp:LogoutRequest>.');
68
        } elseif (count($nameId) > 1) {
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. */

src/SAML2/SubjectQuery.php 1 location

@@ 62-66 (lines=5) @@
59
        $subject = $subject[0];
60
61
        $nameId = Utils::xpQuery($subject, './saml_assertion:NameID');
62
        if (empty($nameId)) {
63
            throw new \Exception('Missing <saml:NameID> in <saml:Subject>.');
64
        } elseif (count($nameId) > 1) {
65
            throw new \Exception('More than one <saml:NameID> in <saml:Subject>.');
66
        }
67
        $nameId = $nameId[0];
68
        $this->nameId = new XML\saml\NameID($nameId);
69
    }

src/SAML2/AuthnRequest.php 1 location

@@ 202-206 (lines=5) @@
199
            $subject,
200
            './saml_assertion:NameID | ./saml_assertion:EncryptedID/xenc:EncryptedData'
201
        );
202
        if (empty($nameId)) {
203
            throw new \Exception('Missing <saml:NameID> or <saml:EncryptedID> in <saml:Subject>.');
204
        } elseif (count($nameId) > 1) {
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. */