Total Complexity | 5 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
20 | abstract class Response implements \ArrayAccess |
||
21 | { |
||
22 | use ArrayAccessTrait; |
||
23 | |||
24 | /** |
||
25 | * @param \SimpleXMLElement $xml |
||
26 | * @throws Exception |
||
27 | */ |
||
28 | public function __construct($xml) |
||
29 | { |
||
30 | $array = json_decode(json_encode($xml), true); |
||
31 | $array = array_map(function ($value) { |
||
32 | if (is_array($value) && empty($value)) { |
||
33 | return ''; |
||
34 | } |
||
35 | |||
36 | return $value; |
||
37 | }, $array); |
||
38 | $this->fromArray($array); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return mixed |
||
43 | */ |
||
44 | public function toXML() |
||
58 | } |
||
59 | |||
60 | public function isOK() |
||
63 | } |
||
64 | } |
||
65 |