Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
RecentChangeSaveHandler
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
12
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
 onRecentChange_save
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2// phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
3
4namespace MediaWiki\Extension\AbuseFilter\Hooks\Handlers;
5
6use MediaWiki\Extension\AbuseFilter\ChangeTags\ChangeTagger;
7use MediaWiki\Hook\RecentChange_saveHook;
8
9class RecentChangeSaveHandler implements RecentChange_saveHook {
10    /** @var ChangeTagger */
11    private $changeTagger;
12
13    /**
14     * @param ChangeTagger $changeTagger
15     */
16    public function __construct( ChangeTagger $changeTagger ) {
17        $this->changeTagger = $changeTagger;
18    }
19
20    /**
21     * @inheritDoc
22     */
23    public function onRecentChange_save( $recentChange ) {
24        $tags = $this->changeTagger->getTagsForRecentChange( $recentChange );
25        if ( $tags ) {
26            $recentChange->addTags( $tags );
27        }
28    }
29}