1 | <?php |
||
8 | class Response |
||
9 | { |
||
10 | private $method; |
||
11 | private $response; |
||
12 | |||
13 | 8 | public function __construct(string $method, $response) |
|
21 | |||
22 | /** |
||
23 | * Checks if the response contains an Error |
||
24 | * @method hasError |
||
25 | * @author PA |
||
26 | * @date 2017-01-10 |
||
27 | * @return bool hasError |
||
28 | */ |
||
29 | 5 | public function hasError() : bool |
|
33 | |||
34 | /** |
||
35 | * Fetches the Error Code from the Response |
||
36 | * @method getErrorCode |
||
37 | * @author PA |
||
38 | * @date 2017-01-10 |
||
39 | * @return int Error Code |
||
40 | */ |
||
41 | 6 | public function getErrorCode() : int |
|
45 | |||
46 | /** |
||
47 | * Fetches the Error Message From Response |
||
48 | * @method getError |
||
49 | * @author PA |
||
50 | * @date 2017-01-10 |
||
51 | * @return string Error Message |
||
52 | */ |
||
53 | 2 | public function getError() : string |
|
57 | |||
58 | /** |
||
59 | * Converts the response to an Array |
||
60 | * @method toArray |
||
61 | * @throws YourMembershipException |
||
62 | * @author PA |
||
63 | * @date 2017-01-10 |
||
64 | * @return array Response |
||
65 | */ |
||
66 | 2 | public function toArray() : array |
|
70 | |||
71 | /** |
||
72 | * Converts the response to an Object |
||
73 | * @method toObject |
||
74 | * @throws YourMembershipException |
||
75 | * @author PA |
||
76 | * @date 2017-01-11 |
||
77 | * @return stdClass Response |
||
78 | */ |
||
79 | 2 | public function toObject() : \stdClass |
|
83 | |||
84 | /** |
||
85 | * Unwraps XML Object into either StdClass or Array |
||
86 | * Lossy conversion, attributes are lost from XML |
||
87 | * |
||
88 | * @method unwrapXMLObject |
||
89 | * @throws YourMembershipException |
||
90 | * @author PA |
||
91 | * @date 2017-01-11 |
||
92 | * @param bool $asArray unwrap the object into an array instead of object |
||
93 | * @return mixed|null Unwrapped Response |
||
94 | */ |
||
95 | 4 | private function unwrapXMLObject(bool $asArray) |
|
104 | /** |
||
105 | * Returns the Result Count |
||
106 | * @method getResultCount |
||
107 | * @author PA |
||
108 | * @date 2017-01-10 |
||
109 | * @return int|false false if no ResultCount is present |
||
110 | */ |
||
111 | 1 | public function getResultCount() : int |
|
122 | |||
123 | } |
||
124 |