Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
21 / 21
100.00% covered (success)
100.00%
6 / 6
CRAP
100.00% covered (success)
100.00%
1 / 1
CentralAuthHookRunner
100.00% covered (success)
100.00%
21 / 21
100.00% covered (success)
100.00%
6 / 6
6
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
 onCentralAuthIsUIReloadRecommended
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onCentralAuthPostLoginRedirect
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onCentralAuthLoginRedirectData
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onCentralAuthSilentLoginRedirect
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 onCentralAuthWikiList
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\Extension\CentralAuth\Hooks;
4
5use MediaWiki\Extension\CentralAuth\User\CentralAuthUser;
6use MediaWiki\HookContainer\HookContainer;
7use MediaWiki\User\User;
8
9/**
10 * Run hooks provided by CentralAuth.
11 *
12 * @since 1.37
13 * @author Taavi "Majavah" Väänänen
14 */
15class CentralAuthHookRunner implements
16    CentralAuthIsUIReloadRecommendedHook,
17    CentralAuthPostLoginRedirectHook,
18    CentralAuthLoginRedirectDataHook,
19    CentralAuthSilentLoginRedirectHook,
20    CentralAuthWikiListHook
21{
22    /** @var HookContainer */
23    private $hookContainer;
24
25    /**
26     * @param HookContainer $hookContainer
27     */
28    public function __construct( HookContainer $hookContainer ) {
29        $this->hookContainer = $hookContainer;
30    }
31
32    /**
33     * @inheritDoc
34     */
35    public function onCentralAuthIsUIReloadRecommended( User $user, bool &$recommendReload ) {
36        $this->hookContainer->run(
37            'CentralAuthIsUIReloadRecommended',
38            [ $user, &$recommendReload ]
39        );
40    }
41
42    /**
43     * @inheritDoc
44     */
45    public function onCentralAuthPostLoginRedirect(
46        string &$returnTo,
47        string &$returnToQuery,
48        bool $unused,
49        string $type,
50        string &$unused2
51    ) {
52        $this->hookContainer->run(
53            'CentralAuthPostLoginRedirect',
54            [ &$returnTo, &$returnToQuery, $unused, $type, &$unused2 ]
55        );
56    }
57
58    /**
59     * @inheritDoc
60     */
61    public function onCentralAuthLoginRedirectData( CentralAuthUser $centralAuthUser, array &$data ) {
62        $this->hookContainer->run(
63            'CentralAuthLoginRedirectData',
64            [ $centralAuthUser, &$data ]
65        );
66    }
67
68    /**
69     * @inheritDoc
70     */
71    public function onCentralAuthSilentLoginRedirect( CentralAuthUser $centralAuthUser, string &$url, array $data ) {
72        $this->hookContainer->run(
73            'CentralAuthSilentLoginRedirect',
74            [ $centralAuthUser, &$url, $data ]
75        );
76    }
77
78    /**
79     * @inheritDoc
80     */
81    public function onCentralAuthWikiList( ?array &$wikiList ) {
82        $this->hookContainer->run(
83            'CentralAuthWikiList',
84            [ &$wikiList ]
85        );
86    }
87}