Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 11 |
CRAP | |
0.00% |
0 / 1 |
CentralAuthServices | |
0.00% |
0 / 22 |
|
0.00% |
0 / 11 |
506 | |
0.00% |
0 / 1 |
getAntiSpoofManager | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getDatabaseManager | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getEditCounter | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getForcedLocalCreationService | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getSessionManager | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getUIService | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getUtilityService | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getWikiListService | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getGlobalGroupLookup | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getGlobalRenameRequestStore | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getGlobalUserSelectQueryBuilderFactory | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | */ |
20 | |
21 | namespace MediaWiki\Extension\CentralAuth; |
22 | |
23 | use MediaWiki\Extension\CentralAuth\GlobalGroup\GlobalGroupLookup; |
24 | use MediaWiki\Extension\CentralAuth\GlobalRename\GlobalRenameRequestStore; |
25 | use MediaWiki\Extension\CentralAuth\User\CentralAuthAntiSpoofManager; |
26 | use MediaWiki\Extension\CentralAuth\User\CentralAuthForcedLocalCreationService; |
27 | use MediaWiki\Extension\CentralAuth\User\GlobalUserSelectQueryBuilderFactory; |
28 | use MediaWiki\MediaWikiServices; |
29 | use Psr\Container\ContainerInterface; |
30 | |
31 | /** |
32 | * Provide access to CentralAuth provided services in static contexts. |
33 | * |
34 | * @since 1.36 |
35 | * @author Taavi "Majavah" Väänänen |
36 | */ |
37 | class CentralAuthServices { |
38 | /** |
39 | * @param ContainerInterface|null $services Service container to use. If null, global |
40 | * MediaWikiServices::getInstance() will be used instead. |
41 | * |
42 | * @return CentralAuthAntiSpoofManager |
43 | * @since 1.41 |
44 | */ |
45 | public static function getAntiSpoofManager( ContainerInterface $services = null ): CentralAuthAntiSpoofManager { |
46 | return ( $services ?: MediaWikiServices::getInstance() ) |
47 | ->getService( 'CentralAuth.CentralAuthAntiSpoofManager' ); |
48 | } |
49 | |
50 | /** |
51 | * @param ContainerInterface|null $services Service container to use. If null, global |
52 | * MediaWikiServices::getInstance() will be used instead. |
53 | * |
54 | * @return CentralAuthDatabaseManager |
55 | * @since 1.37 |
56 | */ |
57 | public static function getDatabaseManager( ContainerInterface $services = null ): CentralAuthDatabaseManager { |
58 | return ( $services ?: MediaWikiServices::getInstance() ) |
59 | ->getService( 'CentralAuth.CentralAuthDatabaseManager' ); |
60 | } |
61 | |
62 | public static function getEditCounter( |
63 | ContainerInterface $services = null |
64 | ): CentralAuthEditCounter { |
65 | return ( $services ?: MediaWikiServices::getInstance() ) |
66 | ->getService( 'CentralAuth.CentralAuthEditCounter' ); |
67 | } |
68 | |
69 | /** |
70 | * @param ContainerInterface|null $services Service container to use. If null, global |
71 | * MediaWikiServices::getInstance() will be used instead. |
72 | * |
73 | * @return CentralAuthForcedLocalCreationService |
74 | */ |
75 | public static function getForcedLocalCreationService( |
76 | ContainerInterface $services = null |
77 | ): CentralAuthForcedLocalCreationService { |
78 | return ( $services ?: MediaWikiServices::getInstance() ) |
79 | ->getService( 'CentralAuth.CentralAuthForcedLocalCreationService' ); |
80 | } |
81 | |
82 | /** |
83 | * @param ContainerInterface|null $services Service container to use. If null, global |
84 | * MediaWikiServices::getInstance() will be used instead. |
85 | * |
86 | * @return CentralAuthSessionManager |
87 | */ |
88 | public static function getSessionManager( ContainerInterface $services = null ): CentralAuthSessionManager { |
89 | return ( $services ?: MediaWikiServices::getInstance() ) |
90 | ->getService( 'CentralAuth.CentralAuthSessionManager' ); |
91 | } |
92 | |
93 | /** |
94 | * @param ContainerInterface|null $services Service container to use. If null, global |
95 | * MediaWikiServices::getInstance() will be used instead. |
96 | * |
97 | * @return CentralAuthUIService |
98 | */ |
99 | public static function getUIService( ContainerInterface $services = null ): CentralAuthUIService { |
100 | return ( $services ?: MediaWikiServices::getInstance() ) |
101 | ->getService( 'CentralAuth.CentralAuthUIService' ); |
102 | } |
103 | |
104 | /** |
105 | * @param ContainerInterface|null $services Service container to use. If null, global |
106 | * MediaWikiServices::getInstance() will be used instead. |
107 | * @return CentralAuthUtilityService |
108 | */ |
109 | public static function getUtilityService( ContainerInterface $services = null ): CentralAuthUtilityService { |
110 | return ( $services ?: MediaWikiServices::getInstance() ) |
111 | ->getService( 'CentralAuth.CentralAuthUtilityService' ); |
112 | } |
113 | |
114 | /** |
115 | * @param ContainerInterface|null $services Service container to use. If null, global |
116 | * MediaWikiServices::getInstance() will be used instead. |
117 | * @return CentralAuthWikiListService |
118 | * @since 1.37 |
119 | */ |
120 | public static function getWikiListService( ContainerInterface $services = null ): CentralAuthWikiListService { |
121 | return ( $services ?: MediaWikiServices::getInstance() ) |
122 | ->get( 'CentralAuth.CentralAuthWikiListService' ); |
123 | } |
124 | |
125 | public static function getGlobalGroupLookup( ContainerInterface $services = null ): GlobalGroupLookup { |
126 | return ( $services ?: MediaWikiServices::getInstance() ) |
127 | ->get( 'CentralAuth.GlobalGroupLookup' ); |
128 | } |
129 | |
130 | /** |
131 | * @param ContainerInterface|null $services Service container to use. If null, global |
132 | * MediaWikiServices::getInstance() will be used instead. |
133 | * @return GlobalRenameRequestStore |
134 | */ |
135 | public static function getGlobalRenameRequestStore( |
136 | ContainerInterface $services = null |
137 | ): GlobalRenameRequestStore { |
138 | return ( $services ?: MediaWikiServices::getInstance() ) |
139 | ->get( 'CentralAuth.GlobalRenameRequestStore' ); |
140 | } |
141 | |
142 | /** |
143 | * @param ContainerInterface|null $services Service container to use. If null, global |
144 | * MediaWikiServices::getInstance() will be used instead. |
145 | * @return GlobalUserSelectQueryBuilderFactory |
146 | */ |
147 | public static function getGlobalUserSelectQueryBuilderFactory( |
148 | ContainerInterface $services = null |
149 | ): GlobalUserSelectQueryBuilderFactory { |
150 | return ( $services ?: MediaWikiServices::getInstance() ) |
151 | ->get( 'CentralAuth.GlobalUserSelectQueryBuilderFactory' ); |
152 | } |
153 | } |