Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
17 / 17
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
HookRunner
100.00% covered (success)
100.00%
17 / 17
100.00% covered (success)
100.00%
5 / 5
5
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 onEditFilterMergedContent
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onEditPage__showEditForm_initial
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onUploadStashFile
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onUploadVerifyUpload
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3// phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
4
5namespace FileImporter;
6
7use MediaWiki\Hook\EditFilterMergedContentHook;
8use MediaWiki\Hook\EditPage__showEditForm_initialHook;
9use MediaWiki\Hook\UploadStashFileHook;
10use MediaWiki\Hook\UploadVerifyUploadHook;
11use MediaWiki\HookContainer\HookContainer;
12
13/**
14 * This is a hook runner class, see docs/Hooks.md in core.
15 * @internal
16 * @license GPL-2.0-or-later
17 */
18class HookRunner implements
19    EditFilterMergedContentHook,
20    EditPage__showEditForm_initialHook,
21    UploadStashFileHook,
22    UploadVerifyUploadHook
23{
24    private HookContainer $hookContainer;
25
26    public function __construct( HookContainer $hookContainer ) {
27        $this->hookContainer = $hookContainer;
28    }
29
30    /**
31     * @inheritDoc
32     */
33    public function onEditFilterMergedContent( $context, $content, $status,
34        $summary, $user, $minoredit
35    ) {
36        return $this->hookContainer->run(
37            'EditFilterMergedContent',
38            [ $context, $content, $status, $summary, $user, $minoredit ]
39        );
40    }
41
42    /**
43     * @inheritDoc
44     */
45    public function onEditPage__showEditForm_initial( $editor, $out ) {
46        return $this->hookContainer->run(
47            'EditPage::showEditForm:initial',
48            [ $editor, $out ]
49        );
50    }
51
52    /**
53     * @inheritDoc
54     */
55    public function onUploadStashFile( $upload, $user, $props, &$error ) {
56        return $this->hookContainer->run(
57            'UploadStashFile',
58            [ $upload, $user, $props, &$error ]
59        );
60    }
61
62    /**
63     * @inheritDoc
64     */
65    public function onUploadVerifyUpload( $upload, $user, $props, $comment,
66        $pageText, &$error
67    ) {
68        return $this->hookContainer->run(
69            'UploadVerifyUpload',
70            [ $upload, $user, $props, $comment, $pageText, &$error ]
71        );
72    }
73
74}