SAML2\Assertion::addSubject PHP Method

addSubject() private method

Add a Subject-node to the assertion.
private addSubject ( DOMElement $root )
$root DOMElement The assertion element we should add the subject to.
    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);
        }
    }