| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 12 | public function render(): string |
|
| 34 | { |
||
| 35 | 12 | $xml = new SimpleXMLElement('<?xml version="1.0" encoding="' . $this->encoding |
|
| 36 | 12 | . '" ?><rss version="2.0" xmlns:yandex="http://news.yandex.ru" xmlns:media="http://search.yahoo.com/mrss/" xmlns:turbo="http://turbo.yandex.ru" />', |
|
| 37 | 12 | LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
| 38 | |||
| 39 | 12 | foreach ($this->channels as $channel) { |
|
| 40 | 4 | $toDom = dom_import_simplexml($xml); |
|
| 41 | 4 | $fromDom = dom_import_simplexml($channel->asXML()); |
|
| 42 | 4 | $toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true)); |
|
| 43 | } |
||
| 44 | |||
| 45 | 12 | $dom = new DOMDocument('1.0', 'UTF-8'); |
|
| 46 | 12 | $dom->appendChild($dom->importNode(dom_import_simplexml($xml), true)); |
|
| 47 | 12 | $dom->formatOutput = true; |
|
| 48 | 12 | return $dom->saveXML(); |
|
| 49 | } |
||
| 50 | |||
| 56 |