[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/releeph/conduit/work/ -> ReleephWorkGetAuthorInfoConduitAPIMethod.php (source)

   1  <?php
   2  
   3  final class ReleephWorkGetAuthorInfoConduitAPIMethod
   4    extends ReleephConduitAPIMethod {
   5  
   6    public function getAPIMethodName() {
   7      return 'releephwork.getauthorinfo';
   8    }
   9  
  10    public function getMethodStatus() {
  11      return self::METHOD_STATUS_UNSTABLE;
  12    }
  13  
  14    public function getMethodDescription() {
  15      return 'Return a string to use as the VCS author.';
  16    }
  17  
  18    public function defineParamTypes() {
  19      return array(
  20        'userPHID'  => 'required string',
  21        'vcsType'   => 'required string',
  22      );
  23    }
  24  
  25    public function defineReturnType() {
  26      return 'nonempty string';
  27    }
  28  
  29    public function defineErrorTypes() {
  30      return array();
  31    }
  32  
  33    protected function execute(ConduitAPIRequest $request) {
  34      $user = id(new PhabricatorUser())
  35        ->loadOneWhere('phid = %s', $request->getValue('userPHID'));
  36  
  37      $email = $user->loadPrimaryEmailAddress();
  38      if (is_numeric($email)) {
  39        $email = $user->getUserName().'@fb.com';
  40      }
  41  
  42      return sprintf(
  43        '%s <%s>',
  44        $user->getRealName(),
  45        $email);
  46    }
  47  
  48  }


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