Path: blob/master/src/applications/diffusion/response/DiffusionGitResponse.php
12241 views
<?php12final class DiffusionGitResponse extends AphrontResponse {34private $httpCode;5private $headers = array();6private $response;78public function setGitData($data) {9list($headers, $body) = explode("\r\n\r\n", $data, 2);10$this->response = $body;11$headers = explode("\r\n", $headers);1213$matches = null;14$this->httpCode = 200;15$this->headers = array();16foreach ($headers as $header) {17if (preg_match('/^Status:\s*(\d+)/i', $header, $matches)) {18$this->httpCode = (int)$matches[1];19} else {20$this->headers[] = explode(': ', $header, 2);21}22}2324return $this;25}2627public function buildResponseString() {28return $this->response;29}3031public function getHeaders() {32return array_merge(parent::getHeaders(), $this->headers);33}3435public function getCacheHeaders() {36return array();37}3839public function getHTTPResponseCode() {40return $this->httpCode;41}4243}444546