1 | <?php |
||
9 | class Response |
||
10 | { |
||
11 | private $method; |
||
12 | private $response; |
||
13 | |||
14 | 9 | public function __construct(string $method, $response) |
|
22 | |||
23 | /** |
||
24 | * Checks if the response contains an Error |
||
25 | * @method hasError |
||
26 | * @author PA |
||
27 | * @date 2017-01-10 |
||
28 | * @return bool hasError |
||
29 | */ |
||
30 | 6 | public function hasError() : bool |
|
34 | |||
35 | /** |
||
36 | * Fetches the Error Code from the Response |
||
37 | * @method getErrorCode |
||
38 | * @author PA |
||
39 | * @date 2017-01-10 |
||
40 | * @return int Error Code |
||
41 | */ |
||
42 | 7 | public function getErrorCode() : int |
|
46 | |||
47 | /** |
||
48 | * Fetches the Error Message (including Extended Error Info) From Response |
||
49 | * @method getError |
||
50 | * @author PA |
||
51 | * @date 2017-01-10 |
||
52 | * @return string Error Message |
||
53 | */ |
||
54 | 3 | public function getError() : string |
|
64 | |||
65 | /** |
||
66 | * Converts the response to an Array |
||
67 | * @method toArray |
||
68 | * @throws YourMembershipResponseException |
||
69 | * @author PA |
||
70 | * @date 2017-01-10 |
||
71 | * @return array Response |
||
72 | */ |
||
73 | 2 | public function toArray() : array |
|
77 | |||
78 | /** |
||
79 | * Converts the response to an Object |
||
80 | * @method toObject |
||
81 | * @throws YourMembershipResponseException |
||
82 | * @author PA |
||
83 | * @date 2017-01-11 |
||
84 | * @return stdClass Response |
||
85 | */ |
||
86 | 3 | public function toObject() : \stdClass |
|
90 | |||
91 | /** |
||
92 | * Unwraps XML Object into either StdClass or Array |
||
93 | * Lossy conversion, attributes are lost from XML |
||
94 | * |
||
95 | * @method unwrapXMLObject |
||
96 | * @throws YourMembershipResponseException |
||
97 | * @author PA |
||
98 | * @date 2017-01-11 |
||
99 | * @param bool $asArray unwrap the object into an array instead of object |
||
100 | * @return mixed|null Unwrapped Response |
||
101 | */ |
||
102 | 5 | private function unwrapXMLObject(bool $asArray) |
|
111 | /** |
||
112 | * Returns the Result Count |
||
113 | * @method getResultCount |
||
114 | * @author PA |
||
115 | * @date 2017-01-10 |
||
116 | * @return int|false false if no ResultCount is present |
||
117 | */ |
||
118 | 1 | public function getResultCount() : int |
|
129 | |||
130 | } |
||
131 |