| 1 | <?php |
||
| 21 | class Response implements ResponseInterface |
||
| 22 | { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var \SimpleXMLElement |
||
| 26 | */ |
||
| 27 | private $data; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Constructor |
||
| 31 | * |
||
| 32 | * @param string $xml |
||
| 33 | */ |
||
| 34 | 12 | public function __construct($xml) |
|
| 38 | |||
| 39 | /** |
||
| 40 | * Property overloader. |
||
| 41 | * |
||
| 42 | * @param string $property |
||
| 43 | * @throws \ErrorException |
||
| 44 | * @return mixed |
||
| 45 | */ |
||
| 46 | 6 | public function __get($property) |
|
| 58 | |||
| 59 | /** |
||
| 60 | * Covert XML response data to array. |
||
| 61 | * |
||
| 62 | * @return array |
||
| 63 | */ |
||
| 64 | 2 | public function toArray() |
|
| 68 | |||
| 69 | /** |
||
| 70 | * Convery XML response data to JSON. |
||
| 71 | * |
||
| 72 | * @return string |
||
| 73 | */ |
||
| 74 | 4 | public function toJson() |
|
| 78 | } |
||
| 79 |