ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Organization.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\md;
4 
6 use SAML2\Utils;
7 
14 {
22  public $Extensions = array();
23 
29  public $OrganizationName = array();
30 
36  public $OrganizationDisplayName = array();
37 
43  public $OrganizationURL = array();
44 
50  public function __construct(\DOMElement $xml = null)
51  {
52  if ($xml === null) {
53  return;
54  }
55 
57 
58  $this->OrganizationName = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'OrganizationName');
59  if (empty($this->OrganizationName)) {
60  $this->OrganizationName = array('invalid' => '');
61  }
62 
63  $this->OrganizationDisplayName = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'OrganizationDisplayName');
64  if (empty($this->OrganizationDisplayName)) {
65  $this->OrganizationDisplayName = array('invalid' => '');
66  }
67 
68  $this->OrganizationURL = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'OrganizationURL');
69  if (empty($this->OrganizationURL)) {
70  $this->OrganizationURL = array('invalid' => '');
71  }
72  }
73 
80  public function toXML(\DOMElement $parent)
81  {
82  assert(is_array($this->Extensions));
83  assert(is_array($this->OrganizationName));
84  assert(!empty($this->OrganizationName));
85  assert(is_array($this->OrganizationDisplayName));
86  assert(!empty($this->OrganizationDisplayName));
87  assert(is_array($this->OrganizationURL));
88  assert(!empty($this->OrganizationURL));
89 
90  $doc = $parent->ownerDocument;
91 
92  $e = $doc->createElementNS(Constants::NS_MD, 'md:Organization');
93  $parent->appendChild($e);
94 
95  Extensions::addList($e, $this->Extensions);
96 
97  Utils::addStrings($e, Constants::NS_MD, 'md:OrganizationName', true, $this->OrganizationName);
98  Utils::addStrings($e, Constants::NS_MD, 'md:OrganizationDisplayName', true, $this->OrganizationDisplayName);
99  Utils::addStrings($e, Constants::NS_MD, 'md:OrganizationURL', true, $this->OrganizationURL);
100 
101  return $e;
102  }
103 }
toXML(\DOMElement $parent)
Convert this Organization to XML.
static extractLocalizedStrings(\DOMElement $parent, $namespaceURI, $localName)
Extract localized strings from a set of nodes.
Definition: Utils.php:580
__construct(\DOMElement $xml=null)
Initialize an Organization element.
static addStrings(\DOMElement $parent, $namespace, $name, $localized, array $values)
Append string elements.
Definition: Utils.php:659
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:230
static addList(\DOMElement $parent, array $extensions)
Add a list of Extensions to the given element.
Definition: Extensions.php:70
static getList(\DOMElement $parent)
Get a list of Extensions in the given element.
Definition: Extensions.php:27