Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
ApiFlowViewPost
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 5
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getBlockParams
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getAction
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getAllowedParams
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
2
 getExamplesMessages
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Flow\Api;
4
5use Wikimedia\ParamValidator\ParamValidator;
6
7class ApiFlowViewPost extends ApiFlowBaseGet {
8    public function __construct( $api, $modName ) {
9        parent::__construct( $api, $modName, 'vp' );
10    }
11
12    /**
13     * Taken from ext.flow.base.js
14     *
15     * @return array
16     */
17    protected function getBlockParams() {
18        return [ 'topic' => $this->extractRequestParams() ];
19    }
20
21    protected function getAction() {
22        return 'view-post';
23    }
24
25    public function getAllowedParams() {
26        return [
27            'postId' => [
28                ParamValidator::PARAM_REQUIRED => true,
29            ],
30            'format' => [
31                ParamValidator::PARAM_TYPE => [ 'html', 'wikitext', 'fixed-html' ],
32                ParamValidator::PARAM_DEFAULT => 'fixed-html',
33            ],
34        ];
35    }
36
37    /**
38     * @inheritDoc
39     */
40    protected function getExamplesMessages() {
41        return [
42            'action=flow&submodule=view-post&page=Topic:S2tycnas4hcucw8w&vppostId=???&vpformat=wikitext'
43                => 'apihelp-flow+view-post-example-1',
44        ];
45    }
46}