Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 24 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
| ApiFlowLockTopic | |
0.00% |
0 / 24 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getBlockParams | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| getAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| isDeprecated | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAllowedParams | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
2 | |||
| getExamplesMessages | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Flow\Api; |
| 4 | |
| 5 | use Flow\Model\AbstractRevision; |
| 6 | use Wikimedia\ParamValidator\ParamValidator; |
| 7 | |
| 8 | class ApiFlowLockTopic extends ApiFlowBasePost { |
| 9 | |
| 10 | public function __construct( $api, $modName ) { |
| 11 | parent::__construct( $api, $modName, 'cot' ); |
| 12 | } |
| 13 | |
| 14 | protected function getBlockParams() { |
| 15 | $params = $this->extractRequestParams(); |
| 16 | return [ |
| 17 | 'topic' => $params, |
| 18 | ]; |
| 19 | } |
| 20 | |
| 21 | protected function getAction() { |
| 22 | return 'lock-topic'; |
| 23 | } |
| 24 | |
| 25 | public function isDeprecated() { |
| 26 | return $this->getModuleName() === 'close-open-topic'; |
| 27 | } |
| 28 | |
| 29 | public function getAllowedParams() { |
| 30 | return [ |
| 31 | 'moderationState' => [ |
| 32 | ParamValidator::PARAM_REQUIRED => true, |
| 33 | ParamValidator::PARAM_TYPE => [ |
| 34 | AbstractRevision::MODERATED_LOCKED, 'unlock', |
| 35 | 'close', 'reopen' // BC: now replaced by lock & unlock |
| 36 | ], |
| 37 | ], |
| 38 | 'reason' => [ |
| 39 | ParamValidator::PARAM_REQUIRED => true, |
| 40 | ParamValidator::PARAM_TYPE => 'string', |
| 41 | ], |
| 42 | ] + parent::getAllowedParams(); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @inheritDoc |
| 47 | */ |
| 48 | protected function getExamplesMessages() { |
| 49 | return [ |
| 50 | 'action=flow&submodule=lock-topic&page=Topic:S2tycnas4hcucw8w&cotmoderationState=lock&cotreason=Ahhhh' |
| 51 | => 'apihelp-flow+lock-topic-example-1', |
| 52 | ]; |
| 53 | } |
| 54 | } |