Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 47 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| ApiFlowViewTopicList | |
0.00% |
0 / 47 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getBlockParams | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAllowedParams | |
0.00% |
0 / 40 |
|
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 Wikimedia\ParamValidator\ParamValidator; |
| 6 | use Wikimedia\ParamValidator\TypeDef\IntegerDef; |
| 7 | |
| 8 | class ApiFlowViewTopicList extends ApiFlowBaseGet { |
| 9 | public function __construct( $api, $modName ) { |
| 10 | parent::__construct( $api, $modName, 'vtl' ); |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * Taken from ext.flow.base.js |
| 15 | * |
| 16 | * @return array |
| 17 | */ |
| 18 | protected function getBlockParams() { |
| 19 | return [ 'topiclist' => $this->extractRequestParams() ]; |
| 20 | } |
| 21 | |
| 22 | protected function getAction() { |
| 23 | return 'view-topiclist'; |
| 24 | } |
| 25 | |
| 26 | public function getAllowedParams() { |
| 27 | global $wgFlowDefaultLimit, $wgFlowMaxLimit; |
| 28 | |
| 29 | return [ |
| 30 | 'offset-dir' => [ |
| 31 | ParamValidator::PARAM_TYPE => [ 'fwd', 'rev' ], |
| 32 | ParamValidator::PARAM_DEFAULT => 'fwd', |
| 33 | ], |
| 34 | 'sortby' => [ |
| 35 | ParamValidator::PARAM_TYPE => [ 'newest', 'updated', 'user' ], |
| 36 | ParamValidator::PARAM_DEFAULT => 'user', |
| 37 | ], |
| 38 | 'savesortby' => [ |
| 39 | ParamValidator::PARAM_TYPE => 'boolean', |
| 40 | ParamValidator::PARAM_DEFAULT => false, |
| 41 | ], |
| 42 | 'offset-id' => [ |
| 43 | ParamValidator::PARAM_TYPE => 'string', |
| 44 | ParamValidator::PARAM_REQUIRED => false, |
| 45 | ], |
| 46 | 'offset' => [ |
| 47 | ParamValidator::PARAM_TYPE => 'string', |
| 48 | ParamValidator::PARAM_REQUIRED => false, |
| 49 | ], |
| 50 | 'include-offset' => [ |
| 51 | ParamValidator::PARAM_TYPE => 'boolean', |
| 52 | ParamValidator::PARAM_DEFAULT => false, |
| 53 | ], |
| 54 | 'limit' => [ |
| 55 | ParamValidator::PARAM_TYPE => 'limit', |
| 56 | ParamValidator::PARAM_DEFAULT => $wgFlowDefaultLimit, |
| 57 | IntegerDef::PARAM_MAX => $wgFlowMaxLimit, |
| 58 | IntegerDef::PARAM_MAX2 => $wgFlowMaxLimit, |
| 59 | ], |
| 60 | 'toconly' => [ |
| 61 | ParamValidator::PARAM_TYPE => 'boolean', |
| 62 | ParamValidator::PARAM_DEFAULT => false, |
| 63 | ], |
| 64 | 'format' => [ |
| 65 | ParamValidator::PARAM_TYPE => [ 'html', 'wikitext', 'fixed-html' ], |
| 66 | ParamValidator::PARAM_DEFAULT => 'fixed-html', |
| 67 | ], |
| 68 | ]; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * @inheritDoc |
| 73 | */ |
| 74 | protected function getExamplesMessages() { |
| 75 | return [ |
| 76 | 'action=flow&submodule=view-topiclist&page=Talk:Sandbox' |
| 77 | => 'apihelp-flow+view-topiclist-example-1', |
| 78 | ]; |
| 79 | } |
| 80 | } |