[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Base class for responses which augment other types of responses. For example, 5 * a response might be substantially an Ajax response, but add structure to the 6 * response content. It can do this by extending @{class:AphrontProxyResponse}, 7 * instantiating an @{class:AphrontAjaxResponse} in @{method:buildProxy}, and 8 * then constructing a real @{class:AphrontAjaxResponse} in 9 * @{method:reduceProxyResponse}. 10 */ 11 abstract class AphrontProxyResponse extends AphrontResponse { 12 13 private $proxy; 14 15 protected function getProxy() { 16 if (!$this->proxy) { 17 $this->proxy = $this->buildProxy(); 18 } 19 return $this->proxy; 20 } 21 22 public function setRequest($request) { 23 $this->getProxy()->setRequest($request); 24 return $this; 25 } 26 27 public function getRequest() { 28 return $this->getProxy()->getRequest(); 29 } 30 31 public function getHeaders() { 32 return $this->getProxy()->getHeaders(); 33 } 34 35 public function setCacheDurationInSeconds($duration) { 36 $this->getProxy()->setCacheDurationInSeconds($duration); 37 return $this; 38 } 39 40 public function setLastModified($epoch_timestamp) { 41 $this->getProxy()->setLastModified($epoch_timestamp); 42 return $this; 43 } 44 45 public function setHTTPResponseCode($code) { 46 $this->getProxy()->setHTTPResponseCode($code); 47 return $this; 48 } 49 50 public function getHTTPResponseCode() { 51 return $this->getProxy()->getHTTPResponseCode(); 52 } 53 54 public function setFrameable($frameable) { 55 $this->getProxy()->setFrameable($frameable); 56 return $this; 57 } 58 59 public function getCacheHeaders() { 60 return $this->getProxy()->getCacheHeaders(); 61 } 62 63 abstract protected function buildProxy(); 64 abstract public function reduceProxyResponse(); 65 66 final public function buildResponseString() { 67 throw new Exception( 68 'AphrontProxyResponse must implement reduceProxyResponse().'); 69 } 70 71 }
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 |