Remove product literal strings in "pht()", part 18
[phabricator.git] / src / applications / diffusion / response / DiffusionGitResponse.php
blob96a7b5bd757770cf60b7f26fc8a0663ab9a9811e
1 <?php
3 final class DiffusionGitResponse extends AphrontResponse {
5 private $httpCode;
6 private $headers = array();
7 private $response;
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);
14 $matches = null;
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];
20 } else {
21 $this->headers[] = explode(': ', $header, 2);
25 return $this;
28 public function buildResponseString() {
29 return $this->response;
32 public function getHeaders() {
33 return array_merge(parent::getHeaders(), $this->headers);
36 public function getCacheHeaders() {
37 return array();
40 public function getHTTPResponseCode() {
41 return $this->httpCode;