Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / tokens / conduit / TokenGiveConduitAPIMethod.php
blobeb591025b2bfecf1942872d5dcee058c13164452
1 <?php
3 final class TokenGiveConduitAPIMethod extends TokenConduitAPIMethod {
5 public function getAPIMethodName() {
6 return 'token.give';
9 public function getMethodDescription() {
10 return pht('Give or change a token.');
13 protected function defineParamTypes() {
14 return array(
15 'tokenPHID' => 'phid|null',
16 'objectPHID' => 'phid',
20 protected function defineReturnType() {
21 return 'void';
24 protected function execute(ConduitAPIRequest $request) {
25 $content_source = $request->newContentSource();
27 $editor = id(new PhabricatorTokenGivenEditor())
28 ->setActor($request->getUser())
29 ->setContentSource($content_source);
31 if ($request->getValue('tokenPHID')) {
32 $editor->addToken(
33 $request->getValue('objectPHID'),
34 $request->getValue('tokenPHID'));
35 } else {
36 $editor->deleteToken($request->getValue('objectPHID'));