Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 17 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
ApiCentralNoticeQueryActiveCampaigns | |
0.00% |
0 / 17 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
execute | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
getAllowedParams | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
getExamplesMessages | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * Query of currently active CentralNotice campaigns. |
5 | */ |
6 | |
7 | class ApiCentralNoticeQueryActiveCampaigns extends ApiQueryBase { |
8 | |
9 | public function __construct( ApiQuery $query, $moduleName ) { |
10 | // Though there are no parameters, we set a prefix for them, just in case we |
11 | // add parameters later. |
12 | parent::__construct( $query, $moduleName, 'cnac' ); |
13 | } |
14 | |
15 | public function execute() { |
16 | $params = $this->extractRequestParams(); |
17 | |
18 | // Obtain the ApiResults object from the base class |
19 | $result = $this->getResult(); |
20 | |
21 | $result->addValue( |
22 | [ 'query', $this->getModuleName() ], |
23 | 'campaigns', |
24 | Campaign::getActiveCampaignsAndBanners( $params[ 'includefuture' ] ) |
25 | ); |
26 | } |
27 | |
28 | public function getAllowedParams() { |
29 | return [ |
30 | 'includefuture' => [ |
31 | ApiBase::PARAM_TYPE => 'boolean' |
32 | ] |
33 | ]; |
34 | } |
35 | |
36 | /** |
37 | * @inheritDoc |
38 | */ |
39 | protected function getExamplesMessages() { |
40 | return [ |
41 | 'action=query&list=centralnoticeactivecampaigns&format=json' |
42 | => 'apihelp-query+centralnoticeactivecampaigns-example-1', |
43 | ]; |
44 | } |
45 | } |