| Conditions | 4 |
| Paths | 8 |
| Total Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | public function asHTML() |
||
| 42 | { |
||
| 43 | $DOMDoc = new DOMDocument('1.0', 'UTF-8'); |
||
| 44 | |||
| 45 | $titleH2 = $this->titleH2 ? $this->titleH2 : ''; |
||
| 46 | |||
| 47 | $headerDOMElement = $DOMDoc->createElement('header', $titleH2); |
||
| 48 | $headerDOMElement = $DOMDoc->appendChild($headerDOMElement); |
||
| 49 | |||
| 50 | if (!empty($this->titleH1)) { |
||
| 51 | $h1DOMElement = $DOMDoc->createElement('h1', $this->titleH1); |
||
| 52 | $headerDOMElement->appendChild($h1DOMElement); |
||
| 53 | } |
||
| 54 | |||
| 55 | if (!empty($this->img)) { |
||
| 56 | $figureDOMElement = $DOMDoc->createElement('figure'); |
||
| 57 | |||
| 58 | $imgDOMElement = $DOMDoc->createElement('img'); |
||
| 59 | $imgDOMElement->setAttribute('src', $this->img); |
||
| 60 | $figureDOMElement->appendChild($imgDOMElement); |
||
| 61 | |||
| 62 | $headerDOMElement->appendChild($figureDOMElement); |
||
| 63 | } |
||
| 64 | |||
| 65 | return strval(html_entity_decode($DOMDoc->saveHTML())); |
||
| 66 | } |
||
| 67 | } |
||
| 68 |