[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/diffusion/response/ -> DiffusionGitResponse.php (source)

   1  <?php
   2  
   3  final class DiffusionGitResponse extends AphrontResponse {
   4  
   5    private $httpCode;
   6    private $headers = array();
   7    private $response;
   8  
   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);
  13  
  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);
  22        }
  23      }
  24  
  25      return $this;
  26    }
  27  
  28    public function buildResponseString() {
  29      return $this->response;
  30    }
  31  
  32    public function getHeaders() {
  33      return array_merge(parent::getHeaders(), $this->headers);
  34    }
  35  
  36    public function getCacheHeaders() {
  37      return array();
  38    }
  39  
  40    public function getHTTPResponseCode() {
  41      return $this->httpCode;
  42    }
  43  
  44  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1