| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | 14 | public function xmlSerialize(SimpleXMLElement $xmlRoot = null) |
|
| 43 | { |
||
| 44 | 14 | $xmlString = $this->getSerializer()->serialize($this, 'xml'); |
|
| 45 | 14 | $xmlObject = new SimpleXMLElement($xmlString); |
|
| 46 | |||
| 47 | 14 | if ($xmlRoot === null) { |
|
| 48 | 6 | return $xmlObject; |
|
| 49 | } |
||
| 50 | |||
| 51 | 8 | $domRoot = dom_import_simplexml($xmlRoot); |
|
| 52 | 8 | $domObject = dom_import_simplexml($xmlObject); |
|
| 53 | |||
| 54 | 8 | $domRoot->appendChild($domRoot->ownerDocument->importNode($domObject, true)); |
|
| 55 | |||
| 56 | 8 | return $xmlRoot; |
|
| 57 | } |
||
| 58 | |||
| 68 |