ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AdditionalMetadataLocation.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\md;
4 
6 use SAML2\Utils;
7 
14 {
20  public $namespace;
21 
27  public $location;
28 
35  public function __construct(\DOMElement $xml = null)
36  {
37  if ($xml === null) {
38  return;
39  }
40 
41  if (!$xml->hasAttribute('namespace')) {
42  throw new \Exception('Missing namespace attribute on AdditionalMetadataLocation element.');
43  }
44  $this->namespace = $xml->getAttribute('namespace');
45 
46  $this->location = $xml->textContent;
47  }
48 
55  public function toXML(\DOMElement $parent)
56  {
57  assert(is_string($this->namespace));
58  assert(is_string($this->location));
59 
60  $e = Utils::addString($parent, Constants::NS_MD, 'md:AdditionalMetadataLocation', $this->location);
61  $e->setAttribute('namespace', $this->namespace);
62 
63  return $e;
64  }
65 }
toXML(\DOMElement $parent)
Convert this AdditionalMetadataLocation to XML.
static addString(\DOMElement $parent, $namespace, $name, $value)
Append string element.
Definition: Utils.php:635
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:230
__construct(\DOMElement $xml=null)
Initialize an AdditionalMetadataLocation element.