1 | <?php |
||
6 | class DropboxResponse |
||
7 | { |
||
8 | /** |
||
9 | * The HTTP status code response |
||
10 | * |
||
11 | * @var int |
||
12 | */ |
||
13 | protected $httpStatusCode; |
||
14 | |||
15 | /** |
||
16 | * The headers returned |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | protected $headers; |
||
21 | |||
22 | /** |
||
23 | * The raw body of the response |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $body; |
||
28 | |||
29 | /** |
||
30 | * The decoded body of the response |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $decodedBody = []; |
||
35 | |||
36 | /** |
||
37 | * The original request that returned this response |
||
38 | * |
||
39 | * @var DropboxRequest |
||
40 | */ |
||
41 | protected $request; |
||
42 | |||
43 | /** |
||
44 | * Create a new DropboxResponse instance |
||
45 | * |
||
46 | * @param DropboxRequest $request |
||
47 | * @param string|null $body |
||
48 | * @param int|null $httpStatusCode |
||
49 | * @param array $headers |
||
50 | */ |
||
51 | 48 | public function __construct(DropboxRequest $request, $body = null, $httpStatusCode = null, array $headers = []) |
|
58 | |||
59 | /** |
||
60 | * @param string $body |
||
61 | */ |
||
62 | 47 | public function setBody($body) |
|
66 | |||
67 | /** |
||
68 | * @param int $httpStatusCode |
||
69 | */ |
||
70 | 48 | public function setHttpStatusCode($httpStatusCode) |
|
74 | |||
75 | /** |
||
76 | * @param array $headers |
||
77 | */ |
||
78 | 48 | public function setHeaders(array $headers) |
|
82 | |||
83 | /** |
||
84 | * Get the Request Request |
||
85 | * |
||
86 | * @return \Kunnu\Dropbox\DropboxRequest |
||
87 | */ |
||
88 | 44 | public function getRequest() |
|
92 | |||
93 | /** |
||
94 | * Get the Response Body |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | 46 | public function getBody() |
|
102 | |||
103 | /** |
||
104 | * Get the Decoded Body |
||
105 | * |
||
106 | * @return array |
||
107 | */ |
||
108 | 44 | public function getDecodedBody() |
|
117 | |||
118 | /** |
||
119 | * Get Access Token for the Request |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | public function getAccessToken() |
||
127 | |||
128 | /** |
||
129 | * Get Request Headers |
||
130 | * |
||
131 | * @return array |
||
132 | */ |
||
133 | 3 | public function getHeaders() |
|
134 | { |
||
135 | 3 | return $this->headers; |
|
136 | } |
||
137 | |||
138 | /** |
||
139 | * Get the HTTP Status Code |
||
140 | * |
||
141 | * @return int |
||
142 | */ |
||
143 | public function getHttpStatusCode() |
||
147 | |||
148 | /** |
||
149 | * Decode the Body |
||
150 | * |
||
151 | * @throws DropboxClientException |
||
152 | * |
||
153 | * @return void |
||
154 | */ |
||
155 | 44 | protected function decodeBody() |
|
169 | |||
170 | /** |
||
171 | * Validate Response |
||
172 | * |
||
173 | * @return void |
||
174 | * |
||
175 | * @throws \Kunnu\Dropbox\Exceptions\DropboxClientException |
||
176 | */ |
||
177 | 44 | protected function validateResponse() |
|
184 | } |
||
185 |