53 if (!
$xml->hasAttribute(
'width')) {
54 throw new \Exception(
'Missing width of Logo.');
56 if (!
$xml->hasAttribute(
'height')) {
57 throw new \Exception(
'Missing height of Logo.');
59 if (!is_string(
$xml->textContent) || !strlen(
$xml->textContent)) {
60 throw new \Exception(
'Missing url value for Logo.');
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;
76 assert(is_int($this->width));
77 assert(is_int($this->height));
78 assert(is_string($this->url));
80 $doc = $parent->ownerDocument;
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);
89 $parent->appendChild($e);
toXML(\DOMElement $parent)
Convert this Logo to XML.
__construct(\DOMElement $xml=null)
Initialize a Logo.