summaryrefslogtreecommitdiffstats
path: root/lib/SAML2/XML/ds/KeyName.php
blob: 6eae3a4f2addb5cbe4304495da5ac2f4d0f6334e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

/**
 * Class representing a ds:KeyName element.
 *
 * @package simpleSAMLphp
 * @version $Id$
 */
class SAML2_XML_ds_KeyName {

	/**
	 * The key name.
	 *
	 * @var string
	 */
	public $name;


	/**
	 * Initialize a KeyName element.
	 *
	 * @param DOMElement|NULL $xml  The XML element we should load.
	 */
	public function __construct(DOMElement $xml = NULL) {

		if ($xml === NULL) {
			return;
		}

		$this->name = $xml->textContent;
	}


	/**
	 * Convert this KeyName element to XML.
	 *
	 * @param DOMElement $parent  The element we should append this KeyName element to.
	 */
	public function toXML(DOMElement $parent) {
		assert('is_string($this->name)');

		return SAML2_Utils::addString($parent, XMLSecurityDSig::XMLDSIGNS, 'ds:KeyName', $this->name);
	}

}