Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
16.67% |
2 / 12 |
|
28.57% |
2 / 7 |
CRAP | |
0.00% |
0 / 1 |
ApiReadingListsTeardown | |
16.67% |
2 / 12 |
|
28.57% |
2 / 7 |
35.36 | |
0.00% |
0 / 1 |
execute | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getAllowedParams | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getHelpUrls | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getExamplesMessages | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
isWriteMode | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
mustBePosted | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isInternal | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\ReadingLists\Api; |
4 | |
5 | use ApiBase; |
6 | |
7 | /** |
8 | * API module for all write operations. |
9 | * Each operation (command) is implemented as a submodule. |
10 | */ |
11 | class ApiReadingListsTeardown extends ApiBase { |
12 | |
13 | use ApiTrait; |
14 | |
15 | /** @var string API module prefix */ |
16 | private static $prefix = ''; |
17 | |
18 | /** |
19 | * Entry point for executing the module |
20 | * @inheritDoc |
21 | */ |
22 | public function execute() { |
23 | $this->getReadingListRepository( $this->getUser() )->teardownForUser(); |
24 | } |
25 | |
26 | /** |
27 | * @inheritDoc |
28 | */ |
29 | protected function getAllowedParams() { |
30 | return []; |
31 | } |
32 | |
33 | /** |
34 | * @inheritDoc |
35 | */ |
36 | public function getHelpUrls() { |
37 | return [ |
38 | 'https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:ReadingLists#API', |
39 | ]; |
40 | } |
41 | |
42 | /** |
43 | * @inheritDoc |
44 | */ |
45 | protected function getExamplesMessages() { |
46 | return [ |
47 | 'action=readinglists&command=teardown&token=123ABC' |
48 | => 'apihelp-readinglists+teardown-example-1', |
49 | ]; |
50 | } |
51 | |
52 | // The parent module already enforces these but they make documentation nicer. |
53 | |
54 | /** |
55 | * @inheritDoc |
56 | */ |
57 | public function isWriteMode() { |
58 | return true; |
59 | } |
60 | |
61 | /** |
62 | * @inheritDoc |
63 | */ |
64 | public function mustBePosted() { |
65 | return true; |
66 | } |
67 | |
68 | /** |
69 | * @inheritDoc |
70 | */ |
71 | public function isInternal() { |
72 | // ReadingLists API is still experimental |
73 | return true; |
74 | } |
75 | |
76 | } |