Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
UserEditCountUpdateHookHandler | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
onUserEditCountUpdate | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
3 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\CentralAuth\Hooks\Handlers; |
4 | |
5 | use MediaWiki\Extension\CentralAuth\CentralAuthEditCounter; |
6 | use MediaWiki\Extension\CentralAuth\User\CentralAuthUser; |
7 | use MediaWiki\Hook\UserEditCountUpdateHook; |
8 | |
9 | class UserEditCountUpdateHookHandler implements UserEditCountUpdateHook { |
10 | |
11 | private CentralAuthEditCounter $editCounter; |
12 | |
13 | public function __construct( CentralAuthEditCounter $editCounter ) { |
14 | $this->editCounter = $editCounter; |
15 | } |
16 | |
17 | /** @inheritDoc */ |
18 | public function onUserEditCountUpdate( $infos ): void { |
19 | foreach ( $infos as $info ) { |
20 | $centralUser = CentralAuthUser::getInstanceByName( $info->getUser()->getName() ); |
21 | if ( $centralUser->isAttached() ) { |
22 | $this->editCounter->increment( $centralUser, $info->getIncrement() ); |
23 | } |
24 | } |
25 | } |
26 | } |