Path: blob/master/src/aphront/response/AphrontJSONResponse.php
12241 views
<?php12final class AphrontJSONResponse extends AphrontResponse {34private $content;5private $addJSONShield;67public function setContent($content) {8$this->content = $content;9return $this;10}1112public function setAddJSONShield($should_add) {13$this->addJSONShield = $should_add;14return $this;15}1617public function shouldAddJSONShield() {18if ($this->addJSONShield === null) {19return true;20}21return (bool)$this->addJSONShield;22}2324public function buildResponseString() {25$response = $this->encodeJSONForHTTPResponse($this->content);26if ($this->shouldAddJSONShield()) {27$response = $this->addJSONShield($response);28}29return $response;30}3132public function getHeaders() {33$headers = parent::getHeaders();3435$headers[] = array('Content-Type', 'application/json');3637return $headers;38}3940}414243