Conditions | 3 |
Paths | 4 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
38 | 28 | public function asXML() |
|
39 | { |
||
40 | 28 | $infinity = $this->infinity ? 'type="infinity"' : ''; |
|
41 | |||
42 | 28 | $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><yandex:related xmlns:yandex="http://news.yandex.ru" ' |
|
43 | 28 | . $infinity . '></yandex:related>', LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); |
|
44 | |||
45 | 28 | foreach ($this->relatedItems as $item) { |
|
46 | 7 | $toDom = dom_import_simplexml($xml); |
|
47 | 7 | $fromDom = dom_import_simplexml($item->asXML()); |
|
48 | 7 | $toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true)); |
|
49 | 12 | } |
|
50 | |||
51 | 28 | return $xml; |
|
52 | } |
||
53 | } |
||
54 |