[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/macro/conduit/ -> MacroCreateMemeConduitAPIMethod.php (source)

   1  <?php
   2  
   3  final class MacroCreateMemeConduitAPIMethod extends MacroConduitAPIMethod {
   4  
   5    public function getAPIMethodName() {
   6      return 'macro.creatememe';
   7    }
   8  
   9    public function getMethodStatus() {
  10      return self::METHOD_STATUS_UNSTABLE;
  11    }
  12  
  13    public function getMethodDescription() {
  14      return pht('Generate a meme.');
  15    }
  16  
  17    public function defineParamTypes() {
  18      return array(
  19        'macroName'    => 'string',
  20        'upperText'    => 'optional string',
  21        'lowerText'    => 'optional string',
  22      );
  23    }
  24  
  25    public function defineReturnType() {
  26      return 'string';
  27    }
  28  
  29    public function defineErrorTypes() {
  30      return array(
  31        'ERR-NOT-FOUND' => 'Macro was not found.',
  32      );
  33    }
  34  
  35    protected function execute(ConduitAPIRequest $request) {
  36      $user = $request->getUser();
  37  
  38      $macro_name = $request->getValue('macroName');
  39      $upper_text = $request->getValue('upperText');
  40      $lower_text = $request->getValue('lowerText');
  41  
  42      $uri = PhabricatorMacroMemeController::generateMacro(
  43        $user,
  44        $macro_name,
  45        $upper_text,
  46        $lower_text);
  47  
  48      if (!$uri) {
  49        throw new ConduitException('ERR-NOT-FOUND');
  50      }
  51  
  52      return array(
  53        'uri' => $uri,
  54      );
  55    }
  56  
  57  }


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