private function addSubject(\DOMElement $root)
{
if ($this->nameId === null && $this->encryptedNameId === null) {
/* We don't have anything to create a Subject node for. */
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');
$subject->appendChild($eid);
$eid->appendChild($subject->ownerDocument->importNode($this->encryptedNameId, true));
}
foreach ($this->SubjectConfirmation as $sc) {
$sc->toXML($subject);
}
}