Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
HookRunner
100.00% covered (success)
100.00%
16 / 16
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
 onSecurePoll_GetUserParams
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
 onSecurePoll_JumpUrl
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\Extension\SecurePoll\Hooks;
4
5use MediaWiki\Extension\SecurePoll\Pages\VotePage;
6use MediaWiki\Extension\SecurePoll\User\LocalAuth;
7use MediaWiki\HookContainer\HookContainer;
8use MediaWiki\User\User;
9
10// phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
11/**
12 * Run hooks provided by SecurePoll.
13 *
14 * @author Zabe
15 * @since 1.38
16 */
17class HookRunner implements
18    SecurePoll_GetUserParamsHook,
19    SecurePoll_JumpUrlHook
20{
21    /** @var HookContainer */
22    private $hookContainer;
23
24    /**
25     * @param HookContainer $hookContainer
26     */
27    public function __construct( HookContainer $hookContainer ) {
28        $this->hookContainer = $hookContainer;
29    }
30
31    /**
32     * @inheritDoc
33     */
34    public function onSecurePoll_GetUserParams(
35        LocalAuth $localAuth,
36        User $user,
37        array &$params
38    ) {
39        $this->hookContainer->run(
40            'SecurePoll_GetUserParams',
41            [
42                $localAuth,
43                $user,
44                &$params
45            ]
46        );
47    }
48
49    /**
50     * @inheritDoc
51     */
52    public function onSecurePoll_JumpUrl(
53        VotePage $page,
54        string &$url
55    ) {
56        $this->hookContainer->run(
57            'SecurePoll_JumpUrl',
58            [
59                $page,
60                &$url
61            ]
62        );
63    }
64}