3 namespace Abraham\TwitterOAuth;
6 * The result of the most recent API request.
8 * @author Abraham Williams <abraham@abrah.am>
12 /** @var string|null API path from the most recent request */
14 /** @var int HTTP status code from the most recent request */
15 private $httpCode = 0;
16 /** @var array HTTP headers from the most recent request */
17 private $headers = [];
18 /** @var array|object Response body from the most recent request */
20 /** @var array HTTP headers from the most recent request that start with X */
21 private $xHeaders = [];
24 * @param string $apiPath
26 public function setApiPath($apiPath)
28 $this->apiPath = $apiPath;
34 public function getApiPath()
36 return $this->apiPath;
40 * @param array|object $body
42 public function setBody($body)
48 * @return array|object|string
50 public function getBody()
56 * @param int $httpCode
58 public function setHttpCode($httpCode)
60 $this->httpCode = $httpCode;
66 public function getHttpCode()
68 return $this->httpCode;
72 * @param array $headers
74 public function setHeaders(array $headers)
76 foreach ($headers as $key => $value) {
77 if (substr($key, 0, 1) == 'x') {
78 $this->xHeaders[$key] = $value;
81 $this->headers = $headers;
87 public function getsHeaders()
89 return $this->headers;
93 * @param array $xHeaders
95 public function setXHeaders(array $xHeaders = [])
97 $this->xHeaders = $xHeaders;
103 public function getXHeaders()
105 return $this->xHeaders;