ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
DiscoHints.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\mdui;
4 
5 use SAML2\Utils;
7 
15 {
23  public $children = array();
24 
30  public $IPHint = array();
31 
37  public $DomainHint = array();
38 
44  public $GeolocationHint = array();
45 
51  public function __construct(\DOMElement $xml = null)
52  {
53  if ($xml === null) {
54  return;
55  }
56 
57  $this->IPHint = Utils::extractStrings($xml, Common::NS, 'IPHint');
58  $this->DomainHint = Utils::extractStrings($xml, Common::NS, 'DomainHint');
59  $this->GeolocationHint = Utils::extractStrings($xml, Common::NS, 'GeolocationHint');
60 
61  foreach (Utils::xpQuery($xml, "./*[namespace-uri()!='".Common::NS."']") as $node) {
62  $this->children[] = new Chunk($node);
63  }
64  }
65 
72  public function toXML(\DOMElement $parent)
73  {
74  assert(is_array($this->IPHint));
75  assert(is_array($this->DomainHint));
76  assert(is_array($this->GeolocationHint));
77  assert(is_array($this->children));
78 
79  if (!empty($this->IPHint)
80  || !empty($this->DomainHint)
81  || !empty($this->GeolocationHint)
82  || !empty($this->children)) {
83  $doc = $parent->ownerDocument;
84 
85  $e = $doc->createElementNS(Common::NS, 'mdui:DiscoHints');
86  $parent->appendChild($e);
87 
88  if (!empty($this->children)) {
89  foreach ($this->children as $child) {
90  $child->toXML($e);
91  }
92  }
93 
94  Utils::addStrings($e, Common::NS, 'mdui:IPHint', false, $this->IPHint);
95  Utils::addStrings($e, Common::NS, 'mdui:DomainHint', false, $this->DomainHint);
96  Utils::addStrings($e, Common::NS, 'mdui:GeolocationHint', false, $this->GeolocationHint);
97 
98  return $e;
99  }
100 
101  return null;
102  }
103 }
static extractStrings(\DOMElement $parent, $namespaceURI, $localName)
Extract strings from a set of nodes.
Definition: Utils.php:610
$xml
Definition: metadata.php:240
static addStrings(\DOMElement $parent, $namespace, $name, $localized, array $values)
Append string elements.
Definition: Utils.php:659
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
Create styles array
The data for the language used.
__construct(\DOMElement $xml=null)
Create a DiscoHints element.
Definition: DiscoHints.php:51
toXML(\DOMElement $parent)
Convert this DiscoHints to XML.
Definition: DiscoHints.php:72