Total Complexity | 2 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class SimpleXMLElement extends SimpleXMLElementSimpleXMLElement |
||
14 | { |
||
15 | /** |
||
16 | * @param string $sName |
||
17 | * @param string $sValue |
||
18 | * |
||
19 | * @return \SimpleXMLElement|bool |
||
20 | */ |
||
21 | public function addCDataChild($sName, $sValue) |
||
22 | { |
||
23 | $dom = new DOMDocument(); |
||
24 | $cDataNode = $dom->appendChild($dom->createElement($sName)); |
||
25 | $cDataNode->appendChild($dom->createCDATASection($this->removeSpecialChars($sValue))); |
||
26 | $oNodeOld = dom_import_simplexml($this); |
||
27 | $oNodeTarget = $oNodeOld->ownerDocument->importNode($cDataNode, true); |
||
28 | $oNodeOld->appendChild($oNodeTarget); |
||
29 | |||
30 | return simplexml_import_dom($oNodeTarget, 'SimpleXMLElement'); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * This method replaced all zoot signs |
||
35 | * |
||
36 | * @param string $str |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | protected function removeSpecialChars($str) |
||
65 | } |
||
66 | } |
||
67 |