Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 28 |
|
0.00% |
0 / 14 |
CRAP | |
0.00% |
0 / 1 |
CentralAuthServices | |
0.00% |
0 / 28 |
|
0.00% |
0 / 14 |
812 | |
0.00% |
0 / 1 |
getAntiSpoofManager | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
getApiTokenGenerator | |
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 | |||
getTokenManager | |
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 | |||
getGlobalRenameFactory | |
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\GlobalRenameFactory; |
25 | use MediaWiki\Extension\CentralAuth\GlobalRename\GlobalRenameRequestStore; |
26 | use MediaWiki\Extension\CentralAuth\User\CentralAuthAntiSpoofManager; |
27 | use MediaWiki\Extension\CentralAuth\User\CentralAuthForcedLocalCreationService; |
28 | use MediaWiki\Extension\CentralAuth\User\GlobalUserSelectQueryBuilderFactory; |
29 | use MediaWiki\MediaWikiServices; |
30 | use Psr\Container\ContainerInterface; |
31 | |
32 | /** |
33 | * Provide access to CentralAuth provided services in static contexts. |
34 | * |
35 | * @since 1.36 |
36 | * @author Taavi "Majavah" Väänänen |
37 | */ |
38 | class CentralAuthServices { |
39 | |
40 | /** |
41 | * @param ContainerInterface|null $services Service container to use. If null, global |
42 | * MediaWikiServices::getInstance() will be used instead. |
43 | * |
44 | * @return CentralAuthAntiSpoofManager |
45 | * @since 1.41 |
46 | */ |
47 | public static function getAntiSpoofManager( ?ContainerInterface $services = null ): CentralAuthAntiSpoofManager { |
48 | return ( $services ?: MediaWikiServices::getInstance() ) |
49 | ->getService( 'CentralAuth.CentralAuthAntiSpoofManager' ); |
50 | } |
51 | |
52 | /** |
53 | * @param ContainerInterface|null $services Service container to use. If null, global |
54 | * MediaWikiServices::getInstance() will be used instead. |
55 | * |
56 | * @return CentralAuthApiTokenGenerator |
57 | * @since 1.44 |
58 | */ |
59 | public static function getApiTokenGenerator( |
60 | ?ContainerInterface $services = null |
61 | ): CentralAuthApiTokenGenerator { |
62 | return ( $services ?: MediaWikiServices::getInstance() ) |
63 | ->getService( 'CentralAuth.CentralAuthApiTokenGenerator' ); |
64 | } |
65 | |
66 | /** |
67 | * @param ContainerInterface|null $services Service container to use. If null, global |
68 | * MediaWikiServices::getInstance() will be used instead. |
69 | * |
70 | * @return CentralAuthDatabaseManager |
71 | * @since 1.37 |
72 | */ |
73 | public static function getDatabaseManager( ?ContainerInterface $services = null ): CentralAuthDatabaseManager { |
74 | return ( $services ?: MediaWikiServices::getInstance() ) |
75 | ->getService( 'CentralAuth.CentralAuthDatabaseManager' ); |
76 | } |
77 | |
78 | public static function getEditCounter( |
79 | ?ContainerInterface $services = null |
80 | ): CentralAuthEditCounter { |
81 | return ( $services ?: MediaWikiServices::getInstance() ) |
82 | ->getService( 'CentralAuth.CentralAuthEditCounter' ); |
83 | } |
84 | |
85 | /** |
86 | * @param ContainerInterface|null $services Service container to use. If null, global |
87 | * MediaWikiServices::getInstance() will be used instead. |
88 | * |
89 | * @return CentralAuthForcedLocalCreationService |
90 | */ |
91 | public static function getForcedLocalCreationService( |
92 | ?ContainerInterface $services = null |
93 | ): CentralAuthForcedLocalCreationService { |
94 | return ( $services ?: MediaWikiServices::getInstance() ) |
95 | ->getService( 'CentralAuth.CentralAuthForcedLocalCreationService' ); |
96 | } |
97 | |
98 | /** |
99 | * @param ContainerInterface|null $services Service container to use. If null, global |
100 | * MediaWikiServices::getInstance() will be used instead. |
101 | * |
102 | * @return CentralAuthSessionManager |
103 | */ |
104 | public static function getSessionManager( ?ContainerInterface $services = null ): CentralAuthSessionManager { |
105 | return ( $services ?: MediaWikiServices::getInstance() ) |
106 | ->getService( 'CentralAuth.CentralAuthSessionManager' ); |
107 | } |
108 | |
109 | /** |
110 | * @param ContainerInterface|null $services Service container to use. If null, global |
111 | * MediaWikiServices::getInstance() will be used instead. |
112 | * |
113 | * @return CentralAuthTokenManager |
114 | */ |
115 | public static function getTokenManager( ?ContainerInterface $services = null ): CentralAuthTokenManager { |
116 | return ( $services ?: MediaWikiServices::getInstance() ) |
117 | ->getService( 'CentralAuth.CentralAuthTokenManager' ); |
118 | } |
119 | |
120 | /** |
121 | * @param ContainerInterface|null $services Service container to use. If null, global |
122 | * MediaWikiServices::getInstance() will be used instead. |
123 | * |
124 | * @return CentralAuthUIService |
125 | */ |
126 | public static function getUIService( ?ContainerInterface $services = null ): CentralAuthUIService { |
127 | return ( $services ?: MediaWikiServices::getInstance() ) |
128 | ->getService( 'CentralAuth.CentralAuthUIService' ); |
129 | } |
130 | |
131 | /** |
132 | * @param ContainerInterface|null $services Service container to use. If null, global |
133 | * MediaWikiServices::getInstance() will be used instead. |
134 | * @return CentralAuthUtilityService |
135 | */ |
136 | public static function getUtilityService( ?ContainerInterface $services = null ): CentralAuthUtilityService { |
137 | return ( $services ?: MediaWikiServices::getInstance() ) |
138 | ->getService( 'CentralAuth.CentralAuthUtilityService' ); |
139 | } |
140 | |
141 | /** |
142 | * @param ContainerInterface|null $services Service container to use. If null, global |
143 | * MediaWikiServices::getInstance() will be used instead. |
144 | * @return CentralAuthWikiListService |
145 | * @since 1.37 |
146 | */ |
147 | public static function getWikiListService( ?ContainerInterface $services = null ): CentralAuthWikiListService { |
148 | return ( $services ?: MediaWikiServices::getInstance() ) |
149 | ->get( 'CentralAuth.CentralAuthWikiListService' ); |
150 | } |
151 | |
152 | public static function getGlobalGroupLookup( ?ContainerInterface $services = null ): GlobalGroupLookup { |
153 | return ( $services ?: MediaWikiServices::getInstance() ) |
154 | ->get( 'CentralAuth.GlobalGroupLookup' ); |
155 | } |
156 | |
157 | /** |
158 | * @param ContainerInterface|null $services Service container to use. If null, global |
159 | * MediaWikiServices::getInstance() will be used instead. |
160 | * @return GlobalRenameFactory |
161 | */ |
162 | public static function getGlobalRenameFactory( |
163 | ?ContainerInterface $services = null |
164 | ): GlobalRenameFactory { |
165 | return ( $services ?: MediaWikiServices::getInstance() ) |
166 | ->get( 'CentralAuth.GlobalRenameFactory' ); |
167 | } |
168 | |
169 | /** |
170 | * @param ContainerInterface|null $services Service container to use. If null, global |
171 | * MediaWikiServices::getInstance() will be used instead. |
172 | * @return GlobalRenameRequestStore |
173 | */ |
174 | public static function getGlobalRenameRequestStore( |
175 | ?ContainerInterface $services = null |
176 | ): GlobalRenameRequestStore { |
177 | return ( $services ?: MediaWikiServices::getInstance() ) |
178 | ->get( 'CentralAuth.GlobalRenameRequestStore' ); |
179 | } |
180 | |
181 | /** |
182 | * @param ContainerInterface|null $services Service container to use. If null, global |
183 | * MediaWikiServices::getInstance() will be used instead. |
184 | * @return GlobalUserSelectQueryBuilderFactory |
185 | */ |
186 | public static function getGlobalUserSelectQueryBuilderFactory( |
187 | ?ContainerInterface $services = null |
188 | ): GlobalUserSelectQueryBuilderFactory { |
189 | return ( $services ?: MediaWikiServices::getInstance() ) |
190 | ->get( 'CentralAuth.GlobalUserSelectQueryBuilderFactory' ); |
191 | } |
192 | } |