1 | <?php |
||
9 | class Response |
||
10 | { |
||
11 | private $method; |
||
12 | private $response; |
||
13 | |||
14 | 10 | 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 |
|
66 | |||
67 | /** |
||
68 | * Fetches the Extended Error from the Response |
||
69 | * @return string |
||
70 | * @author TLS |
||
71 | * @date 1-30-2017 |
||
72 | */ |
||
73 | 4 | public function getExtendedError() : string |
|
77 | |||
78 | /** |
||
79 | * Converts the response to an Array |
||
80 | * @method toArray |
||
81 | * @throws YourMembershipResponseException |
||
82 | * @author PA |
||
83 | * @date 2017-01-10 |
||
84 | * @return array Response |
||
85 | */ |
||
86 | 2 | public function toArray() : array |
|
90 | |||
91 | /** |
||
92 | * Converts the response to an Object |
||
93 | * @method toObject |
||
94 | * @throws YourMembershipResponseException |
||
95 | * @author PA |
||
96 | * @date 2017-01-11 |
||
97 | * @return stdClass Response |
||
98 | */ |
||
99 | 3 | public function toObject() : \stdClass |
|
103 | |||
104 | /** |
||
105 | * Unwraps XML Object into either StdClass or Array |
||
106 | * Lossy conversion, attributes are lost from XML |
||
107 | * |
||
108 | * @method unwrapXMLObject |
||
109 | * @throws YourMembershipResponseException |
||
110 | * @author PA |
||
111 | * @date 2017-01-11 |
||
112 | * @param bool $asArray unwrap the object into an array instead of object |
||
113 | * @return mixed|null Unwrapped Response |
||
114 | */ |
||
115 | 5 | private function unwrapXMLObject(bool $asArray) |
|
124 | /** |
||
125 | * Returns the Result Count |
||
126 | * @method getResultCount |
||
127 | * @author PA |
||
128 | * @date 2017-01-10 |
||
129 | * @return int|false false if no ResultCount is present |
||
130 | */ |
||
131 | 1 | public function getResultCount() : int |
|
142 | |||
143 | } |
||
144 |