1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 03:12:41 +01:00
phorge-phorge/src/applications/macro/conduit/MacroCreateMemeConduitAPIMethod.php
Joshua Spence 36e2d02d6e phtize all the things
Summary: `pht`ize a whole bunch of strings in rP.

Test Plan: Intense eyeballing.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: hach-que, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12797
2015-05-22 21:16:39 +10:00

57 lines
1.2 KiB
PHP

<?php
final class MacroCreateMemeConduitAPIMethod extends MacroConduitAPIMethod {
public function getAPIMethodName() {
return 'macro.creatememe';
}
public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE;
}
public function getMethodDescription() {
return pht('Generate a meme.');
}
protected function defineParamTypes() {
return array(
'macroName' => 'string',
'upperText' => 'optional string',
'lowerText' => 'optional string',
);
}
protected function defineReturnType() {
return 'string';
}
protected function defineErrorTypes() {
return array(
'ERR-NOT-FOUND' => pht('Macro was not found.'),
);
}
protected function execute(ConduitAPIRequest $request) {
$user = $request->getUser();
$macro_name = $request->getValue('macroName');
$upper_text = $request->getValue('upperText');
$lower_text = $request->getValue('lowerText');
$uri = PhabricatorMacroMemeController::generateMacro(
$user,
$macro_name,
$upper_text,
$lower_text);
if (!$uri) {
throw new ConduitException('ERR-NOT-FOUND');
}
return array(
'uri' => $uri,
);
}
}