Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
9 / 9 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
HookRunner | |
100.00% |
9 / 9 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
onORESCheckModels | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
onORESRecentChangeScoreSavedHook | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace ORES\Hooks; |
4 | |
5 | use MediaWiki\HookContainer\HookContainer; |
6 | use MediaWiki\Revision\RevisionRecord; |
7 | use RecentChange; |
8 | |
9 | /** |
10 | * This is a hook runner class, see docs/Hooks.md in core. |
11 | * @internal |
12 | */ |
13 | class HookRunner implements |
14 | ORESCheckModelsHook, |
15 | ORESRecentChangeScoreSavedHook |
16 | { |
17 | private HookContainer $hookContainer; |
18 | |
19 | public function __construct( HookContainer $hookContainer ) { |
20 | $this->hookContainer = $hookContainer; |
21 | } |
22 | |
23 | /** |
24 | * @inheritDoc |
25 | */ |
26 | public function onORESCheckModels( RecentChange $rc, array &$models ) { |
27 | return $this->hookContainer->run( |
28 | 'ORESCheckModels', |
29 | [ $rc, &$models ] |
30 | ); |
31 | } |
32 | |
33 | /** |
34 | * @inheritDoc |
35 | */ |
36 | public function onORESRecentChangeScoreSavedHook( RevisionRecord $revision, array $scores ) { |
37 | return $this->hookContainer->run( |
38 | 'ORESRecentChangeScoreSavedHook', |
39 | [ $revision, $scores ] |
40 | ); |
41 | } |
42 | } |