1 | <?php |
||
10 | class XML |
||
11 | { |
||
12 | /** |
||
13 | * XML to array. |
||
14 | * |
||
15 | * @param string $xml XML string |
||
16 | * |
||
17 | * @return array|\SimpleXMLElement |
||
18 | */ |
||
19 | public static function parse($xml) |
||
23 | |||
24 | /** |
||
25 | * XML encode. |
||
26 | * |
||
27 | * @param mixed $data |
||
28 | * @param string $root |
||
29 | * @param string $item |
||
30 | * @param string $attr |
||
31 | * @param string $id |
||
32 | * |
||
33 | * @return string |
||
34 | */ |
||
35 | public static function build( |
||
60 | |||
61 | /** |
||
62 | * Build CDATA. |
||
63 | * |
||
64 | * @param string $string |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | public static function cdata($string) |
||
72 | |||
73 | /** |
||
74 | * Object to array. |
||
75 | * |
||
76 | * |
||
77 | * @param SimpleXMLElement $obj |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | protected static function normalize($obj) |
||
104 | |||
105 | /** |
||
106 | * Array to XML. |
||
107 | * |
||
108 | * @param array $data |
||
109 | * @param string $item |
||
110 | * @param string $id |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | protected static function data2Xml($data, $item = 'item', $id = 'id') |
||
137 | } |
||
138 |