1 | <?php |
||
16 | class XmlStrategy implements StrategyInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | private $replacements = [ |
||
22 | Serializer::CLASS_IDENTIFIER_KEY => 'np_serializer_type', |
||
23 | Serializer::SCALAR_TYPE => 'np_serializer_scalar', |
||
24 | Serializer::SCALAR_VALUE => 'np_serializer_value', |
||
25 | Serializer::MAP_TYPE => 'np_serializer_map', |
||
26 | ]; |
||
27 | |||
28 | /** |
||
29 | * @param mixed $value |
||
30 | * |
||
31 | * @return string |
||
32 | */ |
||
33 | public function serialize($value) |
||
41 | |||
42 | /** |
||
43 | * @param array $replacements |
||
44 | * @param array $input |
||
45 | * |
||
46 | * @return array |
||
47 | */ |
||
48 | private static function replaceKeys(array &$replacements, array $input) |
||
63 | |||
64 | /** |
||
65 | * Converts an array to XML using SimpleXMLElement. |
||
66 | * |
||
67 | * @param array $data |
||
68 | * @param SimpleXMLElement $xmlData |
||
69 | */ |
||
70 | private function arrayToXml(array &$data, SimpleXMLElement $xmlData) |
||
84 | |||
85 | /** |
||
86 | * @param $value |
||
87 | * |
||
88 | * @return array |
||
89 | */ |
||
90 | public function unserialize($value) |
||
100 | |||
101 | /** |
||
102 | * @param array $array |
||
103 | */ |
||
104 | private static function castToArray(array &$array) |
||
116 | |||
117 | /** |
||
118 | * @param array $array |
||
119 | */ |
||
120 | private static function recoverArrayNumericKeyValues(array &$array) |
||
136 | |||
137 | /** |
||
138 | * @param $key |
||
139 | * |
||
140 | * @return float|int |
||
141 | */ |
||
142 | private static function getNumericKeyValue($key) |
||
153 | } |
||
154 |