Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
Tag | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
execute | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\AbuseFilter\Consequences\Consequence; |
4 | |
5 | use MediaWiki\Extension\AbuseFilter\ChangeTags\ChangeTagger; |
6 | use MediaWiki\Extension\AbuseFilter\Consequences\Parameters; |
7 | |
8 | /** |
9 | * Consequence that adds change tags once the edit is saved |
10 | */ |
11 | class Tag extends Consequence { |
12 | /** @var string[] */ |
13 | private $tags; |
14 | /** @var ChangeTagger */ |
15 | private $tagger; |
16 | |
17 | /** |
18 | * @param Parameters $parameters |
19 | * @param string[] $tags |
20 | * @param ChangeTagger $tagger |
21 | */ |
22 | public function __construct( Parameters $parameters, array $tags, ChangeTagger $tagger ) { |
23 | parent::__construct( $parameters ); |
24 | $this->tags = $tags; |
25 | $this->tagger = $tagger; |
26 | } |
27 | |
28 | /** |
29 | * @inheritDoc |
30 | */ |
31 | public function execute(): bool { |
32 | $this->tagger->addTags( $this->parameters->getActionSpecifier(), $this->tags ); |
33 | return true; |
34 | } |
35 | } |