[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class AphrontJSONResponse extends AphrontResponse { 4 5 private $content; 6 private $addJSONShield; 7 8 public function setContent($content) { 9 $this->content = $content; 10 return $this; 11 } 12 13 public function setAddJSONShield($should_add) { 14 $this->addJSONShield = $should_add; 15 return $this; 16 } 17 18 public function shouldAddJSONShield() { 19 if ($this->addJSONShield === null) { 20 return true; 21 } 22 return (bool) $this->addJSONShield; 23 } 24 25 public function buildResponseString() { 26 $response = $this->encodeJSONForHTTPResponse($this->content); 27 if ($this->shouldAddJSONShield()) { 28 $response = $this->addJSONShield($response); 29 } 30 return $response; 31 } 32 33 public function getHeaders() { 34 $headers = array( 35 array('Content-Type', 'application/json'), 36 ); 37 $headers = array_merge(parent::getHeaders(), $headers); 38 return $headers; 39 } 40 41 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |