private function addSubject(\DOMElement $root)
{
// If there is no nameId (encrypted or not) there is nothing to create a subject for
if ($this->nameId === null && $this->encryptedNameId === null) {
return;
}
$subject = $root->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:Subject');
$root->appendChild($subject);
if ($this->encryptedNameId === null) {
Utils::addNameId($subject, $this->nameId);
} else {
$eid = $subject->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:EncryptedID');
$eid->appendChild($subject->ownerDocument->importNode($this->encryptedNameId, true));
$subject->appendChild($eid);
}
foreach ($this->subjectConfirmation as $sc) {
$sc->toXML($subject);
}
}