Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
ContentTranslationHookRunner | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
onSectionTranslationBeforePublish | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace ContentTranslation; |
4 | |
5 | use MediaWiki\HookContainer\HookContainer; |
6 | use MediaWiki\Title\Title; |
7 | use User; |
8 | |
9 | class ContentTranslationHookRunner implements SectionTranslationBeforePublishHook { |
10 | |
11 | public const SERVICE_NAME = 'ContentTranslationHookRunner'; |
12 | |
13 | /** @var HookContainer */ |
14 | private $hookContainer; |
15 | |
16 | /** |
17 | * @param HookContainer $hookContainer |
18 | */ |
19 | public function __construct( HookContainer $hookContainer ) { |
20 | $this->hookContainer = $hookContainer; |
21 | } |
22 | |
23 | /** @inheritDoc */ |
24 | public function onSectionTranslationBeforePublish( |
25 | Title $title, |
26 | string $language, |
27 | User $user |
28 | ): void { |
29 | $this->hookContainer->run( |
30 | 'SectionTranslationBeforePublish', |
31 | [ $title, $language, $user ], |
32 | [ 'abortable' => false ] |
33 | ); |
34 | } |
35 | } |