1 | <?php |
||
13 | class XML |
||
14 | { |
||
15 | /** |
||
16 | * XML to array. |
||
17 | * |
||
18 | * @param string $xml XML string |
||
19 | * |
||
20 | * @return array|\SimpleXMLElement |
||
21 | */ |
||
22 | public static function parse($xml) |
||
26 | |||
27 | /** |
||
28 | * XML encode. |
||
29 | * |
||
30 | * @param mixed $data |
||
31 | * @param string $root |
||
32 | * @param string $item |
||
33 | * @param string $attr |
||
34 | * @param string $id |
||
35 | * |
||
36 | * @return string |
||
37 | */ |
||
38 | public static function build( |
||
64 | |||
65 | /** |
||
66 | * Build CDATA. |
||
67 | * |
||
68 | * @param string $string |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | public static function cdata($string) |
||
76 | |||
77 | /** |
||
78 | * Object to array. |
||
79 | * |
||
80 | * |
||
81 | * @param SimpleXMLElement $obj |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | protected static function normalize($obj) |
||
108 | |||
109 | /** |
||
110 | * Array to XML. |
||
111 | * |
||
112 | * @param array $data |
||
113 | * @param string $item |
||
114 | * @param string $id |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | protected static function data2Xml($data, $item = 'item', $id = 'id') |
||
141 | } |
||
142 |