3 final class DiffusionGitResponse
extends AphrontResponse
{
6 private $headers = array();
9 public function setGitData($data) {
10 list($headers, $body) = explode("\r\n\r\n", $data, 2);
11 $this->response
= $body;
12 $headers = explode("\r\n", $headers);
15 $this->httpCode
= 200;
16 $this->headers
= array();
17 foreach ($headers as $header) {
18 if (preg_match('/^Status:\s*(\d+)/i', $header, $matches)) {
19 $this->httpCode
= (int)$matches[1];
21 $this->headers
[] = explode(': ', $header, 2);
28 public function buildResponseString() {
29 return $this->response
;
32 public function getHeaders() {
33 return array_merge(parent
::getHeaders(), $this->headers
);
36 public function getCacheHeaders() {
40 public function getHTTPResponseCode() {
41 return $this->httpCode
;