1 | <?php |
||
10 | class ApiResponse |
||
11 | { |
||
12 | |||
13 | private function __construct() |
||
16 | |||
17 | const STATUS_SUCCESS = 'OK'; |
||
18 | |||
19 | /** |
||
20 | * @var bool |
||
21 | */ |
||
22 | protected $successful = false; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $response; |
||
28 | |||
29 | /** |
||
30 | * @var Error |
||
31 | */ |
||
32 | protected $error; |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $responseArray; |
||
38 | |||
39 | /** |
||
40 | * @return string |
||
41 | */ |
||
42 | public function getResponse() |
||
46 | |||
47 | /** |
||
48 | * @return boolean |
||
49 | */ |
||
50 | public function isSuccessful() |
||
54 | |||
55 | /** |
||
56 | * @return Error |
||
57 | */ |
||
58 | public function getError() |
||
62 | |||
63 | /** |
||
64 | * @return array |
||
65 | */ |
||
66 | public function getResponseArray() |
||
70 | |||
71 | /** |
||
72 | * @param Response $response |
||
73 | * |
||
74 | * @return ApiResponse |
||
75 | */ |
||
76 | public static function fromResponse(Response $response) |
||
98 | |||
99 | /** |
||
100 | * @param Response $response |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | private static function getResponseContent(Response $response): string |
||
111 | |||
112 | /** |
||
113 | * @param $xmlString |
||
114 | * |
||
115 | * @return array |
||
116 | */ |
||
117 | private static function arrayFromXml($xmlString) |
||
131 | |||
132 | /** |
||
133 | * Converts a ASCII string with UTF-8 characters in a UTF-8 string. |
||
134 | * Correctly encoded UTF-8 strings will be passed-through. |
||
135 | * |
||
136 | * @param string $string |
||
137 | * |
||
138 | * @return string |
||
139 | */ |
||
140 | public static function asciiToUTF8(string $string): string |
||
166 | } |
||
167 |