private static function toNameId($value, $source, $destination) {
            $nameId = array(
                'Format' => SAML2_Const::NAMEID_PERSISTENT,
                'Value' => $value,
            );

            if (!empty($source)) {
                $nameId['NameQualifier'] = $source;
            }
            if (!empty($destination)) {
                $nameId['SPNameQualifier'] = $destination;
            }

            $doc = SAML2_DOMDocumentFactory::create();
            $root = $doc->createElement('root');
            $doc->appendChild($root);

            SAML2_Utils::addNameId($root, $nameId);

            return $doc->saveXML($root->firstChild);
	}