[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/paste/conduit/ -> PasteInfoConduitAPIMethod.php (source)

   1  <?php
   2  
   3  final class PasteInfoConduitAPIMethod extends PasteConduitAPIMethod {
   4  
   5    public function getAPIMethodName() {
   6      return 'paste.info';
   7    }
   8  
   9    public function getMethodStatus() {
  10      return self::METHOD_STATUS_DEPRECATED;
  11    }
  12  
  13    public function getMethodStatusDescription() {
  14      return "Replaced by 'paste.query'.";
  15    }
  16  
  17    public function getMethodDescription() {
  18      return 'Retrieve an array of information about a paste.';
  19    }
  20  
  21    public function defineParamTypes() {
  22      return array(
  23        'paste_id' => 'required id',
  24      );
  25    }
  26  
  27    public function defineReturnType() {
  28      return 'nonempty dict';
  29    }
  30  
  31    public function defineErrorTypes() {
  32      return array(
  33        'ERR_BAD_PASTE' => 'No such paste exists',
  34      );
  35    }
  36  
  37    protected function execute(ConduitAPIRequest $request) {
  38      $paste_id = $request->getValue('paste_id');
  39      $paste = id(new PhabricatorPasteQuery())
  40        ->setViewer($request->getUser())
  41        ->withIDs(array($paste_id))
  42        ->needRawContent(true)
  43        ->executeOne();
  44      if (!$paste) {
  45        throw new ConduitException('ERR_BAD_PASTE');
  46      }
  47      return $this->buildPasteInfoDictionary($paste);
  48    }
  49  
  50  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1