Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
NukeHookRunner
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
3 / 3
3
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
 onNukeDeletePage
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onNukeGetNewPages
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\Extension\Nuke\Hooks;
4
5use MediaWiki\HookContainer\HookContainer;
6use MediaWiki\Title\Title;
7
8/**
9 * Handle running Nuke's hooks
10 * @author DannyS712
11 */
12class NukeHookRunner implements NukeDeletePageHook, NukeGetNewPagesHook {
13
14    private HookContainer $hookContainer;
15
16    public function __construct( HookContainer $hookContainer ) {
17        $this->hookContainer = $hookContainer;
18    }
19
20    /**
21     * @inheritDoc
22     */
23    public function onNukeDeletePage( Title $title, string $reason, bool &$deletionResult ) {
24        return $this->hookContainer->run(
25            'NukeDeletePage',
26            [ $title, $reason, &$deletionResult ]
27        );
28    }
29
30    /**
31     * @inheritDoc
32     */
33    public function onNukeGetNewPages(
34        string $username,
35        ?string $pattern,
36        ?int $namespace,
37        int $limit,
38        array &$pages
39    ) {
40        return $this->hookContainer->run(
41            'NukeGetNewPages',
42            [ $username, $pattern, $namespace, $limit, &$pages ]
43        );
44    }
45
46}