Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/response/AphrontProxyResponse.php
| <?php | <?php | ||||
| /** | /** | ||||
| * Base class for responses which augment other types of responses. For example, | * Base class for responses which augment other types of responses. For example, | ||||
| * a response might be substantially an Ajax response, but add structure to the | * a response might be substantially an Ajax response, but add structure to the | ||||
| * response content. It can do this by extending @{class:AphrontProxyResponse}, | * response content. It can do this by extending @{class:AphrontProxyResponse}, | ||||
| * instantiating an @{class:AphrontAjaxResponse} in @{method:buildProxy}, and | * instantiating an @{class:AphrontAjaxResponse} in @{method:buildProxy}, and | ||||
| * then constructing a real @{class:AphrontAjaxResponse} in | * then constructing a real @{class:AphrontAjaxResponse} in | ||||
| * @{method:reduceProxyResponse}. | * @{method:reduceProxyResponse}. | ||||
| * | |||||
| * @group aphront | |||||
| */ | */ | ||||
| abstract class AphrontProxyResponse extends AphrontResponse { | abstract class AphrontProxyResponse extends AphrontResponse { | ||||
| private $proxy; | private $proxy; | ||||
| protected function getProxy() { | protected function getProxy() { | ||||
| if (!$this->proxy) { | if (!$this->proxy) { | ||||
| $this->proxy = $this->buildProxy(); | $this->proxy = $this->buildProxy(); | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | abstract class AphrontProxyResponse extends AphrontResponse { | ||||
| abstract protected function buildProxy(); | abstract protected function buildProxy(); | ||||
| abstract public function reduceProxyResponse(); | abstract public function reduceProxyResponse(); | ||||
| final public function buildResponseString() { | final public function buildResponseString() { | ||||
| throw new Exception( | throw new Exception( | ||||
| 'AphrontProxyResponse must implement reduceProxyResponse().'); | 'AphrontProxyResponse must implement reduceProxyResponse().'); | ||||
| } | } | ||||
| } | } | ||||