ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SAML2\XML\mdui\Logo Class Reference
+ Collaboration diagram for SAML2\XML\mdui\Logo:

Public Member Functions

 __construct (\DOMElement $xml=null)
 Initialize a Logo. More...
 
 toXML (\DOMElement $parent)
 Convert this Logo to XML. More...
 

Data Fields

 $url
 
 $width
 
 $height
 
 $lang
 

Detailed Description

Definition at line 11 of file Logo.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\XML\mdui\Logo::__construct ( \DOMElement  $xml = null)

Initialize a Logo.

Parameters
\DOMElement | null$xmlThe XML element we should load.
Exceptions

Definition at line 47 of file Logo.php.

References $xml.

48  {
49  if ($xml === null) {
50  return;
51  }
52 
53  if (!$xml->hasAttribute('width')) {
54  throw new \Exception('Missing width of Logo.');
55  }
56  if (!$xml->hasAttribute('height')) {
57  throw new \Exception('Missing height of Logo.');
58  }
59  if (!is_string($xml->textContent) || !strlen($xml->textContent)) {
60  throw new \Exception('Missing url value for Logo.');
61  }
62  $this->url = $xml->textContent;
63  $this->width = (int) $xml->getAttribute('width');
64  $this->height = (int) $xml->getAttribute('height');
65  $this->lang = $xml->hasAttribute('xml:lang') ? $xml->getAttribute('xml:lang') : null;
66  }
$xml
Definition: metadata.php:240

Member Function Documentation

◆ toXML()

SAML2\XML\mdui\Logo::toXML ( \DOMElement  $parent)

Convert this Logo to XML.

Parameters
\DOMElement$parentThe element we should append this Logo to.
Returns

Definition at line 74 of file Logo.php.

References SAML2\XML\mdui\Common\NS.

75  {
76  assert(is_int($this->width));
77  assert(is_int($this->height));
78  assert(is_string($this->url));
79 
80  $doc = $parent->ownerDocument;
81 
82  $e = $doc->createElementNS(Common::NS, 'mdui:Logo');
83  $e->appendChild($doc->createTextNode($this->url));
84  $e->setAttribute('width', (int) $this->width);
85  $e->setAttribute('height', (int) $this->height);
86  if (isset($this->lang)) {
87  $e->setAttribute('xml:lang', $this->lang);
88  }
89  $parent->appendChild($e);
90 
91  return $e;
92  }

Field Documentation

◆ $height

SAML2\XML\mdui\Logo::$height

Definition at line 32 of file Logo.php.

◆ $lang

SAML2\XML\mdui\Logo::$lang

Definition at line 39 of file Logo.php.

◆ $url

SAML2\XML\mdui\Logo::$url

Definition at line 18 of file Logo.php.

◆ $width

SAML2\XML\mdui\Logo::$width

Definition at line 25 of file Logo.php.


The documentation for this class was generated from the following file: