Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
PHP
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108<?php
abstract class AphrontController extends Phobject {
private $request; private $currentApplication; private $delegatingController;
public function setDelegatingController( AphrontController $delegating_controller) { $this->delegatingController = $delegating_controller; return $this; }
public function getDelegatingController() { return $this->delegatingController; }
public function willBeginExecution() { return; }
public function willProcessRequest(array $uri_data) { return; }
public function handleRequest(AphrontRequest $request) { if (method_exists($this, 'processRequest')) { return $this->processRequest(); }
throw new PhutilMethodNotImplementedException( pht( 'Controllers must implement either %s (recommended) '. 'or %s (deprecated).', 'handleRequest()', 'processRequest()')); }
public function willSendResponse(AphrontResponse $response) { return $response; }
final public function setRequest(AphrontRequest $request) { $this->request = $request; return $this; }
final public function getRequest() { if (!$this->request) { throw new PhutilInvalidStateException('setRequest'); } return $this->request; }
final public function getViewer() { return $this->getRequest()->getViewer(); }
final public function delegateToController(AphrontController $controller) { $request = $this->getRequest();
$controller->setDelegatingController($this); $controller->setRequest($request);
$application = $this->getCurrentApplication(); if ($application) { $controller->setCurrentApplication($application); }
return $controller->handleRequest($request); }
final public function setCurrentApplication( PhabricatorApplication $current_application) {
$this->currentApplication = $current_application; return $this; }
final public function getCurrentApplication() { return $this->currentApplication; }
public function getDefaultResourceSource() { throw new PhutilMethodNotImplementedException( pht( 'A Controller must implement %s before you can invoke %s or %s.', 'getDefaultResourceSource()', 'requireResource()', 'initBehavior()')); }
public function requireResource($symbol) { $response = CelerityAPI::getStaticResourceResponse(); $response->requireResource($symbol, $this->getDefaultResourceSource()); return $this; }
public function initBehavior($name, $config = array()) { Javelin::initBehavior( $name, $config, $this->getDefaultResourceSource()); }
}