Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / phrequent / conduit / PhrequentPopConduitAPIMethod.php
blob59b11bbbdc14b3f836fd3d510548bf84ea96a8c3
1 <?php
3 final class PhrequentPopConduitAPIMethod extends PhrequentConduitAPIMethod {
5 public function getAPIMethodName() {
6 return 'phrequent.pop';
9 public function getMethodDescription() {
10 return pht('Stop tracking time on an object by popping it from the stack.');
13 public function getMethodStatus() {
14 return self::METHOD_STATUS_UNSTABLE;
17 protected function defineParamTypes() {
18 return array(
19 'objectPHID' => 'phid',
20 'stopTime' => 'int',
21 'note' => 'string',
25 protected function defineReturnType() {
26 return 'phid';
29 protected function execute(ConduitAPIRequest $request) {
30 $user = $request->getUser();
31 $object_phid = $request->getValue('objectPHID');
32 $timestamp = $request->getValue('stopTime');
33 $note = $request->getValue('note');
34 if ($timestamp === null) {
35 $timestamp = time();
38 $editor = new PhrequentTrackingEditor();
40 if (!$object_phid) {
41 return $editor->stopTrackingTop($user, $timestamp, $note);
42 } else {
43 return $editor->stopTracking($user, $object_phid, $timestamp, $note);