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
 onAPIFlowAfterExecute
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onFlowAddModules
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onFlowCheckHtmlContentXss
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onFlowTermsOfUseMessages
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Flow\Hooks;
4
5use Flow\Api\ApiFlowBase;
6use MediaWiki\Config\Config;
7use MediaWiki\HookContainer\HookContainer;
8use MediaWiki\Output\OutputPage;
9use MessageLocalizer;
10
11/**
12 * This is a hook runner class, see docs/Hooks.md in core.
13 * @internal
14 */
15class HookRunner implements
16    APIFlowAfterExecuteHook,
17    FlowAddModulesHook,
18    FlowCheckHtmlContentXssHook,
19    FlowTermsOfUseMessagesHook
20{
21    private HookContainer $hookContainer;
22
23    public function __construct( HookContainer $hookContainer ) {
24        $this->hookContainer = $hookContainer;
25    }
26
27    /**
28     * @inheritDoc
29     */
30    public function onAPIFlowAfterExecute( ApiFlowBase $module ) {
31        return $this->hookContainer->run(
32            'APIFlowAfterExecute',
33            [ $module ]
34        );
35    }
36
37    /**
38     * @inheritDoc
39     */
40    public function onFlowAddModules( OutputPage $out ) {
41        return $this->hookContainer->run(
42            'FlowAddModules',
43            [ $out ]
44        );
45    }
46
47    /**
48     * @inheritDoc
49     */
50    public function onFlowCheckHtmlContentXss( string $rawContent ) {
51        return $this->hookContainer->run(
52            'FlowCheckHtmlContentXss',
53            [ $rawContent ]
54        );
55    }
56
57    /**
58     * @inheritDoc
59     */
60    public function onFlowTermsOfUseMessages( array &$messages, MessageLocalizer $context, Config $config ) {
61        return $this->hookContainer->run(
62            'FlowTermsOfUseMessages',
63            [ &$messages, $context, $config ]
64        );
65    }
66}