[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/phrequent/conduit/ -> PhrequentPopConduitAPIMethod.php (source)

   1  <?php
   2  
   3  final class PhrequentPopConduitAPIMethod extends PhrequentConduitAPIMethod {
   4  
   5    public function getAPIMethodName() {
   6      return 'phrequent.pop';
   7    }
   8  
   9    public function getMethodDescription() {
  10      return pht('Stop tracking time on an object by popping it from the stack.');
  11    }
  12  
  13    public function getMethodStatus() {
  14      return self::METHOD_STATUS_UNSTABLE;
  15    }
  16  
  17    public function defineParamTypes() {
  18      return array(
  19        'objectPHID' => 'phid',
  20        'stopTime' => 'int',
  21        'note' => 'string',
  22      );
  23    }
  24  
  25    public function defineReturnType() {
  26      return 'phid';
  27    }
  28  
  29    public function defineErrorTypes() {
  30      return array(
  31      );
  32    }
  33  
  34    protected function execute(ConduitAPIRequest $request) {
  35      $user = $request->getUser();
  36      $object_phid = $request->getValue('objectPHID');
  37      $timestamp = $request->getValue('stopTime');
  38      $note = $request->getValue('note');
  39      if ($timestamp === null) {
  40        $timestamp = time();
  41      }
  42  
  43      $editor = new PhrequentTrackingEditor();
  44  
  45      if (!$object_phid) {
  46        return $editor->stopTrackingTop($user, $timestamp, $note);
  47      } else {
  48        return $editor->stopTracking($user, $object_phid, $timestamp, $note);
  49      }
  50    }
  51  
  52  }


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