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